Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [vimgrep]

The tag has no usage guidance.

1
vote
0answers
41 views

Changing how the quickfix list displays matches

I have the habit of leaving comments in my C source files like // @TODO or // @CHECK to quickly be able to get back to where I may have things to do. I can already match those in pretty much any ...
1
vote
1answer
48 views

Exclude folder when searching files in working directory

I'm working in a react project and opened vim from the root folder. When I'm using :vimgrep /pattern/ ** I just can search everywhere, but I want to search everywhere except the 'node_modules' ...
0
votes
1answer
213 views

How to use vimgrep recursively for specific file extensions?

I'd like to search the current directory recursively for the word under cursor. Here is what I have now in my .vimrc (Note I'm on Windows): nmap <leader>f :vimgrep! <cword> **.* <bar&...
1
vote
1answer
51 views

Refresh `vimgrep` list?

I use vimgrep with :cnew and :cold a lot. I could be looking at a vimgrep list from several vimgrep commands ago. Is there a way to refresh the vimgrep list without typing in the corresponding ...
1
vote
1answer
148 views

:lvimgrep with one match per file

Is there a way to use :lvimgrep and to limit the results to one match per file, so that each file with a match only appears once in the location list?
0
votes
1answer
303 views

my ag shortcut chokes on spaces

I got this in my .vimrc: set grepprg=grep\ -nriI\ --exclude=tags\ --exclude-dir=vendor " The Silver Searcher if executable('ag') " Use ag over grep let &grepprg = "ag --nogroup --nocolor --...
0
votes
1answer
158 views

Is it possible to use vimgrep with file paths from a file?

I have a quite large directory that I frequently need to search through for specific lines. Currently I simply use the built in grep: :vim "search" **/*.cpp | cw The problem is that going through ...
2
votes
0answers
246 views

Understand starstar-wildcard

I read :h starstar-wildcard, but I cannot understand some cases. (In the following examples, I am using the command :vimgrep pattern file where "pattern" is contained in the concerned files.) 1- If ...
0
votes
1answer
90 views

How can I prevent vim from changing the % register when entering non-modifiable windows?

My workflow revolves around having NerdTree opened with a quickfix at the the bottom and one file opened in a buffer. I often grep within my file only by using the % shortcut in my grep command. I ...
1
vote
1answer
256 views

join string and <cword> for vimgrep in command

I want to have a function that vimgrep for the word under the cursor appended to a predefined string. I have defined this command: command! -nargs=0 GJL vimgrep <cword> *.tex | copen which ...
3
votes
1answer
393 views

How to always append parameters for a Ggrep command?

I'm using the Fugitive plugin. It has the :Ggrep command which is very useful for searching the repo. One annoying thing is that I have huge .map files and I want to omit them from my search. I ...
12
votes
1answer
2k views

How to interactively search/grep with VIM?

Is there any way to configure VIM to interactively search inside every file for an entire project? By interactive, I mean updating each keystroke. Something like Emacs counsel-git-grep, see: example ...
0
votes
1answer
77 views

vimscript parse yaml header and output to mapping

My goal is to make a mapping, that depending on the value of type in the yaml header, will run a command sourcing a file named the same as the value of type. I have file containing a yaml header ...
0
votes
2answers
415 views

Multi file search for selected text

Using atom I can CtrlShiftf while a word is selected in order to start a multi file search for a matching string. I would like to emulate this flow as much as possible with Vim. I know I can yank ...
4
votes
1answer
679 views

Calling vimgrep so that results from the current file are on top?

I would like to search for some pattern with :vimgrep in the current directory: :vimgrep /pattern/ * However this returns the results by filenames ordered alphabetically. If I run :vimgrepadd the ...