mirror of
https://github.com/neovim/neovim.git
synced 2025-10-08 02:46:31 +00:00
feat(pack): add [[
and ]]
mappings in confirmation buffer
Problem: No easy/robust way to jump between plugin sections. Solution: Add `[[` and `]]` mappings.
This commit is contained in:
@@ -393,9 +393,10 @@ update({names}, {opts}) *vim.pack.update()*
|
||||
• Depending on `force`:
|
||||
• If `false`, show confirmation buffer. It lists data about all set to
|
||||
update plugins. Pending changes starting with `>` will be applied
|
||||
while the ones starting with `<` will be reverted. It has special
|
||||
in-process LSP server attached to provide more interactive features.
|
||||
Currently supported methods:
|
||||
while the ones starting with `<` will be reverted. It has dedicated
|
||||
buffer-local mappings:
|
||||
• |]]| and |[[| to navigate through plugin sections.
|
||||
Some features are provided via LSP:
|
||||
• 'textDocument/documentSymbol' (`gO` via |lsp-defaults| or
|
||||
|vim.lsp.buf.document_symbol()|) - show structure of the buffer.
|
||||
• 'textDocument/hover' (`K` via |lsp-defaults| or
|
||||
|
@@ -1,3 +1,4 @@
|
||||
-- Highlighting
|
||||
local ns = vim.api.nvim_create_namespace('nvim.pack.confirm')
|
||||
vim.api.nvim_buf_clear_namespace(0, ns, 0, -1)
|
||||
|
||||
@@ -49,3 +50,15 @@ for i, l in ipairs(lines) do
|
||||
hi_range(i, 4, l:len(), 'DiagnosticHint')
|
||||
end
|
||||
end
|
||||
|
||||
-- Mappings
|
||||
local map_section_jump = function(lhs, search_flags, desc)
|
||||
vim.keymap.set({ 'n', 'x' }, lhs, function()
|
||||
for _ = 1, vim.v.count1 do
|
||||
vim.fn.search('^## ', search_flags)
|
||||
end
|
||||
end, { buffer = 0, desc = desc })
|
||||
end
|
||||
|
||||
map_section_jump('[[', 'bsW', 'Previous plugin')
|
||||
map_section_jump(']]', 'sW', 'Next plugin')
|
||||
|
@@ -957,8 +957,10 @@ end
|
||||
--- - If `false`, show confirmation buffer. It lists data about all set to
|
||||
--- update plugins. Pending changes starting with `>` will be applied while
|
||||
--- the ones starting with `<` will be reverted.
|
||||
--- It has special in-process LSP server attached to provide more interactive
|
||||
--- features. Currently supported methods:
|
||||
--- It has dedicated buffer-local mappings:
|
||||
--- - |]]| and |[[| to navigate through plugin sections.
|
||||
---
|
||||
--- Some features are provided via LSP:
|
||||
--- - 'textDocument/documentSymbol' (`gO` via |lsp-defaults|
|
||||
--- or |vim.lsp.buf.document_symbol()|) - show structure of the buffer.
|
||||
--- - 'textDocument/hover' (`K` via |lsp-defaults| or |vim.lsp.buf.hover()|) -
|
||||
|
Reference in New Issue
Block a user