vimcommandshortcutcscope

use word under cursor in cscope search


Is there a way to use the word under the cursor in a cscope search in Vim? If the cursor is over a variable Foo and I want to avoid needing to type Foo again in the command line but would like to assemble :cs f s Foo.

Is there any way I can automate it?


Solution

  • Use CTRL-R CTRL-W to copy the word under cursor to the command line:

    :cs f s <C-R><C-W>
    

    See the documentation for more information.