acloudtree

(Nerd) Ubuntu + Vim + ZendFramework-1.9.2 + .pthml syntax highlighting

1) From the command line ‘cd’ to your ‘home’ directory


test-box@jbuntu:~$ cd

2a) Check to see if the .vimrc file exists


test-box@jbuntu:~$ ls .vimrc

If the terminal outputs nothing, then that means the file does not exist.

2b) If you get the following


test-box@jbuntu:~$ ls .vimrc
.vimrc

It means that the file does exist and we just need to edit it.

3) If the file does not exist just ‘touch’ the file. If it DOES exist, just skip this step.


test-box@jbuntu:~$ touch .vimrc

4) From this point, ‘vi’ the ‘.vimrc’ file. You primarily need the following lines and you are more than welcome to copy/paste. Write/Quite when finished.


if has("autocmd")
autocmd BufEnter *.phtml set syn=php
endif
syn on

Now the next time you open VI it should have the desired highlighting for .phtml files found in the Zend Framework.

Below is my ‘.vimrc’ file in it’s entirety. Just for the record. It also allows for syntax highlighting to occur in CakePHP .ctp files along with some other settings that I prefer.


set tabstop=2
set shiftwidth=2
set expandtab
if has("autocmd")
autocmd BufEnter *.ctp set syn=php
autocmd BufEnter *.phtml set syn=php
endif
syn on
set ai

Post a comment

Copyright © Jared Folkins
Programming, Computers, Writing, Economics, and Life

Powered by WordPress