2
votes

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 ?

2
emacs :P. Just kidding, I'm a vim user, although I've never tried to do this before, it would be useful. - jli

2 Answers

3
votes

I think you're looking for something like this:

nnoremap <C-g> :cs f g<enter>

For more information, see :help map-commands.

1
votes

Give this a try

nnoremap <C-g> :execute "normal! cs\ f\ g"<cr>