If I use :vimgrep, it searches all files under current directory. But my requirement is to search/replace among all opened files.
E.g. I'm using vim to open 3 files at the same time
vim 1.cpp 2.cpp 3.cpp
I wish to:
search all functions called "main" and display in quickfix window, among all 3 files.
Replace all "hello" with "world" in all 3 files.
Use the command :
bufdo %s/string/replacement/g
bufdo : action on all buffers .
s : replacing
g : globally .