perform grep and make in vim

June 15th, 2007 mysurface Posted in grep, make, Text Manipulation, vi, vim | Hits: 73660 | 3 Comments »

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?

:make

In order to make, the current directory must contain a makefile.

How to grep in vim?

:grep -InR "keyword" *.cc

The 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

:copen

and close the panel by

:cclose

Hit 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.

[中文翻译]

3 Responses to “perform grep and make in vim”

  1. [...] perform grep and make in vim 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 trac… [...]

  2. SEOPledge, the internet marketing wing of Canrock Ventures, is looking for web businesses interested in increasing their organic traffic. We specialize in traffic generation with the use of SEO, SEM, and social media. Get in touch with us at our contact page on our website.

  3. Have you ever considered about adding a little bit more than just your articles?
    I mean, what you say is fundamental and everything.
    But think about if you added some great visuals or video clips to give your posts
    more, “pop”! Your content is excellent but with images and video clips, this
    site could undeniably be one of the greatest in its niche.

    Amazing blog!

Leave a Reply