Vim: List All Matching Lines

1. vimgrep (Error List)

1:vimgrep pattern %

To open the list of matches in a buffer:

1:copen

On the list, navigate normally, and use <Enter> to select a match.

2. lvim (Location List)

1:lvim pattern %

To open the list

1:lopen

Navigation is similar with vimgrep.

3. Global Search1

1:g/regular-expression/p

Note that it doesn’t store the results in a buffer and shows them only once.


  1. BTW, the well-known grep command got its name from the following command sequence! ↩︎


Create a Minimalist `Chroot` Environment
Check What Libraries an ELF Depends On