diff options
author | kylo252 <[email protected]> | 2022-05-25 13:35:38 +0200 |
---|---|---|
committer | kylo252 <[email protected]> | 2022-05-25 13:35:38 +0200 |
commit | fc63a66ce8d26ab7acf5e178b85d0f69b097ca7e (patch) | |
tree | 1dc5ddb0ec1cdd1d225ded33f157a890699fc348 /lua/lvim/utils/functions.lua | |
parent | aa4c9930d9131c60d7a6f2e9bec8a2f3ba6c4055 (diff) | |
parent | 6dbba1f9597e0ba090702aea41357c29874aab7c (diff) |
Merge remote-tracking branch 'origin/rolling'
Diffstat (limited to 'lua/lvim/utils/functions.lua')
-rw-r--r-- | lua/lvim/utils/functions.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lua/lvim/utils/functions.lua b/lua/lvim/utils/functions.lua new file mode 100644 index 00000000..de46bc8a --- /dev/null +++ b/lua/lvim/utils/functions.lua @@ -0,0 +1,19 @@ +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 |