Questions tagged [vimgrep]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
3
votes
1answer
103 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 ...
0
votes
1answer
27 views

Given a set of patterns, list (in the quickfix window) the ocurrences in those files that contain all the patterns from a given directory

The context Given a {pattern}, I can list the ocurrences of {pattern} in all files from a {directory}, in the quickfix window with the following command :chdir {directory} :vimgrep /{pattern}/ **/* :...
1
vote
2answers
69 views

Put in quickfix list the files whose content does not match a pattern inside it

I would like to put in the quickfix the files not matching a pattern. That it, these files don't have any line matching the search pattern. I know that for finding files whose content match a pattern ...
1
vote
2answers
50 views

How to get the number of the output of `vimgrep`

I wrote a vim-script function, which allows me to grep a keyword in my project. function! CustomGrep(...) if a:0 == 0 silent vimgrep <cword> **/*.h **/*.hpp **/*.c **/*.cpp else ...
1
vote
2answers
89 views

vimscript: No match error

I'm trying to write a vim-script function, which allows me to grep the word under cursor easily in my project. function! CustomGrep() vimgrep expand("<cword>") **/*.h **/*.hpp **/*.c **/*....
1
vote
1answer
33 views

Calling vimgrep from a comand

I'm trying to create a command that would accept arguments, and then call vimgrep with those arguments and display the quickfix window. I set up my command like command! -nargs=* Vsearch :call <...
3
votes
1answer
47 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
73 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
316 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
32 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
90 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
1answer
589 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
619 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
119 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
298 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
771 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 --...
1
vote
1answer
270 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
326 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
112 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
374 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 ...
13
votes
1answer
3k 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 ...
3
votes
1answer
443 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 ...
0
votes
1answer
133 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
612 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
796 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 ...