How to find all occurrences of a variable in Vim?

In vim, how do I find all occurrences of a variable in files under a specific directory?

I know that vimgrep works sometimes, but it searches only for text and does not work if other classes have variables with the same name, and I only need a variable under a specific class.

What should I do? Or should I get an IDE instead?

+5
source share
2 answers

Why do you want to use a different IDE if you already have one? Vim is an IDE that is customizable and can be used for different languages.

You can use cscopeto create a database of your code. This database

  • Allows you to search for code for:
    • all character references
    • ,
    • ,
    • ,

Cscope:

  • Curses based ( )
  • C, , ++ Java, " grep" ( !)
  • backend GUI/frontend
  • Unix, , .

, , ..


( OT):
, Vim , - taglist, Ctags:

" " - Vim .

+11

cscope

:

cscope -Rb

cscope.out, . , , ​​Linux.

vim :

:cs add cscope.out
:cs find s my_func

s symbol. cscope.

cscope (ouside Vim) ( ), , -, Vim (?)

quickfix, :

:copen

enter, .

. :

+3

All Articles