Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1091032
  • 博文数量: 252
  • 博客积分: 4561
  • 博客等级: 上校
  • 技术积分: 2833
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-15 08:23
文章分类

全部博文(252)

文章存档

2015年(2)

2014年(1)

2013年(1)

2012年(16)

2011年(42)

2010年(67)

2009年(87)

2008年(36)

分类: 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?

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

阅读(623) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~