I use vimgrep (or grep) to search in files inside vim, but I see it’s quite inconvenient to have to write that every time I want to make search in vim. Any idea on how to make a suitable short-cut key to search in files?
Regards,
Rafid
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The following will take you to the command-line, pre-populated with
vimgrepif you press F3 innormal mode:If you always wish to search the current directory, try:
If you want to save even more keypresses, try this to search the current directory for the word under the cursor:
Of course, these can be put into your
.vimrcfile.Vim’s inbuilt help system provides lots of useful information on this subject. See the following sections to explain what I have done:
:help :nmap:help c_CTRL-R_CTRL-W