mirror of
https://github.com/neovim/neovim.git
synced 2026-04-21 14:55:33 +00:00
feat(lua): replace buffer with buf in vim.keymap.set/del #38360
The `buffer` option remains functional but is now undocumented. Providing both will raise an error. Since providing `buf` was disallowed before, there is no code that will break due to using `buffer` alongside `buf`.
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
vim.keymap.set('n', 'gO', function()
|
||||
require('vim.treesitter._headings').show_toc(6)
|
||||
end, { buffer = 0, silent = true, desc = 'Show an Outline of the current buffer' })
|
||||
end, { buf = 0, silent = true, desc = 'Show an Outline of the current buffer' })
|
||||
|
||||
vim.keymap.set('n', ']]', function()
|
||||
require('vim.treesitter._headings').jump({ count = 1, level = 1 })
|
||||
end, { buffer = 0, silent = false, desc = 'Jump to next section' })
|
||||
end, { buf = 0, silent = false, desc = 'Jump to next section' })
|
||||
vim.keymap.set('n', '[[', function()
|
||||
require('vim.treesitter._headings').jump({ count = -1, level = 1 })
|
||||
end, { buffer = 0, silent = false, desc = 'Jump to previous section' })
|
||||
end, { buf = 0, silent = false, desc = 'Jump to previous section' })
|
||||
|
||||
vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '')
|
||||
.. '\n sil! exe "nunmap <buffer> gO"'
|
||||
|
||||
@@ -57,14 +57,14 @@ end
|
||||
|
||||
vim.keymap.set('n', 'gO', function()
|
||||
require('vim.treesitter._headings').show_toc()
|
||||
end, { buffer = 0, silent = true, desc = 'Show an Outline of the current buffer' })
|
||||
end, { buf = 0, silent = true, desc = 'Show an Outline of the current buffer' })
|
||||
|
||||
vim.keymap.set('n', ']]', function()
|
||||
require('vim.treesitter._headings').jump({ count = 1 })
|
||||
end, { buffer = 0, silent = false, desc = 'Jump to next section' })
|
||||
end, { buf = 0, silent = false, desc = 'Jump to next section' })
|
||||
vim.keymap.set('n', '[[', function()
|
||||
require('vim.treesitter._headings').jump({ count = -1 })
|
||||
end, { buffer = 0, silent = false, desc = 'Jump to previous section' })
|
||||
end, { buf = 0, silent = false, desc = 'Jump to previous section' })
|
||||
|
||||
local parser = assert(vim.treesitter.get_parser(0, 'vimdoc'))
|
||||
|
||||
@@ -111,7 +111,7 @@ local function runnables()
|
||||
elseif code_block.lang == 'vim' then
|
||||
vim.cmd(code_block.code)
|
||||
end
|
||||
end, { buffer = true })
|
||||
end, { buf = true })
|
||||
end
|
||||
|
||||
-- Retry once if the buffer has changed during the iteration of the code
|
||||
|
||||
@@ -2,14 +2,14 @@ vim.treesitter.start()
|
||||
|
||||
vim.keymap.set('n', 'gO', function()
|
||||
require('vim.treesitter._headings').show_toc()
|
||||
end, { buffer = 0, silent = true, desc = 'Show an Outline of the current buffer' })
|
||||
end, { buf = 0, silent = true, desc = 'Show an Outline of the current buffer' })
|
||||
|
||||
vim.keymap.set('n', ']]', function()
|
||||
require('vim.treesitter._headings').jump({ count = 1 })
|
||||
end, { buffer = 0, silent = false, desc = 'Jump to next section' })
|
||||
end, { buf = 0, silent = false, desc = 'Jump to next section' })
|
||||
vim.keymap.set('n', '[[', function()
|
||||
require('vim.treesitter._headings').jump({ count = -1 })
|
||||
end, { buffer = 0, silent = false, desc = 'Jump to previous section' })
|
||||
end, { buf = 0, silent = false, desc = 'Jump to previous section' })
|
||||
|
||||
vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '')
|
||||
.. '\n sil! exe "nunmap <buffer> gO"'
|
||||
|
||||
@@ -59,7 +59,7 @@ local map_section_jump = function(lhs, search_flags, desc)
|
||||
for _ = 1, vim.v.count1 do
|
||||
vim.fn.search('^## ', search_flags)
|
||||
end
|
||||
end, { buffer = 0, desc = desc })
|
||||
end, { buf = 0, desc = desc })
|
||||
end
|
||||
|
||||
map_section_jump('[[', 'bsW', 'Previous plugin')
|
||||
|
||||
Reference in New Issue
Block a user