You can use ctrl+shift+f in a general editor to conveniently search all files under a certain directory (or project). How to achieve this in vim?
走同样的路,发现不同的人生
The simplest: :vimgrep /{pattern}/ /yourpath Traverse the search results using: :cprev[ious] Previous file :cprev[ious] 前一个文件:cnext 下一个文件:cfirst 第一个文件:clast:cnext Next file
:vimgrep /{pattern}/ /yourpath
:cprev[ious]
:cnext
:cfirst
:clast
Make it simple, install the plug-in. What you want is to search based on the file name. We recommend CtrlP, Command-T, FuzzFinder, Unite, etc. Start with CtrlP or CommandT. After you are familiar with it, you can try the more powerful Unite. .
Find in files within Vim
For example, if I want to search for layout in the current directory, I only need:
:lvim /\<\(house\|home\)\>/gj *
Then use the following command to display the query results:
:lw
Screenshots are as follows:
You can also read this article: Search multiple files with :vimgrep
Recommend exVim Searching for symbols is very convenient For non-symbolic text (such as Chinese), use vimgrep
:set grepprg=ag
The simplest:
:vimgrep /{pattern}/ /yourpath
Traverse the search results using:
:cprev[ious]
Previous file:cprev[ious]
前一个文件:cnext
下一个文件:cfirst
第一个文件:clast
:cnext
Next file:cfirst
First file 🎜:clast
The last file🎜Make it simple, install the plug-in. What you want is to search based on the file name. We recommend CtrlP, Command-T, FuzzFinder, Unite, etc. Start with CtrlP or CommandT. After you are familiar with it, you can try the more powerful Unite. .
Find in files within Vim
For example, if I want to search for layout in the current directory, I only need:
Then use the following command to display the query results:
Screenshots are as follows:
You can also read this article: Search multiple files with :vimgrep
Recommend exVim
as mentioned aboveSearching for symbols is very convenient
For non-symbolic text (such as Chinese), use vimgrep
:set grepprg=ag