octave.vim--


Ⅰ. 插件描述

Syntax highlighting file for GNU Octave (v3.4.0) language

Ⅱ. 基本信息

创建日期:  2011-05-24
使用用户:  3
Github星:  1
插件作者:  Michael Pogoda

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'mpogoda/octave-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'mpogoda/octave-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'mpogoda/octave-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/mpogoda/octave.vim--

Ⅳ. 文档说明

This is a mirror of http://www.vim.org/scripts/script.php?script_id=3600
This file provides syntax highlighting for the GNU Octave programming language.

Features

* Highlights entire Octave grammar (endwhile, endfor, etc.), not just Matlab keywords
* Updated to highlight all core Octave functions as of version 3.8.0
* Highlights user functions and anonymous functions [@(...)] from within the .m file being edited
* Use-dependent highlighting of Octave system variables
   When querying system variables, keyword is highlighted as a constant.  For example, var = true, highlights 'true'
   as a constant.
  When setting variables or otherwise invoking keyword as a function, keyword is highlighted as a function.  For
  example, var = true (2,4), highlights 'true' as a function.
* Support for multi-line strings with line continuation characters as well as escaped quotes (\" or \') within string.
* Support for new multi-line block comments
* Error highlighting for bad number syntax, bad structure variable names, bad block comments, bad line continuations.
* Optional support for highlighting operators (+, -, *, etc.), user variables, or tabs

Errata

* Occasionally anonymous functions are highlighted as a function even though the instance is of the name as a
* variable.  This is too difficult to correct without writing a full parser.

OMNIFUNC

* The syntax file has a list of every valid function in Octave which makes it useful as an auto-completion
* dictionary for use with ViM's omnifunc function.  Once installed, type a few letters of the name of a function
* and then use Ctrl-X Ctrl-O to bring up a list of possible matches.

Addenda

This script owes some debt to the two existing Octave syntax scripts:
http://www.vim.org/scripts/script.php?script_id=1241
http://www.vim.org/scripts/script.php?script_id=1591

However, it has been thoroughly rewritten and expanded considerably.

Install details:
Add the following lines to your ~/.vimrc to get ViM to use the file

----- SNIP -----
" Octave syntax
augroup filetypedetect
  au! BufRead,BufNewFile *.m,*.oct set filetype=octave
augroup END
----- SNIP -----

Optional highlighting of operators (+, -, *, etc.), user variables, or tabs can be had by uncommenting the
appropriately tagged lines in octave.vim.

OMNIFUNC install on a UNIX-like system

1) Install the syntax file as described above
2) Add the following lines to your ~/.vimrc after the snippet from step 3 above
----- SNIP -----
" Use keywords from Octave syntax language file for autocomplete
if has("autocmd") && exists("+omnifunc")
   autocmd Filetype octave
   \ if &omnifunc == "" |
   \ setlocal omnifunc=syntaxcomplete#Complete |
   \ endif
endif
----- SNIP -----

添加新评论