tags:

views:

155

answers:

2

Basically I need to create a quickfix buffer listing all lines that match a regex. What is the best way?

The global command may not be the best, but I think it should be usable. The output of the global command is perfect, but I need it to hyperlink the matching lines.

+6  A: 

Use caddexpr:-

g/<pattern>/caddexpr expand("%") . ":" . line(".") . ":" . getline(".")
Gavin Gilmour
Cool ... and then a call to :cwindow, of course.
Dave Ray
+3  A: 

You can also not use the global command and stick with what is built-in. Use the vimgrep command as below:

:vimgrep /pattern/ %

And then :copen or :cwindow

Ayman