4.6

4.6 | 5 ratings Rate this file 128 downloads (last 30 days) File Size: 12.61 KB File ID: #21798

Editing Matlab files in Vim

by Fabrice

 

17 Oct 2008 (Updated 23 Nov 2009)

Code covered by BSD License  

Edit Matlab M-files in Vim editor (indentation, syntax highlighting, tags , mlint support)

Download Now | Watch this File

File Information
Description

Contains a set of files useful to edit Matlab files.

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

MATLAB release MATLAB 7.6 (R2008a)
Other requirements Vim 7.0
Zip File Content  
Other Files compiler/mlint.vim,
doc/matlab.txt,
ftplugin/matlab.vim,
indent/matlab.vim,
license.txt,
syntax/matlab.vim
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (10)
25 Nov 2008 James

Thanks for the updated syntax highlighting.

01 Mar 2009 Jørgen Skancke

Thanks for the useful files.

In emacs there is a matlab-mode that lets you evaluate selected text in matlab (like in the Matlab-editor, handy for playing with plots and the like). Since this is possible in emacs, it should be possible in vim too. Does anyone have ideas about how to implement this?

28 Mar 2009 Ritesh Sood

A handy shell snippet to copy the downloaded files under appropriate dirs in your .vim/
$ cd matlab # the dir you downloaded
$ tar -cf - | (cd ~/.vim; tar -xf -)
You tar the files to stdout, cd to ~/.vim and untar stdin; no intermediate file creation.

01 May 2009 Yakun Sun

This is splendid. It solves the problem of indenting .m codes that troubles me for a million years.

30 Aug 2009 Ken Lin

thank you for sharing

23 Sep 2009 Jader

How to install it on windows if I can't find any .vim folder?

24 Sep 2009 Fabrice

To install it on windows : unzip the package and extract it to your vimfiles folder (usually C:\Program Files\Vim\vimfiles).

For more information about the installation, there is a matlab.txt file provided in the package you could read.

21 Oct 2009 Krishna Sankar M

Thanks Fabrice. Very useful.
May I request some more features for matching: in addition to existing, support matching groups as if/else, else/end, case/<next>case.

15 Nov 2009 Yaroslav Don

Does anybody know what script should I add to the "indent/matlab.vim" file in order to get the following statement (or similar to it) indented correctly:

if (some_conditional), do_something; end;

Unfortunately it matches the "end" to the former statement that required "end" (such as "switch"). But I like to keep my code neat and small.

Any advice?

18 Nov 2009 Fabrice

I have done enhancements in the indent file to indent correctly one-line blocks. I'll provide the new version of the file as soon as possible.

Please login to add a comment or rating.
Updates
24 Oct 2008

- added a help file (matlab.txt)
- wrong indentation for subfunctions without matching 'end' has been fixed

28 Oct 2008

Enhanced syntax highligting for Matlab m-files : most Matlab builtin functions are now highlighted

23 Nov 2009

- Added support for indentation of if/end blocks on the same line
- Changed the function indentation behavior (now based on the 'indent all functions' option in the Matlab Editor)

Tag Activity for this File
Tag Applied By Date/Time
development environment Fabrice 22 Oct 2008 10:25:06
vim Fabrice 22 Oct 2008 10:25:06
gvim Fabrice 22 Oct 2008 10:25:06
syntax Fabrice 22 Oct 2008 10:25:06
highlighting Fabrice 22 Oct 2008 10:25:06
indentation Fabrice 22 Oct 2008 10:25:06
mlint Fabrice 22 Oct 2008 10:25:06
vim matlab Fabrice 24 Oct 2008 09:12:23
matlab vim Fabrice 24 Oct 2008 09:12:24
vim indentation Fabrice 24 Oct 2008 09:12:24
vim highlighting Fabrice 24 Oct 2008 09:12:24
vim syntax Fabrice 24 Oct 2008 09:12:24
vim matlab indentation Fabrice 29 Oct 2008 10:01:29
syntax YANG YANG 10 Sep 2009 13:58:03
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com