I know this is very simple question and really there are very huge source of information but I really not able to find the solution to my question.
I have tried with cscope
and got the references but then once I am in the file not find the way to go go to the next occurrence.
I know the use of Ctrl+] with ctags but that is not what I want.I want to go all the reference of a text one by one .
like when we want to change a prototype of a function and want to go one by one.
Hope there is some way for it.
You are looking for :tnext
and :tprevious
.
Read the following help topics:
:help tags
:help ctags
:help cscope
But here is a generic "search/replace in project" method…
search for that string in your whole project and list the matching lines in the quickfix window:
:vim foo **/*.py | cw
record your change in a simple macro:
qq ciwbar<Esc> :cnext<CR> q
repeat that change for every match in the list:
@q @@ @@ …
skipping irrelevant matches with :cnext
.
and another one…
open a new tab:
:tabnew<CR>
populate the local argument list with files that contain your search pattern:
:arglocal `grep -Rl foo *.js`<CR>
perform a global search/replace on every file in the local argument list
:argdo %s/foo/bar/gc<CR> yyyynnnyyy…
Are you using the cscope
plugin for vim
?
After searching for something you can use :cnext
and :cprev
to go through the results. If that's too cumbersome, you can add a shortcut to your .vimrc
; for example:
noremap nn :cnext <CR>
, which will make nn
a shortcut for :cnext
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.