mirror of
https://github.com/neovide/neovide.git
synced 2026-09-10 15:26:23 -04:00
* Enabled remapping of Command+Q on macOS * Included existing exit logic with Cmd+Q on macOS
31 lines
775 B
Lua
31 lines
775 B
Lua
local function quit(confirm)
|
|
if confirm then
|
|
vim.cmd("confirm qa")
|
|
else
|
|
vim.cmd("qa!")
|
|
end
|
|
end
|
|
|
|
local function detach_handler(is_remote)
|
|
if is_remote then
|
|
local detach = vim.g.neovide_detach_on_quit or "prompt"
|
|
local c
|
|
if detach == "always_quit" then
|
|
c = 2
|
|
elseif detach == "always_detach" then
|
|
c = 1
|
|
else
|
|
c = vim.fn.confirm("Closing remote connection.", "&Detach\n&Quit\n&Cancel", 1)
|
|
end
|
|
|
|
if c == 1 then
|
|
vim.fn.chanclose(vim.g.neovide_channel_id)
|
|
elseif c == 2 then
|
|
quit(vim.g.neovide_confirm_quit or false)
|
|
end
|
|
else
|
|
quit(vim.g.neovide_confirm_quit or false)
|
|
end
|
|
end
|
|
return detach_handler(...)
|