全部博文(252)
分类: LINUX
2011-07-26 22:31:39
We can do grep and make in vim, the advantage of doing that in vim compare to terminal is you can use the result to track the error and warning for make or goto the line and files of the grep results.
How to make in vim?
:makeIn order to make, the current directory must contain a makefile.
How to grep in vim?
:grep -InR "keyword" *.ccThe same way you execute grep in terminal. I use -I to ignore binary files, -n to show the line and -R to recursively search for keywords from the current directory.
To track the result, you can open a result panel by typing
:copenand close the panel by
:ccloseHit Control ww to switch between the panel and the main viewport. In the panel, you can browse the results line by hitting UP or DOWN arrow key and press ENTER to select. At the moment you hit ENTER, vim will travels you to the targeted files and line.