sponsor Vim development Vim logo Vim Book Ad

mlint.vim : Runs Matlab's mlint program and highlights the code appropriately

 script karma  Rating 18/9, Downloaded by 1831    Comments, bugs, improvements  Vim wiki

created by
Thomas Ibbotson
script type
This is a filetype plugin for Matlab .m files. It runs Matlab's mlint function at appropriate times, parses the output and highlights the code in a similar fashion to the Matlab editor.

The script maps <LocalLeader>l to its RunLint() function, so you can run the mlint tool at other times other than the automatic ones.

<LocalLeader>m gives the messages from mlint on the status line for the line that the cursor is on.

To view all the messages for a file, use <LocalLeader>o to bring up the quickfix list.

On windows the automatic updating can get quite annoying because it pops up a command window everytime it runs mlint, even if only briefly. I would like to call mlint using "start /b mlint" which should prevent this, however there is a bug in Vim which stops me being able to do this. So as a workaround you can optionally disable running mlint on hover by putting this line in your .vimrc:
let mlint_hover = 0
install details
Put matlab.vim in vimfiles/after/ftplugin or in $HOME/.vim/after/ftplugin.
Restart vim.

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
matlab.vim 0.6.1 2011-10-22 7.0 Thomas Ibbotson Now uses the quickfix list with <LocalLeader>o
matlab.vim 0.6 2011-10-21 7.0 Thomas Ibbotson Add an outline window to show all mlint messages for the file, using <LocalLeader>o.
matlab.vim 0.5 2011-10-21 7.0 Thomas Ibbotson Ben Fritz: This fixes that Windows does stupid things with shellescape() if
shellslash is set.
matlab.vim 0.4 2009-08-18 7.0 Thomas Ibbotson Ben Fritz:
RunLint() only called on a cursorhold event if the buffer has been changed.
matlab.vim 0.3.1 2009-05-29 7.0 Thomas Ibbotson Another bug fix for deleting the temporary directory. Directory deletion was failing as there was still a '.m~' file in the directory. This is now deleted, allowing the directory to be deleted.
matlab.vim 0.3 2008-10-14 7.0 Thomas Ibbotson More fixes from Benjamin Fritz:
1.) File names with spaces handled properly
2.) fnameescape and shellescape now used properly
3.) allowed user to specify path to mlint in case it isn't in the system path
4.) detect failure deleting temp directory by checking for existence
of the directory after the deletion
5.) show messages that mlint gives about line 0 (the filename)
matlab.vim 0.2.1 2008-10-13 7.0 Thomas Ibbotson Fixed temporary directory deletion bug (as far as I have tested it).
matlab.vim 0.2 2008-10-13 7.0 Thomas Ibbotson Added significant changes made by Benjamin Fritz. Now deletes the temporary folders it creates. the clearLint() function now only deletes the MLint matches rather than all of them as it had previously. Known bug: on unloading the buffer the temporary directory is deleted, reloading the buffer causes the script to error as it can't find the directory. I am working on a fix for this and should upload it soon. Also note that the script will on work with Vim 7.1 or higher.
mlint.vim 0.1 2008-09-25 7.2 Thomas Ibbotson Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
SourceForge.net Logo