Friday, August 18, 2006

[Vim] grep in vim

Often times you would want to search for all occurrences of a particular word or pattern in a file. Using ‘*’ would be too tedious. So Here comes grep. Basically you use it this way

:grep <pattern> <file you want to grep>

Now after you do that, vim will show you all the lines matching. By typing :cope the vim window will be split. The bottom window would show all the matching lines, hyperlinked to the document you grepped.

No comments: