[FeatReq] Different cmd per mode - like keybindings
XobSod opened this issue · comments
I am new to vim with lua so this may make no sense... Lets do simple example: saving buffer.
In normal
mode it is: :w<CR>
In insert
mode it is: <Esc>:w<CR>a
And I would for example map those both to <c-s>
Now (I think) there is no way of adding this to the command center.
There is an option to add different keybinding per mode you are in, so for example you can run a command just by s
in normal
but <c-s>
in insert
but in both cases the command is the same, there is no way of passing different command for each mode.
I think it would be great addition to be able to invoke different commands dependent the mode you are currently in. What do you think?
The workaround I am currently thinking is to write lua function that will decide inside which cmd to run and pass the function to the command center, but I think CC should natively support this ;)
To achieve this, you just need
command_center.add({
{
desc = "save",
cmd = "<CMD>w<CR>",
keys = {
{"n", "s" },
{"i", "<C-s>" },
}
})