diff options
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r-- | runtime/lua/vim/_defaults.lua | 4 | ||||
-rw-r--r-- | runtime/lua/vim/_meta/vvars.lua | 2 | ||||
-rw-r--r-- | runtime/lua/vim/diagnostic.lua | 21 | ||||
-rw-r--r-- | runtime/lua/vim/loader.lua | 6 |
4 files changed, 29 insertions, 4 deletions
diff --git a/runtime/lua/vim/_defaults.lua b/runtime/lua/vim/_defaults.lua index ef83a3ccc3..f891c3baa4 100644 --- a/runtime/lua/vim/_defaults.lua +++ b/runtime/lua/vim/_defaults.lua @@ -49,10 +49,10 @@ do vim.keymap.set('x', '*', function() return _visual_search('/') - end, { desc = ':help v_star-default', expr = true, silent = true }) + end, { desc = ':help v_star-default', expr = true, replace_keycodes = false }) vim.keymap.set('x', '#', function() return _visual_search('?') - end, { desc = ':help v_#-default', expr = true, silent = true }) + end, { desc = ':help v_#-default', expr = true, replace_keycodes = false }) end --- Map Y to y$. This mimics the behavior of D and C. See |Y-default| diff --git a/runtime/lua/vim/_meta/vvars.lua b/runtime/lua/vim/_meta/vvars.lua index 8784fdbac9..264907109f 100644 --- a/runtime/lua/vim/_meta/vvars.lua +++ b/runtime/lua/vim/_meta/vvars.lua @@ -197,6 +197,8 @@ vim.v.errors = ... --- changing window (or tab) on `DirChanged`. --- status Job status or exit code, -1 means "unknown". `TermClose` --- reason Reason for completion being done. `CompleteDone` +--- complete_word The word that was selected, empty if abandoned complete. +--- complete_type See `complete_info_mode` --- @type any vim.v.event = ... diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua index 2de996feeb..dbf4f56032 100644 --- a/runtime/lua/vim/diagnostic.lua +++ b/runtime/lua/vim/diagnostic.lua @@ -2,6 +2,8 @@ local api, if_nil = vim.api, vim.F.if_nil local M = {} +local _qf_id = nil + --- [diagnostic-structure]() --- --- Diagnostics use the same indexing as the rest of the Nvim API (i.e. 0-based @@ -848,9 +850,24 @@ local function set_list(loclist, opts) local diagnostics = get_diagnostics(bufnr, opts --[[@as vim.diagnostic.GetOpts]], false) local items = M.toqflist(diagnostics) if loclist then - vim.fn.setloclist(winnr, {}, ' ', { title = title, items = items }) + vim.fn.setloclist(winnr, {}, 'u', { title = title, items = items }) else - vim.fn.setqflist({}, ' ', { title = title, items = items }) + -- Check if the diagnostics quickfix list no longer exists. + if _qf_id and vim.fn.getqflist({ id = _qf_id }).id == 0 then + _qf_id = nil + end + + -- If we already have a diagnostics quickfix, update it rather than creating a new one. + -- This avoids polluting the finite set of quickfix lists, and preserves the currently selected + -- entry. + vim.fn.setqflist({}, _qf_id and 'u' or ' ', { + title = title, + items = items, + id = _qf_id, + }) + + -- Get the id of the newly created quickfix list. + _qf_id = vim.fn.getqflist({ id = 0 }).id end if open then api.nvim_command(loclist and 'lwindow' or 'botright cwindow') diff --git a/runtime/lua/vim/loader.lua b/runtime/lua/vim/loader.lua index 71d0188128..c7158673fe 100644 --- a/runtime/lua/vim/loader.lua +++ b/runtime/lua/vim/loader.lua @@ -446,6 +446,12 @@ function M.enable(enable) end end +--- @deprecated +function M.disable() + vim.deprecate('vim.loader.disable', 'vim.loader.enable(false)', '0.12') + vim.loader.enable(false) +end + --- Tracks the time spent in a function --- @generic F: function --- @param f F |