:make makes it easy to build and fix errors, and
:vimgrep behaves like
:make. But why do you need these two commands? Why not just search for the pattern and just press
n? What are the advantages of them over just searching?
As the doc say:
Vim has two ways to find matches for a pattern: Internal and external.
In a nutshell,
:vimgrep uses Vim's grep mechanism to read and find in files.
:grep uses an external commands to achieve the same job.
/ search is for the current buffer only, whereas
:[vim]grep search through a pattern of files, allowing you to search in an entire project at once.
Have a look at
:h grep for more information.
/? only search the current buffer but
:vimgrep take arbitrary files/patterns/globs as arguments.
One benefit of
/? is that the results get put into the quickfix list (or location list if you use
:l[vim]grep), this means that you can pull up a list of all matches using
:cl. You can then use a number to go directly to the result you want from the list.
It also means that you can use the same command for searching the current buffer
:[vim]grep pattern % as for searching your entire code base
:[vim]grep pattern path so there's some nice symmetry to it.
There are 3 primary advantages I see
Use a consistent
:grep/vimgrepallows you to define a
grepprg, which can be defined to
grep/ack/agetc. Using this you can search the current buffer or multiple buffers/files, using a consistent
regexengine. On the other hand, if you use vim’s
/patternoption, you are stuck on vim’s default regex engine, which has a different syntax compared to
extended regular expressionsyntax. So, anytime you have to search for an expression, you will have to think/remember whether you should use
)and other differences. This can be very annoying (https://stackoverflow.com/questions/3864467/whats-the-difference-between-vim-regex-and-normal-regex)
vimgrep populates a quickfix/location list: using
:grep/vimgrepallows you to populate a search list. (https://medium.com/@lakshmankumar12/quickfix-and-location-list-in-vim-ca0292ac894d).
If you do want to use the location list, you can use
]qshortcut to navigate it if you have Tim-Popes unimpaired plugin (https://github.com/tpope/vim-unimpaired)
complicated searches while within vim: typically if you have to do complicated searches you may have to use the command line. However, if you define the
greprgproperly and use a command such as 
find . -type f
You can do very complicated searches and display the search results in your