On Sun, Apr 15, 2012 at 01:18:27PM -0300, Júlio Hoffimann wrote:
> Dear all,
>
> I've being contacting VIM developers to add Rik's octave.vim syntax to the
> official VIM distribution. The problem we face is that (as we all know) GNU
> Octave scripts tries to be as compatible as possible with MATLAB scripts,
> making the automatic filetype detection impossible.
>
> In VIM, files are generally identified by extensions (*.m) and comment
> symbols (%), but both interpreters share the same patterns. Although Octave
> supports # and the shebang mechanism, it's not good practice use them if we
> are looking for portability.
>
> I heard Perl and Prolog suffered from the same issue in the past because
> their file extension, the solution VIM developers had at that time was to
> add an additional variable to set the preference of the user on .vimrc. The
> problem with that approach is that some users programmed in both languages
> and have to set the configurations over and over again is not desired.
> Having said that, Bram (The Man - Creator of VIM) purposed define an
> identification string for Octave scripts such that in the end the following
> pseudo-code would apply when opening *.m files:
>
> if (filename matches *.m)
> if (comment_symbol == '#' || script_last_line == '% OctScript')
> filetype=octave
> else
> filetype=matlab
>
> 1. What do you think?
I'm a die-hard Vim user and I love it when everything works magically in