美文网首页
Vim command tips

Vim command tips

作者: Yves_lau | 来源:发表于2016-05-25 12:05 被阅读23次

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

相关文章

网友评论

      本文标题:Vim command tips

      本文链接:https://www.haomeiwen.com/subject/lqktdttx.html