Monday, May 12, 2008

Vim tips for SWIG

I've ever annoyed with the mixed tab and spaces in SWIG's code. Just talked it with William Fulton in #swig-gsoc. He suggested some tips.

This is a way to specific coding style by project:

au BufRead */[SWIG|swig]*/* set tabstop=8 | set shiftwidth=2 | set softtabstop=2 | set expandtab " SWIG

And a Syntax file for SWIG, add this in ~/.vimrc or ~/.vim/filetype.vim to use it:

" SWIG filetype file
if exists("did_load_filetypes")
finish
endif
augroup filetypedetect
au! BufRead,BufNewFile *.swg setfiletype swig
au! BufRead,BufNewFile *.i setfiletype swig
augroup END

Finally, a big thanks to William! :)

No comments: