I agree with the "Vim is a IDE" paradigm. But there are times when there is no IDE. Here is what I use in situations like this:
: grep ,: vimgrep ,: Ag ,: Ggrep
Refactoring, which is more associated with regular replacements, I usually use : grep in my project tree, and then write a macro to refactor -: g and: s are not difficult. This usually allows me to quickly change a large number of files without much effort. Honestly, I use this method more than any other.
Inline commands may be slow / inconvenient depending on your workflow. If you use git, then you will want to use the excellent Fugitive plugin and its command :Ggrep only to search for files marked in git. I also like Silver Searcher for its speed.
: argdo ,: cdo, and: bufdo
: cdo and : argdo are convenient for executing vim commands on a set of files.
command line
When using :vimgrep determine the list of files requiring changes becomes more difficult, I resort to the grep / find command line commands to more accurately make a list of files that I need to reorganize. Save the list to a text file and use :e and a macro collage to make the necessary changes.
I find that the less rusty macro writing skills I have, the more useful I find Vim for refactoring: convenient saving / restoring from registers, increasing / decreasing variable counter counts, cleaning / saving macro entries to a file for later use, etc. .
Update
Since this video was written about the methods that I describe, have been published on vimcasts.org (I urge you to watch ALL Vimcasts! ). For refactoring see these:
Wimgolf is also a great way to practice.
The ubiquity of Language Server Protocol servers since I wrote this answer has also made refactoring possible in Vim (and other editors). In their opinion, they are far from comparing the refactoring capabilities that you would see in a specially created IDE (I use them and prefer coc and ALE). See other answers to this question for more information!
dsummersl Jan 09 2018-12-01T00: 00Z
source share