Questions tagged [vimgrep]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2
votes
1answer
34 views

Call vimgrep from terminal

I find myself wanting to use vimgrep without having an open vim session. Then, I usually open a blank vim session (by calling vim from the terminal) and then, for instance, :vim /pattern/ *.tex. I ...
0
votes
1answer
42 views

vimgrep: Search from 'tags' file location

Is there a simple way to setup a binding that will :vimgrep up until a tags file is found? I'm curious because I can do set tags=tags;/ to do a similar search to define tags, but am not quite sure ...
4
votes
2answers
202 views

How to load files as a quickfix window at start-up

I have a command-line tool that can print search results in a format that works with vimgrep. The example output looks like this: foo/path/lib/usdviewq/appController.py:3795:22: index = prim....
1
vote
1answer
26 views

Is it possible to do consecutive vimgrep searches to refine and filter results?

If I do a grep search within vim, I'll get a list of results that I can browse using :lopen. Is there a way to do a subsequent search on only these resulting files? Basically I want to do refined ...
1
vote
2answers
75 views

Exclude files from vimgrep by using bash file name expansion?

Say I have files File1.m, File2.m, and File3.m in the current directory. I want vimgrep to search all but File3.m. After reading the help on using backticks to specify files for vimgrep, I tried: :...
1
vote
0answers
53 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
223 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
385 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
81 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
221 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
521 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
205 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
297 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
105 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
331 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
433 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
100 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
496 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
719 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 ...