On Sun, 15 Apr 2012, Marcin Szamotulski wrote:
On 15:18 Sun 15 Apr , Gary Johnson wrote:
On 2012-04-15, Bram Moolenaar wrote:
Júlio wrote:
Providing an identification string is a great idea, i'll contact
the Octave community and see their reactions and proposals for the
string, do you have any identifier in mind?
Personally, I think Octave vs. Matlab should be handled the same way
LaTeX vs ConTeXt is handled (LaTeX and ConTeXt are both TeX macro
packages). Since LaTeX is more popular, it's the default, but you can
tell Vim to use ConTeXt conventions by setting b:tex_flavor='context'.
Similarly, Octave and Matlab are essentially two dialects of Matlab.
If the external octave.vim script handles things much better than
matlab.vim, the changes that also apply to Matlab should probably be
ported to matlab.vim. Then the pieces that apply only to Octave could
be included if b:matlab_flavor='octave' is set (e.g. extra keywords,
extra comment formats).
if (filename matches *.m)
if (comment_symbol == '#' || script_last_line == '% octave')
filetype=octave
else
filetype=matlab
Please don't top-post.
If you put something in a comment, you could use -*-octave-*-, so
that it also works with Emacs.
Or, if you're having to put a special string in the file just for
Vim, why not make it "vim: ft=octave"?
Using one that would also work for Emacs means that it'll be handled
differently than modelines (see, e.g. the way filetype.vim's s:FTpl()
function heuristically guesses Perl vs Prolog). That avoids the problem
Marcin brings up.
Let me just note that this will not work unless vim is compiled with
modelines. For example on Gentoo/Linux modelines are disabled by
security reasons.
Mostly an aside: In Gentoo, they're not compiled out. They're disabled
by default (cf. /etc/vim/vimrc ), but adding "set modeline" to ~/.vimrc
enables them.
--
Best,
Ben
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php