mirror of
https://github.com/LunarVim/LunarVim.git
synced 2025-08-15 15:12:23 +02:00
19 lines
387 B
Lua
19 lines
387 B
Lua
local M = {}
|
|
|
|
function M.smart_quit()
|
|
local bufnr = vim.api.nvim_get_current_buf()
|
|
local modified = vim.api.nvim_buf_get_option(bufnr, "modified")
|
|
if modified then
|
|
vim.ui.input({
|
|
prompt = "You have unsaved changes. Quit anyway? (y/n) ",
|
|
}, function(input)
|
|
if input == "y" then
|
|
vim.cmd "q!"
|
|
end
|
|
end)
|
|
else
|
|
vim.cmd "q!"
|
|
end
|
|
end
|
|
|
|
return M
|