A vim plugin that emulates all of the powerful IDE features of MATLAB in vim so you don't need to run the full GUI.
git clone https://mcol.xyz/code/vimlab
Log | Files | Refs | README | LICENSE

commit e65ded5b49c4ba4c68b465c7ddab1afc061d80ba
Author: mcol <mcol@posteo.net>
Date:   Mon, 22 Oct 2018 21:42:36 +0100

init commit

Diffstat:
A.gitignore | 1+
AREADME.md | 19+++++++++++++++++++
Acompiler/mlint.vim | 44++++++++++++++++++++++++++++++++++++++++++++
Adoc/matlab.txt | 111+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adoc/tags | 8++++++++
Aftplugin/matlab.vim | 34++++++++++++++++++++++++++++++++++
Aindent/matlab.vim | 146+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Alicense.txt | 24++++++++++++++++++++++++
Amatlab.vim | 119+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asyntax/matlab.vim | 357+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
10 files changed, 863 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/README.md b/README.md @@ -0,0 +1,19 @@ +Matlab for vim +============= + +### Features + +- Syntax highlighting +- Correct indentation +- Correct setting to use the matchit.vim script +- Tag support +- Help file + +### Where these codes come from? +These code doesn't own by me. I just copy it from [here](http://www.mathworks.com/matlabcentral/fileexchange/21798-editing-matlab-files-in-vim), and make it to be a git repo. + +### Why this fork? +The reason I do this is because I think there are many people will want to use this plugin, and people may want to add some commit to this plugin, too. Therefore, host this plugin on github will make things more easier and happier. + +### Installation +I recommend you to use [Vundle](https://github.com/gmarik/vundle) to install. The [NeoBundle](https://github.com/Shougo/neobundle.vim) is also a good choice. diff --git a/compiler/mlint.vim b/compiler/mlint.vim @@ -0,0 +1,44 @@ +" Vim compiler file +" Compiler: Matlab mlint code checker +" Maintainer: Fabrice Guy <fabrice.guy at gmail dot com> +" Latest Revision: 2008 Oct 16 +" Comment: mlint messages are either +" - L x (C y): message (where x and y are line number and +" column number) +" - L x (C y-z): message (where x is the line number, y and +" z the column numbers where the error comes from) + + +if exists("current_compiler") + finish +endif +let current_compiler = "mlint" + +if exists(":CompilerSet") != 2 " older Vim always used :setlocal + command -nargs=* CompilerSet setlocal <args> +endif + +" mlint doesn't provide filename information except if multiple +" filenames are given +" With the following command : +" mlint <filename> <filename without extension> +" mlint produces an output like that : +" ========== <filename> ========== +" L x (C y): ID : Message +" L x (C y): ID : Message +" .. +" .. +" ========== <filename without extension> ========== +" L 0 (C 0): MDOTM :Filename 'filename' must end in .m or .M +" +" The filename can then be parsed +CompilerSet makeprg=mlint\ -id\ %\ %< + +CompilerSet errorformat= + \%-P==========\ %f\ ==========, + \%-G%>==========\ %s\ ==========, + \%-G%>L\ %l\ (C\ %c):\ MDOTM%m, + \L\ %l\ (C\ %c):\ %m, + \L\ %l\ (C\ %c-%*[0-9]):\ %m, + \%-Q + diff --git a/doc/matlab.txt b/doc/matlab.txt @@ -0,0 +1,111 @@ +MatlabEditionFiles *matlab* *MatlabEditionFiles* +A set of files useful to edit Matlab files. + +Included is : +1. Syntax highlighting |matlab-syntax| +2. Using the matchit.vim script |matlab-matchit| +3. Correct indentation |matlab-indent| +4. Integration of the mlint Matlab code checker |matlab-compiler| +5. Tag support |matlab-tags| +6. Installation details |matlab-instal| + +================================================================================ +1. Syntax highlighting *matlab-syntax* + +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 + +================================================================================ +2. Correct settings in order to use the matchit.vim script *matlab-matchit* + +The matchit.vim extends the % matching and enables to jump through matching +groups such as "if/end" or "switch/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 *matlab-indent* + + 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 +(using the 'indent all functions' option). + +NOTE : to work correctly, this script need the matchit.vim (vimscript#39) to +be installed. (see also |matchit|) + +================================================================================ +4. Integration of the mlint Matlab code checker *matlab-compiler* + +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 |quickfix| in vim) + +================================================================================ +5. Tag support *matlab-tags* +The .ctags file (in the matlab.zip) 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 |tags| in vim. + +These scripts have been tested using gvim 7.2 and Matlab R2008a on Windows. + +================================================================================ +6. Installation details *matlab-instal* + +The package is matlab.zip : just unzip it to extract the files. + +- help file + + Copy doc/matlab.txt to your $HOME/vimfiles/doc directory. + And then run the command to create help for matlab : > + :helptags $HOME/vimfiles/doc +< Then the command > + :help matlab +< is available + +- Syntax highlighting + Copy syntax/matlab.vim to your $HOME/vimfiles/syntax + directory + +- Correct settings in order to use the matchit.vim script + In your vimrc file, add the following line : > + source $VIMRUNTIME/macros/matchit.vim +< + And copy ftplugin/matlab.vim to your $HOME/vimfiles/ftplugin directory + +- Correct indentation + In your vimrc file, add the following lines : > + source $VIMRUNTIME/macros/matchit.vim + filetype indent on +< + And copy indent/matlab.vim to your $HOME/vimfiles/indent directory + +- Integration of the mlint Matlab code checker with the :make command + + Add the following line to your vimrc file : > + autocmd BufEnter *.m compiler mlint +< + And copy compiler/mlint.vim to your $HOME/vimfiles/compiler directory + +- Tag support + + Copy the .ctags to your $HOME directory. And then run the + command to create your tags file : for example : > + ctags -R * + + diff --git a/doc/tags b/doc/tags @@ -0,0 +1,8 @@ +MatlabEditionFiles matlab.txt /*MatlabEditionFiles* +matlab matlab.txt /*matlab* +matlab-compiler matlab.txt /*matlab-compiler* +matlab-indent matlab.txt /*matlab-indent* +matlab-instal matlab.txt /*matlab-instal* +matlab-matchit matlab.txt /*matlab-matchit* +matlab-syntax matlab.txt /*matlab-syntax* +matlab-tags matlab.txt /*matlab-tags* diff --git a/ftplugin/matlab.vim b/ftplugin/matlab.vim @@ -0,0 +1,34 @@ +" Vim filetype plugin file +" Language: matlab +" Maintainer: Fabrice Guy <fabrice.guy at gmail dot com> +" Last Changed: 2010 May 19 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let s:save_cpo = &cpo +set cpo-=C + +setlocal fo+=croql +setlocal comments=:%>,:% + +if exists("loaded_matchit") + let s:conditionalEnd = '\([-+{\*\:(\/]\s*\)\@<!\<end\>\(\s*[-+}\:\*\/)]\)\@!' + let b:match_words = '\<classdef\>\|\<methods\>\|\<events\>\|\<properties\>\|\<if\>\|\<while\>\|\<for\>\|\<switch\>\|\<try\>\|\<function\>:' . s:conditionalEnd +endif + +setlocal suffixesadd=.m +setlocal suffixes+=.asv +" Change the :browse e filter to primarily show M-files +if has("gui_win32") && !exists("b:browsefilter") + let b:browsefilter="M-files (*.m)\t*.m\n" . + \ "All files (*.*)\t*.*\n" +endif + +let b:undo_ftplugin = "setlocal suffixesadd< suffixes< " + \ . "| unlet! b:browsefilter" + \ . "| unlet! b:match_words" + +let &cpo = s:save_cpo diff --git a/indent/matlab.vim b/indent/matlab.vim @@ -0,0 +1,146 @@ +" Matlab indent file +" Language: Matlab +" Maintainer: Fabrice Guy <fabrice.guy at gmail dot com> +" Last Change: 2009 Nov 23 - Added support for if/end block on the same line + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 +let s:functionWithoutEndStatement = 0 + +setlocal indentexpr=GetMatlabIndent() +setlocal indentkeys=!,o,O=end,=case,=else,=elseif,=otherwise,=catch + +" Only define the function once. +if exists("*GetMatlabIndent") + finish +endif + +function! s:IsMatlabContinuationLine(lnum) + let continuationLine = 0 + if a:lnum > 0 + let pnbline = getline(prevnonblank(a:lnum)) + " if we have the line continuation operator (... at the end of a line or + " ... followed by a comment) it may be a line continuation + if pnbline =~ '\.\.\.\s*$' || pnbline =~ '\.\.\.\s*%.*$' + let continuationLine = 1 + " but if the ... are part of a string or a comment, it is not a + " continuation line + let col = match(pnbline, '\.\.\.\s*$') + if col == -1 + let col = match(pnbline, '\.\.\.\s*%.*$') + endif + if has('syntax_items') + if synIDattr(synID(prevnonblank(a:lnum), col + 1, 1), "name") =~ "matlabString" || + \ synIDattr(synID(prevnonblank(a:lnum), col + 1, 1), "name") =~ "matlabComment" + let continuationLine = 0 + endif + endif + endif + endif + return continuationLine +endfunction + +function GetMatlabIndent() + " Find a non-blank line above the current line. + let plnum = prevnonblank(v:lnum - 1) + + " If the previous line is a continuation line, get the beginning of the block to + " use the indent of that line + if s:IsMatlabContinuationLine(plnum - 1) + while s:IsMatlabContinuationLine(plnum - 1) + let plnum = plnum - 1 + endwhile + endif + + " At the start of the file use zero indent. + if plnum == 0 + return 0 + endif + + let curind = indent(plnum) + if s:IsMatlabContinuationLine(v:lnum - 1) + let curind = curind + &sw + endif + " Add a 'shiftwidth' after classdef, properties, switch, methods, events, + " function, if, while, for, otherwise, case, try, catch, else, elseif + if getline(plnum) =~ '^\s*\(classdef\|properties\|switch\|methods\|events\|if\|while\|for\|otherwise\|case\|try\|catch\|else\|elseif\)\>' + let curind = curind + &sw + " In Matlab we have different kind of functions + " - the main function (the function with the same name than the filename) + " - the nested functions + " - the functions defined in methods (for classes) + " - subfunctions + " Principles for the indentation : + " - all the function keywords are indented (corresponding to the + " 'indent all functions' in the Matlab Editor) + " - if we have only subfonctions (ie if the main function doesn't have + " any mayching end), then each function is dedented + if getline(plnum) =~ '^\s*\function\>' + let pplnum = plnum - 1 + while pplnum > 1 && (getline(pplnum) =~ '^\s*%') + let pplnum = pplnum - 1 + endwhile + " If it is the main function, determine if function has a matching end + " or not + if pplnum <= 1 + " look for a matching end : + " - if we find a matching end everything is fine : end of functions + " will be dedented when 'end' is reached + " - if not, then all other functions are subfunctions : 'function' + " keyword has to be dedended + let old_lnum = v:lnum + let motion = plnum . "gg" + execute "normal" . motion + normal % + if getline(line('.')) =~ '^\s*end' + let s:functionWithoutEndStatement = 0 + else + let s:functionWithoutEndStatement = 1 + endif + normal % + let motion = old_lnum . "gg" + execute "normal" . motion + endif + endif + " if the for-end block (or while-end) is on the same line : dedent + if getline(plnum) =~ '\<end[,;]*\s*\(%.*\)\?$' + let curind = curind - &sw + endif + endif + + " Subtract a 'shiftwidth' on a else, elseif, end, catch, otherwise, case + if getline(v:lnum) =~ '^\s*\(else\|elseif\|end\|catch\|otherwise\|case\)\>' + let curind = curind - &sw + endif + " No indentation in a subfunction + if getline(v:lnum) =~ '^\s*\function\>' && s:functionWithoutEndStatement + let curind = curind - &sw + endif + " First case after a switch : indent + if getline(v:lnum) =~ '^\s*case' + while plnum > 0 && (getline(plnum) =~ '^\s*%' || getline(plnum) =~ '^\s*$') + let plnum = plnum - 1 + endwhile + if getline(plnum) =~ '^\s*switch' + let curind = indent(plnum) + &sw + endif + endif + + " end in a switch / end block : dedent twice + " we use the matchit script to know if this end is the end of a switch block + if exists("b:match_words") + if getline(v:lnum) =~ '^\s*end' + normal % + if getline(line('.')) =~ '^\s*switch' + let curind = curind - &sw + endif + normal % + end + end + return curind +endfunction + +" vim:sw=2 diff --git a/license.txt b/license.txt @@ -0,0 +1,24 @@ +Copyright (c) 2009, Fabrice +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the distribution + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/matlab.vim b/matlab.vim @@ -0,0 +1,119 @@ +""" MATLAB-FILE SPECIFIC VIM CONFIGURATION + +" https://github.com/lazywei/vim-matlab provides +" Fabrice Guy's files from ttps://www.vim.org/scripts/script.php?script_id=2407 +" syntax highlighting, indentations, matching if/end for/end etc + +"------------------------------------------------------------------ +" mlint code checking +"------------------------------------------------------------------ +" mlint is symlinked into $PATH from <MATLABROOT>/bin/<ARCH> +" mlint.vim from vim-matlab appears to not get sourced automatically +source ~/.vim/bundle/vim-matlab/compiler/mlint.vim + +" check code by running mlin +nnoremap <Leader>cc :make<CR> + +" open quickfix to view errors +nnoremap <Leader>co :copen<CR> + +" go to next and previous errors +nnoremap <Leader>cn :cn<CR> +nnoremap <Leader>cp :cp<CR> + + +"------------------------------------------------------------------ +" This section from http://github.com/elmanuelito/vim-matlab-behave +"------------------------------------------------------------------ +" make section title bold +highlight MATCELL cterm=bold term=bold gui=bold +match MATCELL /^%%[^%]*$/ + +" enable matlab section folding +function! MatlabFolds() + let thisline = getline(v:lnum) + if match(thisline,'^[\ ]*%%') >=0 + return ">1" + else + return "=" + endif +endfunction +setlocal foldmethod=expr +setlocal foldexpr=MatlabFolds() + +" Save matlab session manually +map <Leader>ss :w<CR>:mksession! ~/.cache/vim/sessions/matlab-session.vim<Cr> +" and automatically on exit +nnoremap XA :mksession! ~/.cache/vim/sessions/matlab-session.vim<CR>:wqa<CR> + + +"--------------------------------------------------------------------- +" Format title line of folded sections to just show text and no. lines +"--------------------------------------------------------------------- +function! MyFoldText() " {{{ + let line = getline(v:foldstart) + + let nucolwidth = &fdc + &number * &numberwidth + let windowwidth = winwidth(0) - nucolwidth - 3 + let foldedlinecount = v:foldend - v:foldstart + + " expand tabs into spaces + let onetab = strpart(' ', 0, &tabstop) + let line = substitute(line, '\t', onetab, 'g') + + let line = strpart(line, 0, windowwidth - 2 -len(foldedlinecount)) + let fillcharcount = windowwidth - len(line) - len(foldedlinecount) + return line . '…' . repeat(" ",fillcharcount) . foldedlinecount . '…' . ' ' +endfunction " }}} +set foldtext=MyFoldText() + + +"------------------------------------------------------------------ +" vim-slime configuration git://github.com/jpalardy/vim-slime.git +"------------------------------------------------------------------ +let g:slime_target = "tmux" +let g:slime_dont_ask_default = 1 +let g:slime_default_config = {"socket_name": "default", "target_pane": "1"} +let g:slime_paste_file = "/tmp/slime_paste" + +" F9 will send paragraph or visual selection +map <F9> <C-c><C-c> +" F8 will run current line +map <F8> <Esc>ms0v$<F9>`s +" F7 will run the current small word +map <F7> <Esc>msviw<C-c><C-c>`s +" F4 will run the current section +map <F4> ms:execute 'try \| foldopen! \| catch \| \| endtry'<CR>$?%%\\|\%^?<CR>v$/%%\\|\%$<CR>?^\h<CR>$<F9>`s:let @/=""<CR> +" F2 will run entire file +"map <F2> <Esc>msggvG<F9>`s +map <F2> <Esc>:let @" = expand("%")<CR>:SlimeSend1 <C-r>"<CR> + +" open word under cursor +map <CR> yiw:SlimeSend1 op <C-r>"<CR> + +" debugging +nnoremap <silent> <Leader>dq :SlimeSend1 dbquit all<CR> +" set/clear is <F12> normally. quit is <S-<F5>> +nnoremap <silent> <Leader>ds ms:let @" = "dbstop in " . expand("%") . " at " . line(".")<CR>:SlimeSend1 <C-r>"<CR>A %%% STOP %%%<Esc>`s +nnoremap <silent> <Leader>dc :let @" = "dbclear in " . expand("%") . " at " . line(".")<CR>:SlimeSend1 <C-r>"<CR>:.s/ %%% STOP %%%//<CR> +nnoremap <silent> <F10> :SlimeSend1 dbstep<CR> +nnoremap <silent> <F5> :SlimeSend1 dbcont<CR> +nnoremap <silent> <Leader>de :SlimeSend1 dbstop if error<CR> + + +"------------------------------------------------------------------ +" Misc settings +"------------------------------------------------------------------ +" map hash sign to percentage sign for commenting +inoremap # % + +" add shortcuts to write chunks of code +nnoremap <Leader>f ofor <CR>end<Esc>kA +nnoremap <Leader>i oif <CR>end<Esc>kA +nnoremap <Leader>e oend<Esc> + +" list variables +nnoremap <silent> <C-w> :SlimeSend1 who<CR> + +" open file under cursor +"nnoremap <CR> yiw:e **/<C-r>"*<CR> diff --git a/syntax/matlab.vim b/syntax/matlab.vim @@ -0,0 +1,357 @@ +" Vim syntax file +" Language: Matlab +" Maintainer: Fabrice Guy <fabrice.guy at gmail dot com> +" Original authors: Mario Eusebio and Preben Guldberg +" Last Change: 2008 Oct 16 : added try/catch/rethrow and class statements +" 2008 Oct 28 : added highlighting for most of Matlab functions +" 2009 Nov 23 : added 'todo' keyword in the matlabTodo keywords +" (for doxygen support) + +" For version 5.x: Clear all syntax items +" For version 6.x: Quit when a syntax file was already loaded +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +syn keyword matlabStatement return function +syn keyword matlabConditional switch case else elseif end if otherwise break continue +syn keyword matlabRepeat do for while +syn keyword matlabStorageClass classdef methods properties events persistent global +syn keyword matlabExceptions try catch rethrow throw + +syn keyword matlabTodo contained TODO NOTE FIXME XXX +syn keyword matlabImport import +" If you do not want these operators lit, uncommment them and the "hi link" below +syn match matlabRelationalOperator "\(==\|\~=\|>=\|<=\|=\~\|>\|<\|=\)" +syn match matlabArithmeticOperator "[-+]" +syn match matlabArithmeticOperator "\.\=[*/\\^]" +syn match matlabLogicalOperator "[&|~]" +syn keyword matlabBoolean true false + +syn match matlabLineContinuation "\.\{3}" + +" String +syn region matlabString start=+'+ end=+'+ oneline + +" If you don't like tabs +syn match matlabTab "\t" + +" Standard numbers +syn match matlabNumber "\<\d\+[ij]\=\>" +" floating point number, with dot, optional exponent +syn match matlabFloat "\<\d\+\(\.\d*\)\=\([edED][-+]\=\d\+\)\=[ij]\=\>" +" floating point number, starting with a dot, optional exponent +syn match matlabFloat "\.\d\+\([edED][-+]\=\d\+\)\=[ij]\=\>" +syn keyword matlabConstant eps Inf NaN pi + + +" Transpose character and delimiters: Either use just [...] or (...) aswell +syn match matlabDelimiter "[][]" +"syn match matlabDelimiter "[][()]" +syn match matlabTransposeOperator "[])a-zA-Z0-9.]'"lc=1 + +syn match matlabSemicolon ";" + +syn match matlabComment "%.*$" contains=matlabTodo,matlabTab +syn region matlabBlockComment start=+%{+ end=+%}+ contains=matlabBlockComment + + +" trigonometric +syn keyword matlabFunc acos acosd acosh acot acotd acoth acsc acscd acsch asec asecd asech asin asind asinh +syn keyword matlabFunc atan atan2 atand atanh cos cosd cosh cot cotd coth csc cscd csch hypot sec secd +syn keyword matlabFunc sech sin sind sinh tan tand tanh +" exponential +syn keyword matlabFunc exp expm1 log log10 log1p log2 nextpow2 nthroot pow2 reallog realpow realsqrt sqrt +" Complex +syn keyword matlabFunc abs angle complex conj cplxpair imag real sign unwrap +" Rounding and Remainder +syn keyword matlabFunc ceil fix floor idivide mod rem round +"Discrete Math (e.g., Prime Factors) +syn keyword matlabFunc factor factorial gcd isprime lcm nchoosek perms primes rat rats +"Polynomials +syn keyword matlabFunc conv deconv poly polyder polyeig polyfit polyint polyval polyvalm residue roots +"Numeric Types +syn keyword matlabFunc arrayfun cast cat class find intmax intmin intwarning ipermute isa isequal isequalwithequalnans isfinite isinf isnan isnumeric isreal isscalar isvector permute realmax realmin reshape squeeze zeros +"Characters and Strings +syn keyword matlabFunc cellstr char eval findstr isstr regexp sprintf sscanf strcat strcmp strcmpi strings strjust strmatch strread strrep strtrim strvcat +"Structures +syn keyword matlabFunc cell2struct deal fieldnames getfield isfield isstruct orderfields rmfield setfield struct struct2cell structfun +"Cell Arrays +syn keyword matlabFunc cell cell2mat celldisp cellfun cellplot iscell iscellstr mat2cell num2cell +"Function Handles +syn keyword matlabFunc feval func2str functions str2func +"Java Classes and Objects +syn keyword matlabFunc clear depfun exist im2java inmem javaaddpath javaArray javachk Generate javaclasspath javaMethod javaObject javarmpath methodsview usejava which +"Data Type Identification +syn keyword matlabFunc ischar isfloat isinteger isjava islogical isobject validateattributes who whos +"Data type conversion +"Numeric +syn keyword matlabFunc double int8 int16 int32 int64 single typecast uint8 uint16 uint32 uint64 +"String to Numeric +syn keyword matlabFunc base2dec bin2dec hex2dec hex2num str2double str2num unicode2native +"Numeric to String +syn keyword matlabFunc dec2base dec2bin dec2hex int2str mat2str native2unicode num2str +"Other Conversions +syn keyword matlabFunc datestr logical num2hex str2mat +"String Creation +syn keyword matlabFunc blanks +"String Identification +syn keyword matlabFunc isletter isspace isstrprop validatestring +"String Manipulation +syn keyword matlabFunc deblank lower upper +"String Parsing +syn keyword matlabFunc regexpi regexprep regexptranslate strfind strtok +"String Evaluation +syn keyword matlabFunc evalc evalin +"String Comparison +syn keyword matlabFunc strncmp strncmpi +"Bit-wise Functions +syn keyword matlabFunc bitand bitcmp bitget bitmax bitor bitset bitshift bitxor swapbytes +"Logical Functions +syn keyword matlabFunc all and any iskeyword isvarname not or xor +"Predefined Dialog Boxes +syn keyword matlabFunc dialog errordlg export2wsdlg helpdlg inputdlg listdlg msgbox printdlg printpreview questdlg uigetdir uigetfile uigetpref uiopen uiputfile uisave uisetcolor uisetfont waitbar warndlg +"Deploying User Interfaces +syn keyword matlabFunc guidata guihandles movegui openfig +"Developing User Interfaces +syn keyword matlabFunc addpref getappdata getpref ginput guide inspect isappdata ispref rmappdata rmpref setappdata setpref uisetpref waitfor waitforbuttonpress +"User Interface Objects +syn keyword matlabFunc uibuttongroup uicontextmenu uicontrol uimenu uipanel uipushtool uitoggletool uitoolbar menu +"Finding Objects from Callbacks +syn keyword matlabFunc findall findfigs findobj gcbf gcbo +"GUI Utility Functions +syn keyword matlabFunc align getpixelposition listfonts selectmoveresize setpixelposition textwrap uistack +"Controlling Program Execution +syn keyword matlabFunc uiresume uiwait +"Basic Plots and Graphs +syn keyword matlabFunc box errorbar hold loglog plot plot3 plotyy polar semilogx semilogy subplot +"Plotting Tools +syn keyword matlabFunc figurepalette pan plotbrowser plotedit plottools propertyeditor rotate3d showplottool zoom + +"Annotating Plots +syn keyword matlabFunc annotation clabel datacursormode datetick gtext legend line rectangle texlabel title xlabel ylabel zlabel +"Area, Bar, and Pie Plots +syn keyword matlabFunc area bar barh bar3 bar3h pareto pie pie3 +"Contour Plots +syn keyword matlabFunc contour contour3 contourc contourf ezcontour ezcontourf +"Direction and Velocity Plots +syn keyword matlabFunc comet comet3 compass feather quiver quiver3 +"Discrete Data Plots +syn keyword matlabFunc stairs stem stem3 +"Function Plots +syn keyword matlabFunc ezmesh ezmeshc ezplot ezplot3 ezpolar ezsurf ezsurfc fplot +"Histograms +syn keyword matlabFunc hist histc rose +"Polygons and Surfaces +syn keyword matlabFunc convhull cylinder delaunay delaunay3 delaunayn dsearch dsearchn ellipsoid fill fill3 inpolygon pcolor polyarea rectint ribbon slice sphere tsearch tsearchn voronoi waterfall +"Scatter/Bubble Plots +syn keyword matlabFunc plotmatrix scatter scatter3 +"Animation +syn keyword matlabFunc getframe im2frame movie noanimate +"Bit-Mapped Images +syn keyword matlabFunc frame2im image imagesc imfinfo imformats imread imwrite ind2rgb +"Printing +syn keyword matlabFunc frameedit hgexport orient print printopt saveas +"Handle Graphics +syn keyword matlabFunc allchild ancestor copyobj delete gca gco get ishandle propedit set +"Object +syn keyword matlabFunc axes figure hggroup hgtransform light patch +"root object +syn keyword matlabFunc surface text +"Plot Objects +syn keyword matlabFunc clf close closereq drawnow gcf hgload hgsave newplot opengl refresh +"Axes Operations +syn keyword matlabFunc axis cla grid ishold makehgtform +"Operating on Object Properties +syn keyword matlabFunc linkaxes linkprop refreshdata +"Data analysis +"Basic Operations +syn keyword matlabFunc brush cumprod cumsum linkdata prod sort sortrows sum +"Descriptive Statistics +syn keyword matlabFunc corrcoef cov max mean median min mode std var +"Filtering and Convolution +syn keyword matlabFunc conv2 convn detrend filter filter2 +"Interpolation and Regression +syn keyword matlabFunc interp1 interp2 interp3 interpn mldivide mrdivide +"Fourier Transforms +syn keyword matlabFunc fft fft2 fftn fftshift fftw ifft ifft2 ifftn ifftshift +"Derivatives and Integrals +syn keyword matlabFunc cumtrapz del2 diff gradient trapz +"File Operations +syn keyword matlabFunc cd copyfile dir fileattrib filebrowser isdir lookfor ls matlabroot mkdir movefile pwd recycle rehash rmdir toolboxdir type what +"Operating System Interface +syn keyword matlabFunc clipboard computer dos getenv hostid maxNumCompThreads perl setenv system unix winqueryreg +"MATLAB Version and License +syn keyword matlabFunc ismac ispc isstudent isunix javachk license prefdir usejava ver verLessThan version +"Basic Information +syn keyword matlabFunc disp display isempty issparse length ndims numel size +"Elementary Matrices and Arrays +syn keyword matlabFunc blkdiag diag eye freqspace ind2sub linspace logspace meshgrid ndgrid ones rand randn sub2ind +"Array Operations +syn keyword matlabFunc accumarray bsxfun cross dot kron tril triu +"Array Manipulation +syn keyword matlabFunc circshift flipdim fliplr flipud horzcat inline repmat rot90 shiftdim vectorize vertcat +"Specialized Matrices +syn keyword matlabFunc compan gallery hadamard hankel hilb invhilb magic pascal rosser toeplitz vander wilkinson +"Matrix Analysis +syn keyword matlabFunc cond condeig det norm normest null orth rank rcond rref subspace trace +"Linear Equations +syn keyword matlabFunc chol cholinc condest funm ilu inv linsolve lscov lsqnonneg lu luinc pinv qr +"Eigenvalues and Singular Values +syn keyword matlabFunc balance cdf2rdf eig eigs gsvd hess ordeig ordqz ordschur rsf2csf schur sqrtm ss2tf svd svds +"Matrix Logarithms and Exponentials +syn keyword matlabFunc expm logm +"Factorization +syn keyword matlabFunc cholupdate planerot qrdelete qrinsert qrupdate qz +"Interpolation +syn keyword matlabFunc griddata griddata3 griddatan interp1q interpft mkpp padecoef pchip ppval spline unmkpp +"Delaunay Triangulation and Tessellation +syn keyword matlabFunc tetramesh trimesh triplot trisurf +"Convex Hull +syn keyword matlabFunc convhulln +"Voronoi Diagrams +syn keyword matlabFunc voronoin +"Cartesian Coordinate System Conversion +syn keyword matlabFunc cart2pol cart2sph pol2cart sph2cart +"Ordinary Differential Equations (IVP) +syn keyword matlabFunc decic deval ode15i ode23 ode45 ode113 ode15s ode23s ode23t ode23tb odefile odeget odeset odextend +"Delay Differential Equations +syn keyword matlabFunc dde23 ddeget ddesd ddeset +"Boundary Value Problems +syn keyword matlabFunc bvp4c bvp5c bvpget bvpinit bvpset bvpxtend +"Partial Differential Equations +syn keyword matlabFunc pdepe pdeval +"Optimization +syn keyword matlabFunc fminbnd fminsearch fzero optimget optimset +"Numerical Integration (Quadrature) +syn keyword matlabFunc dblquad quad quadgk quadl quadv triplequad +"Specialized Math +syn keyword matlabFunc airy besselh besseli besselj besselk bessely beta betainc betaln ellipj ellipke erf erfc erfcx erfinv erfcinv expint gamma gammainc gammaln legendre psi +"Elementary Sparse Matrices +syn keyword matlabFunc spdiags speye sprand sprandn sprandsym +"Full to Sparse Conversion +syn keyword matlabFunc full sparse spconvert +"Working with Sparse Matrices +syn keyword matlabFunc nnz nonzeros nzmax spalloc spfun spones spparms spy +"Reordering Algorithms +syn keyword matlabFunc amd colamd colperm dmperm ldl randperm symamd symrcm +"Linear Algebra +syn keyword matlabFunc spaugment sprank +"Linear Equations (Iterative Methods) +syn keyword matlabFunc bicg bicgstab cgs gmres lsqr minres pcg qmr symmlq +"Tree Operations +syn keyword matlabFunc etree etreeplot gplot symbfact treelayout treeplot +"Timeseries +"General Purpose +syn keyword matlabFunc getdatasamplesize getqualitydesc timeseries tsprops tstool +"Data Manipulation +syn keyword matlabFunc addsample ctranspose delsample getabstime getinterpmethod getsampleusingtime idealfilter resample setabstime setinterpmethod synchronize transpose +"Event Data +syn keyword matlabFunc addevent delevent gettsafteratevent gettsafterevent gettsatevent gettsbeforeatevent gettsbeforeevent gettsbetweenevents +"Descriptive Statistics +syn keyword matlabFunc iqr + +"Time Series Collections +"General Purpose +syn keyword matlabFunc tscollection +"Data Manipulation +syn keyword matlabFunc addsampletocollection addts delsamplefromcollection gettimeseriesnames removets settimeseriesnames +"Set Functions +syn keyword matlabFunc intersect ismember issorted setdiff setxor union unique +"Date and Time Functions +syn keyword matlabFunc addtodate calendar clock cputime date datenum datevec eomday etime now weekday +"M-File Functions and Scripts +syn keyword matlabFunc addOptional addParamValue addRequired createCopy depdir echo input inputname inputParser mfilename namelengthmax nargchk nargin nargout nargoutchk parse pcode +"script Script M-file description +syn keyword matlabFunc varargin varargout +"Evaluation of Expressions and Functions +syn keyword matlabFunc ans assert builtin pause run script symvar +"Timer Functions +syn keyword matlabFunc isvalid start startat stop timer timerfind timerfindall wait +"Variables and Functions in Memory +syn keyword matlabFunc assignin datatipinfo genvarname isglobal memory mislocked mlock munlock pack +"Control Flow +syn keyword matlabFunc parfor +"Error Handling +syn keyword matlabFunc addCause error ferror getReport last lasterr lasterror lastwarn warning +"Classes and Objects +syn keyword matlabFunc addlistener addprop dynamicprops +"events Display class event names +syn keyword matlabFunc findprop getdisp handle hgsetget inferiorto loadobj metaclass notify saveobj setdisp subsasgn subsindex subsref substruct superiorto +"File Name Construction +syn keyword matlabFunc filemarker fileparts filesep fullfile tempdir tempname +"Opening, Loading, Saving Files +syn keyword matlabFunc daqread filehandle importdata load open save uiimport winopen +"Memory Mapping +syn keyword matlabFunc memmapfile +"Low-Level File I/O +syn keyword matlabFunc fclose feof fgetl fgets fopen fprintf fread frewind fscanf fseek ftell fwrite + +"Text Files +syn keyword matlabFunc csvread csvwrite dlmread dlmwrite textread textscan +"XML Documents +syn keyword matlabFunc xmlread xmlwrite xslt +"Microsoft Excel Functions +syn keyword matlabFunc xlsfinfo xlsread xlswrite +"Lotus 1-2-3 Functions +syn keyword matlabFunc wk1finfo wk1read wk1write +"Common Data Format (CDF) +syn keyword matlabFunc cdfepoch cdfinfo cdfread cdfwrite todatenum +"Flexible Image Transport System +syn keyword matlabFunc fitsinfo fitsread +"Hierarchical Data Format (HDF) +syn keyword matlabFunc hdf hdf5 hdf5info hdf5read hdf5write hdfinfo hdfread hdftool +"Band-Interleaved Data +syn keyword matlabFunc multibandread multibandwrite + + +" Define the default highlighting. +" For version 5.7 and earlier: only when not done already +" For version 5.8 and later: only when an item doesn't have highlighting yet +if version >= 508 || !exists("did_matlab_syntax_inits") + if version < 508 + let did_matlab_syntax_inits = 1 + command -nargs=+ HiLink hi link <args> + else + command -nargs=+ HiLink hi def link <args> + endif + + HiLink matlabTransposeOperator matlabOperator + HiLink matlabLineContinuation Special + HiLink matlabLabel Label + HiLink matlabConditional Conditional + HiLink matlabRepeat Repeat + HiLink matlabTodo Todo + HiLink matlabString String + HiLink matlabDelimiter Identifier + HiLink matlabTransposeOther Identifier + HiLink matlabNumber Number + HiLink matlabFloat Float + HiLink matlabConstant Constant + HiLink matlabImplicit matlabStatement + HiLink matlabStatement Statement + HiLink matlabSemicolon SpecialChar + HiLink matlabComment Comment + HiLink matlabBlockComment Comment + HiLink matlabImport Include + HiLink matlabBoolean Boolean + HiLink matlabStorageClass StorageClass + + HiLink matlabArithmeticOperator matlabOperator + HiLink matlabRelationalOperator matlabOperator + HiLink matlabLogicalOperator matlabOperator + HiLink matlabOperator Operator + HiLink matlabExceptions Exception + HiLink matlabFunc Function + + "optional highlighting + "HiLink matlabIdentifier Identifier + "HiLink matlabTab Error + delcommand HiLink +endif + +let b:current_syntax = "matlab" + +"EOF vim: ts=8 noet tw=100 sw=8 sts=0