********************************************
Editing Matlab files in Vim
edited by Kun He, Feb 22 2013
originally by Yaroslav Don, from http://www.mathworks.com/matlabcentral/fileexchange/28240
********************************************
Changes from YD's version:
- Fixed indenting for parfor and functions without "end"
- Fixed the "^M" problem caused by DOS filetype in ftplugin/matlab.vim
- Switched %% comments to type "SpecialComments" from "Title"
********************************************
1) put the following into your .vimrc:
" matlab vim
" integration of mlint code checker with :make command
autocmd BufEnter *.m compiler mlint
" use F5 to run .m file
au FileType matlab map :w:!matlab -nodesktop -nosplash -r "try, run(which('%')), pause, end, quit" \\|
" .m file folding
au FileType matlab set foldmethod=syntax foldcolumn=2 foldlevel=33
2) untar this file in your ~/.vim/: http://cs-people.bu.edu/hekun/misc/matlabvim_kun.tar.gz
which you probably already did.
3) make sure mlint is in your $PATH by linking to /bin//mlint
4) enjoy .m syntax highlighting by trying :colors (I put some in /colors/)
and mlint checker by trying :make