sponsor Vim development Vim logo Vim Book Ad

smarty.vim : smarty syntax file

 script karma  Rating 37/28, Downloaded by 3200  Comments, bugs, improvements  Vim wiki

created by
Ken Earl
script type
A friend and I found that there were no acceptable vim syntax files for smarty, so we took the only one we could find and added everything from the smarty documentation (http://smarty.php.net/manual/en) to it.  If nothing else, this is a very good start on a complete smarty syntax file.  We have even used vimtip #498 to use autocomplete with this syntax and so far it seems to work well.
install details
just drop it in your ~/.vim/syntax directory, then put this somewhere in your vimrc file:

au BufRead,BufNewFile *.tpl set filetype=smarty

additionally, if you would like dictionary completion, feel free to add something like this:

au Filetype smarty exec('set dictionary=/home/user/.vim/syntax/smarty.vim')
au Filetype smarty set complete+=k

This will allow <Control-x><Control-k> for dictionary autocomplete.
We have a mapping that makes it a bit easier:

imap <S-Space><S-Space> <C-X><C-K>

You could use imap <C-Space> <C-X><C-K>, but we have that mapped for normal omni (auto) completion.

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
smarty.vim 2 2007-02-13 7.0 Ken Earl a few small fixes.  Added support for single quotes.
smarty.vim 1 2007-02-09 7.0 Ken Earl Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.