From fbc1377ace478936bb4c425e48cd34af3ffc81c0 Mon Sep 17 00:00:00 2001 From: wenjin <30885216+wenjinnn@users.noreply.github.com> Date: Tue, 28 May 2024 11:54:34 +0800 Subject: [PATCH] feat(hurl): add buffer name for split response window (#163) --- lua/hurl/split.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lua/hurl/split.lua b/lua/hurl/split.lua index 3b912e1..3fc0d50 100644 --- a/lua/hurl/split.lua +++ b/lua/hurl/split.lua @@ -23,6 +23,8 @@ M.show = function(data, type) -- mount/open the component split:mount() + vim.api.nvim_buf_set_name(split.bufnr, 'hurl-response') + if _HURL_GLOBAL_CONFIG.auto_close then -- unmount component when buffer is closed split:on(event.BufLeave, function() @@ -51,6 +53,8 @@ M.show = function(data, type) vim.api.nvim_buf_set_lines(split.bufnr, headers_table.line, -1, false, content) local function quit() + -- set buffer name to empty string so it wouldn't conflict when next time buffer opened + vim.api.nvim_buf_set_name(split.bufnr, '') vim.cmd('q') split:unmount() end