[lug] 2 more vim questions

Daniel Webb lists at danielwebb.us
Thu Mar 1 00:27:44 MST 2007

On Wed, Feb 28, 2007 at 04:11:00PM -0800, karl horlen wrote:

> 1) In vi/vim, there is a way to reveal/show/print only
> the lines that match a certain pattern. 
> (alternatively hide all the lines that don't match a
> pattern).
> I used to use this a couple of years ago and i can't
> figure out how to do it any more.  anybody know how?

:help :v
> 2) vim does automatic syntax highlighting on my .php
> files which is great.  however, i have some php files
> withOUT .php extensions that i'd like the php syntax
> highlighting applied to.  how do you add a file
> extensiion for php syntax highlighting.

Add a comment to the end of the file like:

// vim:ft=php:

The hardest thing about Vim for me is remembering where in the docs to find
things like that.

More information about the LUG mailing list