Open the command line window by:
Esc - to enssure you are in Normal mode
type q , type :
the command line should open ( it like a tmp file to write the command you can navigate as you would navigate normally in any vim file ...
type i to enter insert mode
this example will search for the to_srch string recursively bellow the current dir for all file types of type '*.js' and '*.java' but omit all file paths containing the string node_modules
:g/console.log/ | :vimgrep /console.log/ `find . -type f -name '*.js' -o -name '*.java' -not -path '*node_modules/*'`
Now wheen you :copen you could navigate with the arrow keys through the sarch results ...
you could also set those in .vimrc
" how-to search recursively under the current dir for the files of type js and java but omit the
" node_modules file paths
":g/console.log/ | :vimgrep /console.log/ `find . -type f -name '*.js' -o -name '*.java' -not -path '*node_modules/*'`
" reminder open the quick fix window by :copen 20
" reminder close the quick fix window by :ccl
you could omit the first :q/to_srch/ I use it to highlight the search results automatically since I have "set hlsearch" in my ~/.vimrc
Any hint how-to enable automatically the srch results from the vimgrep or in vimrc will be highly appreciated ...
No comments:
Post a Comment
- the first minus - Comments have to be moderated because of the spammers
- the second minus - I am very lazy at moderating comments ... hardly find time ...
- the third minus - Short links are no good for security ...
- The REAL PLUS : Any critic and positive feedback is better than none, so your comments will be published sooner or later !!!!