Skip to content

Commit 611ed89

Browse files
committed
fix
1 parent 62a5fd5 commit 611ed89

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

lua/core/autocmds.lua

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,20 @@ local function is_shared_session()
2929
return false
3030
end
3131

32+
-- Create an autocommand group for shared session warning
33+
local shared_session_group = vim.api.nvim_create_augroup("SharedSessionWarning", { clear = true })
34+
35+
3236
-- Override quit commands for shared sessions
3337
vim.api.nvim_create_autocmd('VimLeavePre', {
34-
group = augroup 'shared_session_warning',
38+
group = shared_session_group,
3539
callback = function()
3640
if is_shared_session() then
37-
vim.ui.input({
38-
prompt = '⚠️ Are you sure you want to close a shared session? ',
39-
}, function(input)
40-
if not input or input:lower() ~= 'y' then
41-
-- Cancel the quit
42-
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<C-c>', true, false, true), 'n', false)
43-
error 'Quit cancelled'
44-
end
45-
end)
41+
local response = vim.fn.input("⚠️ Closing shared nvim session! Confirm with y/Y: ")
42+
if response:lower() ~= "y" then
43+
-- Cancel the quit by throwing an error
44+
error("Quit cancelled")
45+
end
4646
end
4747
end,
4848
})

0 commit comments

Comments
 (0)