MatlabFilesEdition


Ⅰ. 插件描述

A set of files useful to edit Matlab files (indent, syntax,tags , mlint use...)

Ⅱ. 基本信息

创建日期:  2008-10-17
使用用户:  51
Github星:  15
插件作者:  Fabrice Guy

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

Contains a set of files useful to edit Matlab files.

Included is :
1) Syntax highlighting
2) Correct setting to use the matchit.vim script (extension of the % command to match if/end, for/end,... blocks)
3) Correct indentation
4) Integration of mlint (Matlab code checker) with the :make command
5)Tag support
6) Help file

1) Syntax highlighting

syntax/matlab.vim : Updates the matlab.vim syntax file provided in the vim distribution :

  • highlights keywords dealing with exceptions : try / catch / rethrow
  • highlights keywords dealing with class definitions : classdef / properties / methods / events
  • highlights most Matlab functions

2) Correct settings in order to use the matchit.vim script

The matchit.vim extends the % matching and enables to jump through matching groups such as "if/end" or "swicth/end" blocks (see :help matchit in vim)

ftplugin/matlab.m provides the suitable definition for b:match_words in order to jump between if/end, classdef/end, methods/end, events/end, properties/end, while/end, for/end, switch/end, try/end, function/end blocks

3) Correct indentation
indent/matlab.vim : Updates the matlab.vim indention file provided in the vim distribution.
This script provides a correct indentation for :

  • switch / end, try / catch blocks
  • classdef / methods / properties / events
  • mutli-line (lines with line continuation operator (...))

This script has been tested with the Matlab R2008a release on many files and the result of indentation compared to the one provided by the Matlab Editor (with 'indent all functions' option set)

NOTE : to work correctly, this script need the matchit.vim (vimscript#39) to be installed.

4) Integration of mlint (Matlab code checker) with the :make command

compiler/mlint.m provides the settings to use mlint (Matlab code ckecker) and puts the messages reported in the quickfix buffer.

Whenever you want to check your code, just type :make and then :copen and vim opens a quickfix buffer which enables to jump to errors (using :cn, :cp or Enter to jump to the error under the cursor : see :help quickfix in vim)

5)Tag support
The .ctags file (in the matlab.tar.gz) defines the Matlab language so that the exuberant ctags (http://ctags.sourceforge.net ) can construct the tag file : you can now jump to tags (using CTRL-] (or CTRL-$ if using Windows) and go back again (CTRL-T)
See also :help tags in vim.

These scipts have been tested using gvim 7.2 and Matlab R2008a on Windows.

添加新评论