Vim | Better Way Of Setting Mapping That Calls Cmd
Question
I was trying to create mapping that will not be run for help filetype but during that I found out how to propperly set mapping that will run function in command mode
Answer
<Cmd>!
The <Cmd> pseudokey begins a “command mapping”, which executes the command directly (without changing modes). Where you might use “:…<CR>” in the {lhs} of a mapping, you can instead use “<Cmd>…<CR>”.
nnoremap <buffer> <C-]> <Cmd>call JumpToTagWithLocationList()<CR>
There is <Cmd> argument for :map. For more info :h :map-<cmd>
What I Learned
- How to exclude in autocmd https://stackoverflow.com/a/28838030/3627387
- There is
<buffer>setting for:map
Tags: