sponsor Vim development Vim logo Vim Book Ad

octave.vim : Syntax highlighting for GNU Octave

 script karma  Rating 126/76, Downloaded by 3102  Comments, bugs, improvements  Vim wiki

created by
Søren Hauberg
script type
Syntax highlighting for GNU Octave. It inherits the Matlab syntax highlighting and adds a few extra things like endif etc.
install details
Installation details from Paul Laub - thanks Paul!
Here's what to do to get octave.vim working.

1. Put octave vim in vim's syntax subdirectory.

2. Directory above this subdirectory is the main vim directory. Find
the file named filetype.vim. Change "matlab" to "octave". With that,
files with the *.m extension will be associated with octave.vim. Test
by opening an octave file in vim. Keywords like endfunction should be

3. (Optionally) modify the file synmenu.vim to include an Octave item
in the syntax menu of the GUI version of vim. [I don't use menus so I
can't say more about how to do this.]

Also, since your script inherits formatting done by the matlab.vim
file, I'd advise people NOT  to delete matlab.vim and rename
octave.vim to matlab.vim.

An alternative is to copy octave.vim to ~/.vim/syntax and add the following to ~/.vimrc:
" Octave Syntax
augroup filetypedetect
     au! BufRead,BufNewFile *.m setfiletype octave
augroup END

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
octave.vim 1.0.1 2005-03-21 6.0 Søren Hauberg I forgot to add end_switch, so I've just added that one. The only thing I think is missing is multiline strings, but I don't know how to do that. (If you do please help me)
octave.vim 1.0 2005-03-17 6.0 Søren Hauberg 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.
Vim at Github