Is your feature request related to a problem? Please describe.
I'm trying to register a keybinding for IncRename but this general question came up.
When the cursor is on a LSP identifier and I'm entering the command :IncRename xxx it renames the word under the cursor to xxx while highlighting it in the buffer.
The problem is xxx of course is a custom name for a LSP identifier that changes when running the command for another variable, function etc.
Which-key can (to my limited knowledge) only register a final command that does not get arguments of any kind.
I tried registering it in different ways but I can never enter a unique argument when running the command each time.
wk.register({
["<leader>r"] = { name = "refactor" },
["<leader>rvariant1"] = { "<Cmd>IncRename", "Rename" }, -- not working due to missing <CR>
["<leader>rvariant2"] = { -- not working because no argument is passed
"<Cmd>lua vim.api.nvim_command(':IncRename ' )<CR>" , "Rename current word"
},
})
Describe the solution you'd like
I'm looking for a way to register a command that receives an argument so I can press the keybinding and simply start typing then.
Like so (naive approach with pseudo code):
Did you check the docs?
Is your feature request related to a problem? Please describe.
I'm trying to register a keybinding for IncRename but this general question came up.
When the cursor is on a LSP identifier and I'm entering the command
:IncRename xxx
it renames the word under the cursor toxxx
while highlighting it in the buffer. The problem isxxx
of course is a custom name for a LSP identifier that changes when running the command for another variable, function etc. Which-key can (to my limited knowledge) only register a final command that does not get arguments of any kind.I tried registering it in different ways but I can never enter a unique argument when running the command each time.
Describe the solution you'd like
I'm looking for a way to register a command that receives an argument so I can press the keybinding and simply start typing then. Like so (naive approach with pseudo code):
Where is unique in each run of the command.
Describe alternatives you've considered
My current alternative is to register the keybinding like so: And use which-key only for the documentation.
Additional context
None, but thanks for the help.