Gary Johnson wrote:
On 2007-04-18, Kamaraju S Kusumanchi <[EMAIL PROTECTED]> wrote:
In Debian Etch, vim 7.0.122, octave 2.9.9, by default the .m files are
syntax highlighted as if they are matlab files. For example, lines
beginning with # are not highlighted as comments, words like endfunction
etc., are not highlighted as keywords...
Is there any recommended editor for Octave which gets the syntax
highlighting correctly? More importantly, is there any way I can tell vim
that .m files are octave files and not matlab files?
I don't see any octave syntax files in the standard vim
distribution, but a search of vim.sf.net for scripts containing
"octave" reveals two contributed syntax files for octave:
http://vim.sourceforge.net/scripts/script.php?script_id=1241
http://vim.sourceforge.net/scripts/script.php?script_id=1591
Both of those scripts include instructions for adding the octave
filetype to your vim installation. If you need more information on
that, see
:help new-filetype
HTH,
Gary
Then (and assuming they create an "octave" filetype -- if the name is
different you will have to change the autocommand shown here at bottom) you
may want to make sure that it is detected for your .m files. Edit one of them,
then
:setlocal filetype?
If it is other than "octave", the following will detect these *.m files:
1. Make sure that you have a directory named $VIM/vimfiles (for system-wide
detection) or $HOME/.vim (for single-user detection on Linux). Create it if
necessary (by $VIM, I mean the value of $VIM as set by Vim, usually something
like /usr/share/vim or /usr/local/share/vim -- check it using ":echo $VIM"
without the quotes).
2. In that directory, create or update a file named "filetype.vim" as follows:
- it should start with
augroup filetypedetect
- it should end with
augroup END
- anywhere between these two lines, it should have
au BufRead,BufNewFile *.m setf octave
3. To activate the new autocommand, you may have to do
:filetype off
:filetype on
Best regards,
Tony.
--
If ignorance is bliss, why aren't there more happy people?