Key bindings for a repetitive action in VIM editor
-
01-03-2021 - |
Question
I use Vim + Cscope for coding in a large repository.
With the integration of cscope in Vim, say to find the definition of variable, i have to type ":cs f g " on vi's command line.
Is there a easy way to map these actions? Like say if i type (Ctrl + g) on a particular variable, it automatically goes to the variable's definitions ? (Ctrl + s) shows the list of occurrences of the symbol under the cursor ?
Solution
I think you're looking for something like this:
nnoremap <C-g> :cs f g<enter>
For more information, see :help map-commands
.
OTHER TIPS
Give this a try
nnoremap <C-g> :execute "normal! cs\ f\ g"<cr>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow