Chapter
Obtaining and using the Vim plain text editor.
Installing Vim
Vim is probably already on your machine (Linux and Mac OS X). Proceed to using Vim, if it doesn't seem to be there see about getting Vim.
Using Vim
See also:
http://larc.ee.nthu.edu.tw/~cthuang/vim/files/vim-intro.html
http://vim.wikia.com/wiki/Vim_Tips_Wiki
http://data.agaric.com/raw/indent-lines-vim
Check for trailing whitespace
In normal (command) mode, type :
and then:/\s\+$
Enable Syntax Checking
With two lines in your .vimrc file (vi ~/.vimrc
to edit or create it) you can enable
set makeprg=php\ -l\ %
set errorformat=%m\ in\ %f\ on\ line\ %l
In normal (command) mode, type :make%
and press enter to run the PHP syntax check. If there are any errors, it will list them for you and take you to the first one when you press enter again.