Vim Tips Wiki
Advertisement

Previous TipNext Tip

Tip: #483 - Search using quickfix to list occurrences

Created: June 7, 2003 9:08 Complexity: intermediate Author: Feral <Sreny--AT--SverGbc.Pbz> (Rot13ed) Version: 6.0 Karma: 8/8 Imported from: Tip#483

This is inspired by VIMTIP#391: Simple programmers TODO list using grep and quickfix

taglist.vim is VIMSCRIPT#273


This is a little tip on shortcuts to make :grep just a little bit more handy.


GREP is simply a front end to :grep which uses the current word under the cursor and the current file.

Use this for the times when you want a �list occurrences� type search. (See also :h :ilist another method)


" [Feral:158/03@07:02] Easily GREP current word in current file.

command GREP :execute 'grep '.expand('<cword>').' '.expand('%')

Comments

by the by, another way to �list occurrences� (at least for the current file) would be a :g//:p (see :h :g and :h :p) and have the text you want to list as your current search pattern.

Just as an aside, :cnext can be abbreviated to :cn and :cprev can be abbreviated to :cp, of course.


Sreny--AT--SverGbc.Pbz (Rot13ed) , July 2, 2003 3:11


Advertisement