Turn on syntax highlighting for editing .thtml files in Vim

By Don Voita (dvoita)
If you use Vim to edit your Views, here's how to turn on syntax highlighting.
If you use VIm as your text editor like I do, you probably find the syntax highlighting helpful. Unfortunately, files ending in *.thtml aren't recognized by Vim. Here's how to fix that:

(Examples are for Unix)

1. Create a user runtime directory:
Download code
mkdir ~/.vim


2. Create the following file:
Download code
vi ~/.vim/filetype.vim


It should contain:
Download code
" my filetype file
    if exists("did_load_filetypes")
      finish
    endif
    augroup filetypedetect
      au! BufRead,BufNewFile *.thtml     setfiletype html
    augroup END


3. Restart Vim, if need be.

This should make editing your Views with Vim a little easier.

Sources:

http://www.vim.org/htmldoc/filetype.html


 

Comments 158

CakePHP Team Comments Author Comments
 

Comment

1 Easier than that

Just put this line in your ~/.vimrc file:

au BufNewFile,BufRead *.thtml setfiletype php

(I prefer php synax rather than just html)
Posted Nov 17, 2006 by Carlos Zuniga
 

Comment

2 Syntax Highlighting for Dreamweaver

I found this on the internet:

Open
c:\Program Files\Macromedia\Dreamweaver MX\Configuration\DocumentTypes\MMDocumentTypes.xml

Look for winfileextension="php,php3" ܡםr^t񍽑屔􉍽而)ѕͥ̈(𽍽 if you're on a mac and simply add "thtml" (or "ctp" for 1.2) to the list so you have:

winfileextension="php,php3,thtml" or
macfileextension="php,php3,thtml"

Save it, and restart Dreamweaver and you should be good to go.

Hope this helps someone.

Source:
http://www.phpbuilder.com/board/archive/index.php/t-10224922.html
Posted Dec 31, 2006 by Jeff Morris
 

Comment

3 Clarification

Look for winfileextension="php,php3" or macfileextension="php,php3" if you're on a mac and simply add inc to the list so you have:

winfileextension="php,php3,inc"

I'm sure you meant "thtml" (or "ctp" for 1.2) instead of "inc" :D
Posted Apr 23, 2007 by Tengku Zahasman