Skip to content

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

Notifications You must be signed in to change notification settings

andymass/vim-matlab

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a mirror of http://www.vim.org/scripts/script.php?script_id=2407

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.




About

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

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Vim Script 100.0%