From e1d32ca42ee6fdef8c724e3f391e548895f0bdcf Mon Sep 17 00:00:00 2001 From: Abouzar Parvan Date: Tue, 3 May 2022 19:01:53 +0430 Subject: feat(quit): make sure to ask before discarding changes (#2554) --- lua/lvim/utils/functions.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 lua/lvim/utils/functions.lua (limited to 'lua/lvim/utils') 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 -- cgit v1.2.3 From 23df368b00bda0ed4a01fac92f7ad80998c1d34a Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Sat, 21 May 2022 16:48:47 +0200 Subject: refactor: load the default options once (#2592) BREAKING CHANGE: modifying the default options for keymaps and autocmds is now done by overwriting them, since they won't be loaded into the global `lvim` table anymore * refactor: use the lua-commands api * refactor!: use the lua-autocmds api * fix(settings): let neovim handle spellfile * feat: add log:set_log_level() * chore: update examples * chore: add deprecation notice for custom_groups --- lua/lvim/utils/git.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lua/lvim/utils') diff --git a/lua/lvim/utils/git.lua b/lua/lvim/utils/git.lua index f38a727f..81b1faf4 100644 --- a/lua/lvim/utils/git.lua +++ b/lua/lvim/utils/git.lua @@ -115,6 +115,20 @@ function M.get_lvim_tag() return tag end +---Get currently running version of Lunarvim +---@return string +function M.get_lvim_version() + local current_branch = M.get_lvim_branch() + + local lvim_version + if current_branch ~= "HEAD" or "" then + lvim_version = current_branch .. "-" .. M.get_lvim_current_sha() + else + lvim_version = "v" .. M.get_lvim_tag() + end + return lvim_version +end + ---Get the commit hash of currently checked-out commit of Lunarvim ---@return string|nil function M.get_lvim_current_sha() -- cgit v1.2.3