Questions tagged [grep]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
45 views

How can I use Regex in helpgrep?

I would like to use Regex in helpgrep. For example, searching for lines or sections that contain two words. Something like :helpg 'word1' & 'word4' to find this line as my result: word1 word2 ...
mohamadi_arch's user avatar
-1 votes
1 answer
74 views

Is there a grep-like command that can understand vim regex syntax?

ack, ag, grep, pgrep, ripgrep, ugrep are binary filter commands that understand various regex syntax flavors. Is there a binary filter command that can also understand vim regex syntax flavor? I'm so ...
stepse's user avatar
  • 201
0 votes
1 answer
284 views

How to grep only the contents of the current file?

I have this alias to grep under the cursor (for the entire project): " bind K to grep word under cursor nnoremap K :grep! "\b<C-R><C-W>\b"<CR>:cw<CR><ENTER>...
abbood's user avatar
  • 673
1 vote
1 answer
167 views

How to use alternation operator in ripgrep + vim?

I have the following in my .vimrc which (I believe) makes :grep within Vim use rg: if executable('rg') set grepprg=rg\ --no-heading\ --vimgrep\ --hidden\ --case-sensitive\ --ignore-vcs\ --glob\ '!....
Aaron Parisi's user avatar
1 vote
0 answers
32 views

What vim plugin is hijacking my session to give me grep information I don't want?

I'm not sure how better to phrase this question. I have not recently installed anything new—in fact I'm a bit overdue to upgrade my three-year-old Linux Mint install—but in the last couple months I ...
blahedo's user avatar
  • 111
1 vote
1 answer
723 views

How can use :grep with range in neovim with ripgrep as external grep program?

I am using ripgrep as external grep program in neovim. Which works when I call :grep 'pattern' in neovim Command Mode. I frequently have to search some strings within a blocked range in long json ...
avimehenwal's user avatar
1 vote
1 answer
112 views

Accept hyphen when using `<C-R><C-W>`

I currently have this mapping: " bind K to grep word under cursor nnoremap K :grep! "\b<C-R><C-W>\b"<CR>:cw<CR><ENTER> My ag setting in vimrc: if ...
abbood's user avatar
  • 673
1 vote
1 answer
154 views

grep in my specific dictionary

I often need to make a case-insensitive search of the current word (under cursor) in a dictionary file which has a simple txt format, one entry per line. One possible solution is to record a macro in ...
user27145's user avatar
-1 votes
1 answer
179 views

Neovim - vim-grepper shows no result

I use Vim daily and use vim-grepper (https://github.com/mhinz/vim-grepper) as my grep plugin. But since last week, it doesn't work anymore and every request I do result in... nothing found. I tried to ...
Charles Duporge's user avatar
0 votes
2 answers
379 views

Find the specific line with character in specific position

Finding the line with a specific character before the last character. Suppose, I have the following string 1. addar_ctrl1,1,2,0,0,1 2. addar_ctrl2,3,2,0,1,0 3. addar_ctrl3,4,8,0,0,0 4. addar_ctrl4,2,6,...
KittoMi's user avatar
  • 109
1 vote
1 answer
146 views

How to use read instead of execute in a function?

I'm trying to search for the selected line of a file using the following: function! GrepSelection() normal! gvy let result = escape(@", '\\/.*$^~[]#') let result = substitute(result, &...
Nordine Lotfi's user avatar
0 votes
1 answer
294 views

How to open a command in a split window?

I'm using grep in vim to do something such as: :grep pattern file and have a key-map for it that looks like that: function! Escaped() call inputsave() let result = escape(@", '\\/.*$^~[]#...
Nordine Lotfi's user avatar
0 votes
2 answers
303 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}/ **/* :...
gfe's user avatar
  • 245
0 votes
3 answers
1k views

Highlight results of :grep while in quickfix window

To my .vimrc I added a hook which automates entering the quickfix after :grep processing: autocmd QuickFixCmdPost [^l]* nested cwindow 20 Another thing I care about but can't achieve is automation ...
bloody's user avatar
  • 140
1 vote
2 answers
211 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 ...
Yves's user avatar
  • 983
0 votes
0 answers
113 views

How to reload vim buffer

I built a cpp environment with YCM, EasyGrep and some other plugins. With YCM, I can jump to declaration/definition, with EasyGrep, I can grep a keyword easily. But I found something weird: Saying ...
Yves's user avatar
  • 983
2 votes
1 answer
163 views

What is the green <92> that's in my file?

I have a file exported from some system, and in vi when I open the file, there's a green <92> in it when I open it up where an ' ought to be. It messed up my bash script and left a line that ...
leeand00's user avatar
  • 3,457
4 votes
3 answers
2k views

Prevent "Press ENTER or type command to continue" prompt after external command executes

I am using :grep to search for occurences of a string within a set of files: :grep rainbow *.txt This result is then shown in the terminal: doc1.txt:2:saw a rainbow today doc2.txt:17:it was not a ...
Flux's user avatar
  • 1,021
1 vote
1 answer
114 views

Echoing a message when grep has no result

Is there a way echoing a message if grep has no result and getqflist() is empty? I've tried this, but it doesn't work: au QuickFixCmdPost grep call g:GrepPostActions() function! g:GrepPostActions()...
Mattia72's user avatar
  • 191