Vim command tips

vimgrep

How to search files in fatest way?

Recursive searchEdit

You can use ** in the file pattern to search recursively. For example, to search for all lines containing "dostuff()" in all .c files in the parent directory and all its subdirectories, use:

:vimgrep /dostuff()/j ../**/*.c

Disabling autocmds for fast searchesEdit

Using vimgrep to search hundreds of files can be slow. A search taking only a few seconds using an external grep program might take nearly a minute with vimgrep. One reason for this is that vimgrep uses Vim's procedures to read files, which can involve execution of several autocommands.
Just use noautocmd avoiding autocommands called, fatest way.

:noautocmd vimgrep /{pattern}/[flags] {file(s)}

referer: http://vim.wikia.com/wiki/Find_in_files_within_Vim

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • PLEASE READ THE FOLLOWING APPLE DEVELOPER PROGRAM LICENSE...
    念念不忘的阅读 13,552评论 5 6
  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 9,949评论 0 23
  • 这是我写的第31篇原创日记,你看或不看,我都在写,你写或不写,时间都在流逝,唯有文字记忆才是永恒的。 今天天气酷热...
    橞在祺中阅读 190评论 0 0
  • 原本,它应该歌唱 许久没有动弹 只是优雅的立在那里 变成了一种物象 呼吸之间,脸灰沉沉的 黑白键就像牙齿 欲咬碎面...
    琴歌素简阅读 279评论 0 2
  • (一) 触摸世间万物 不用心良苦难显诚意 感知人间冷暖 不用情专一难出效果 (二) 艳丽的花朵令人陶醉 却只能支撑...
    渔夫镕谷阅读 483评论 6 26