mirror of
https://github.com/neovim/neovim.git
synced 2025-11-17 15:51:32 +00:00
fix(docs): replace yxx mappings with g== #31947
Problem: `yx` uses "y" prefix, which shadows a builtin operator. Solution: Use `g=` (in the form of `g==` currently), drawing from precedent of CTRL-= and 'tpope/vim-scriptease'.
This commit is contained in:
committed by
GitHub
parent
9552fe7ef9
commit
09bcb31068
@@ -57,7 +57,7 @@ for _, match, metadata in query:iter_matches(tree:root(), 0, 0, -1) do
|
||||
|
||||
if name == 'code' then
|
||||
vim.api.nvim_buf_set_extmark(0, run_message_ns, start, 0, {
|
||||
virt_text = { { 'Run with `yxx`', 'LspCodeLens' } },
|
||||
virt_text = { { 'Run with `g==`', 'LspCodeLens' } },
|
||||
})
|
||||
local code = vim.treesitter.get_node_text(node, 0)
|
||||
local lang_node = match[metadata[id].lang][1] --[[@as TSNode]]
|
||||
@@ -69,7 +69,7 @@ for _, match, metadata in query:iter_matches(tree:root(), 0, 0, -1) do
|
||||
end
|
||||
end
|
||||
|
||||
vim.keymap.set('n', 'yxx', function()
|
||||
vim.keymap.set('n', 'g==', function()
|
||||
local pos = vim.api.nvim_win_get_cursor(0)[1]
|
||||
local code_block = code_blocks[pos]
|
||||
if not code_block then
|
||||
@@ -82,5 +82,5 @@ vim.keymap.set('n', 'yxx', function()
|
||||
end, { buffer = true })
|
||||
|
||||
vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '')
|
||||
.. '\n exe "nunmap <buffer> gO" | exe "nunmap <buffer> yxx"'
|
||||
.. '\n exe "nunmap <buffer> gO" | exe "nunmap <buffer> g=="'
|
||||
vim.b.undo_ftplugin = vim.b.undo_ftplugin .. ' | call v:lua.vim.treesitter.stop()'
|
||||
|
||||
Reference in New Issue
Block a user