Skip to content

Commit 08175e1

Browse files
committed
Add bdelete in quitpre as tentative to fix persistent buffer
1 parent 1eb9b1e commit 08175e1

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

lua/server/server_functions.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ function _G.unception_handle_quitpre(quitpre_buffer_filepath)
5454
end
5555

5656
unblock_client_and_reset_state()
57+
-- this will delete holding buffer, so neovim will be forced
58+
-- to reload the file, this fix sequential git rebase -i for example
59+
vim.cmd(("bdelete! %d"):format(vim.api.nvim_get_current_buf()))
5760
end
5861
end
5962

@@ -79,6 +82,9 @@ function _G.unception_notify_when_done_editing(pipe_to_respond_on, filepath)
7982
-- When done editing in another tab we can't use QuitPre becuase if we switch
8083
-- back to the previous tabpage within QuitPre it will prevent the tab to be closed
8184
-- So here we use the TabClosed event
85+
if unception_tabclosed_autocmd_id then
86+
vim.api.nvim_del_autocmd(unception_tabclosed_autocmd_id)
87+
end
8288
unception_tabclosed_autocmd_id = vim.api.nvim_create_autocmd("TabClosed",
8389
{ callback = unception_handle_tabclosed })
8490
end

0 commit comments

Comments
 (0)