feat(nvim): add bindings for visual mode macro invocations

NOTE: This is implementing https://github.com/neovim/neovim/pull/26495
early. Once that is merged this is no longer needed.
This commit is contained in:
Price Hiller 2023-12-26 16:54:54 -06:00
parent 2f46237981
commit 42dc2d822c
Signed by: Price
SSH Key Fingerprint: SHA256:Y4S9ZzYphRn1W1kbJerJFO6GGsfu9O70VaBSxJO7dF8
2 changed files with 7 additions and 1 deletions

View File

@ -105,6 +105,12 @@ M.setup = function()
-- Binding to allow shift tab dedent -- Binding to allow shift tab dedent
vim.keymap.set("i", "<S-Tab>", "<C-d>", { silent = true, desc = "Insert: Dedent" }) vim.keymap.set("i", "<S-Tab>", "<C-d>", { silent = true, desc = "Insert: Dedent" })
-- Allow macros to be invoked over a visual range via a keybind in visual mode
vim.keymap.set("x", "@", "':normal! @'.getcharstr().'<CR>'",
{ silent = true, expr = true, desc = "Call Macro Against Visual Selection" })
vim.keymap.set("x", "Q", ':normal! @<C-R>=reg_recorded()<CR><CR>',
{ silent = true, desc = "Call Last Macro Against Visual Selection" })
end end
return M return M

View File

@ -3,7 +3,7 @@ return {
"chrisgrieser/nvim-various-textobjs", "chrisgrieser/nvim-various-textobjs",
opts = { opts = {
useDefaultKeymaps = true, useDefaultKeymaps = true,
disabledKeymaps = { "r", "R" }, disabledKeymaps = { "r", "R", "Q" },
}, },
}, },
} }