├── .gitignore ├── doc ├── tags └── matlab.txt ├── README.md ├── ftplugin └── matlab.vim ├── license.txt ├── compiler └── mlint.vim ├── indent └── matlab.vim └── syntax └── matlab.vim /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /doc/tags: -------------------------------------------------------------------------------- 1 | MatlabEditionFiles matlab.txt /*MatlabEditionFiles* 2 | matlab matlab.txt /*matlab* 3 | matlab-compiler matlab.txt /*matlab-compiler* 4 | matlab-indent matlab.txt /*matlab-indent* 5 | matlab-instal matlab.txt /*matlab-instal* 6 | matlab-matchit matlab.txt /*matlab-matchit* 7 | matlab-syntax matlab.txt /*matlab-syntax* 8 | matlab-tags matlab.txt /*matlab-tags* 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Matlab for vim 2 | ============= 3 | 4 | ### Features 5 | 6 | - Syntax highlighting 7 | - Correct indentation 8 | - Correct setting to use the matchit.vim script 9 | - Tag support 10 | - Help file 11 | 12 | ### Where these codes come from? 13 | 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. 14 | 15 | ### Why this fork? 16 | 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. 17 | 18 | ### Installation 19 | 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. 20 | -------------------------------------------------------------------------------- /ftplugin/matlab.vim: -------------------------------------------------------------------------------- 1 | " Vim filetype plugin file 2 | " Language: matlab 3 | " Maintainer: Fabrice Guy 4 | " Last Changed: 2010 May 19 5 | 6 | if exists("b:did_ftplugin") 7 | finish 8 | endif 9 | let b:did_ftplugin = 1 10 | 11 | let s:save_cpo = &cpo 12 | set cpo-=C 13 | 14 | setlocal fo+=croql 15 | setlocal comments=:%>,:% 16 | 17 | if exists("loaded_matchit") 18 | let s:conditionalEnd = '\([-+{\*\:(\/]\s*\)\@\(\s*[-+}\:\*\/)]\)\@!' 19 | let b:match_words = '\\|\\|\\|\\|\\|\\|\\|\\|\\|\:' . s:conditionalEnd 20 | endif 21 | 22 | setlocal suffixesadd=.m 23 | setlocal suffixes+=.asv 24 | " Change the :browse e filter to primarily show M-files 25 | if has("gui_win32") && !exists("b:browsefilter") 26 | let b:browsefilter="M-files (*.m)\t*.m\n" . 27 | \ "All files (*.*)\t*.*\n" 28 | endif 29 | 30 | let b:undo_ftplugin = "setlocal suffixesadd< suffixes< " 31 | \ . "| unlet! b:browsefilter" 32 | \ . "| unlet! b:match_words" 33 | 34 | let &cpo = s:save_cpo 35 | -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009, Fabrice 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in 12 | the documentation and/or other materials provided with the distribution 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 18 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /compiler/mlint.vim: -------------------------------------------------------------------------------- 1 | " Vim compiler file 2 | " Compiler: Matlab mlint code checker 3 | " Maintainer: Fabrice Guy 4 | " Latest Revision: 2008 Oct 16 5 | " Comment: mlint messages are either 6 | " - L x (C y): message (where x and y are line number and 7 | " column number) 8 | " - L x (C y-z): message (where x is the line number, y and 9 | " z the column numbers where the error comes from) 10 | 11 | 12 | if exists("current_compiler") 13 | finish 14 | endif 15 | let current_compiler = "mlint" 16 | 17 | if exists(":CompilerSet") != 2 " older Vim always used :setlocal 18 | command -nargs=* CompilerSet setlocal 19 | endif 20 | 21 | " mlint doesn't provide filename information except if multiple 22 | " filenames are given 23 | " With the following command : 24 | " mlint 25 | " mlint produces an output like that : 26 | " ========== ========== 27 | " L x (C y): ID : Message 28 | " L x (C y): ID : Message 29 | " .. 30 | " .. 31 | " ========== ========== 32 | " L 0 (C 0): MDOTM :Filename 'filename' must end in .m or .M 33 | " 34 | " The filename can then be parsed 35 | CompilerSet makeprg=mlint\ -id\ %\ %< 36 | 37 | CompilerSet errorformat= 38 | \%-P==========\ %f\ ==========, 39 | \%-G%>==========\ %s\ ==========, 40 | \%-G%>L\ %l\ (C\ %c):\ MDOTM%m, 41 | \L\ %l\ (C\ %c):\ %m, 42 | \L\ %l\ (C\ %c-%*[0-9]):\ %m, 43 | \%-Q 44 | 45 | -------------------------------------------------------------------------------- /doc/matlab.txt: -------------------------------------------------------------------------------- 1 | MatlabEditionFiles *matlab* *MatlabEditionFiles* 2 | A set of files useful to edit Matlab files. 3 | 4 | Included is : 5 | 1. Syntax highlighting |matlab-syntax| 6 | 2. Using the matchit.vim script |matlab-matchit| 7 | 3. Correct indentation |matlab-indent| 8 | 4. Integration of the mlint Matlab code checker |matlab-compiler| 9 | 5. Tag support |matlab-tags| 10 | 6. Installation details |matlab-instal| 11 | 12 | ================================================================================ 13 | 1. Syntax highlighting *matlab-syntax* 14 | 15 | syntax/matlab.vim : Updates the matlab.vim syntax file provided in the vim 16 | distribution : 17 | - highlights keywords dealing with exceptions : try / catch / rethrow 18 | - highlights keywords dealing with class definitions : classdef / properties / 19 | methods / events 20 | 21 | ================================================================================ 22 | 2. Correct settings in order to use the matchit.vim script *matlab-matchit* 23 | 24 | The matchit.vim extends the % matching and enables to jump through matching 25 | groups such as "if/end" or "switch/end" blocks (see :help matchit in vim) 26 | 27 | ftplugin/matlab.m provides the suitable definition for b:match_words in order 28 | to jump between if/end, classdef/end, methods/end, events/end, properties/end, 29 | while/end, for/end, switch/end, try/end, function/end blocks 30 | 31 | ================================================================================ 32 | 3. Correct indentation *matlab-indent* 33 | 34 | indent/matlab.vim : Updates the matlab.vim indention file 35 | provided in the vim distribution. This script provides a correct indentation 36 | for : 37 | - switch / end, try / catch blocks 38 | - classdef / methods / properties / events 39 | - mutli-line (lines with line continuation operator (...)) 40 | 41 | This script has been tested with the Matlab R2008a release on many files and 42 | the result of indentation compared to the one provided by the Matlab Editor 43 | (using the 'indent all functions' option). 44 | 45 | NOTE : to work correctly, this script need the matchit.vim (vimscript#39) to 46 | be installed. (see also |matchit|) 47 | 48 | ================================================================================ 49 | 4. Integration of the mlint Matlab code checker *matlab-compiler* 50 | 51 | compiler/mlint.m provides the settings to use mlint (Matlab code ckecker) and 52 | puts the messages reported in the quickfix buffer. 53 | 54 | Whenever you want to check your code, just type :make and then :copen and vim 55 | opens a quickfix buffer which enables to jump to errors (using :cn, :cp or 56 | Enter to jump to the error under the cursor : see |quickfix| in vim) 57 | 58 | ================================================================================ 59 | 5. Tag support *matlab-tags* 60 | The .ctags file (in the matlab.zip) defines the Matlab language so that the 61 | exuberant ctags (http://ctags.sourceforge.net ) can construct the tag file : 62 | you can now jump to tags (using CTRL-] (or CTRL-$ if using Windows) and go 63 | back again (CTRL-T) See |tags| in vim. 64 | 65 | These scripts have been tested using gvim 7.2 and Matlab R2008a on Windows. 66 | 67 | ================================================================================ 68 | 6. Installation details *matlab-instal* 69 | 70 | The package is matlab.zip : just unzip it to extract the files. 71 | 72 | - help file 73 | 74 | Copy doc/matlab.txt to your $HOME/vimfiles/doc directory. 75 | And then run the command to create help for matlab : > 76 | :helptags $HOME/vimfiles/doc 77 | < Then the command > 78 | :help matlab 79 | < is available 80 | 81 | - Syntax highlighting 82 | Copy syntax/matlab.vim to your $HOME/vimfiles/syntax 83 | directory 84 | 85 | - Correct settings in order to use the matchit.vim script 86 | In your vimrc file, add the following line : > 87 | source $VIMRUNTIME/macros/matchit.vim 88 | < 89 | And copy ftplugin/matlab.vim to your $HOME/vimfiles/ftplugin directory 90 | 91 | - Correct indentation 92 | In your vimrc file, add the following lines : > 93 | source $VIMRUNTIME/macros/matchit.vim 94 | filetype indent on 95 | < 96 | And copy indent/matlab.vim to your $HOME/vimfiles/indent directory 97 | 98 | - Integration of the mlint Matlab code checker with the :make command 99 | 100 | Add the following line to your vimrc file : > 101 | autocmd BufEnter *.m compiler mlint 102 | < 103 | And copy compiler/mlint.vim to your $HOME/vimfiles/compiler directory 104 | 105 | - Tag support 106 | 107 | Copy the .ctags to your $HOME directory. And then run the 108 | command to create your tags file : for example : > 109 | ctags -R * 110 | 111 | 112 | -------------------------------------------------------------------------------- /indent/matlab.vim: -------------------------------------------------------------------------------- 1 | " Matlab indent file 2 | " Language: Matlab 3 | " Maintainer: Fabrice Guy 4 | " Last Change: 2009 Nov 23 - Added support for if/end block on the same line 5 | 6 | " Only load this indent file when no other was loaded. 7 | if exists("b:did_indent") 8 | finish 9 | endif 10 | let b:did_indent = 1 11 | let s:functionWithoutEndStatement = 0 12 | 13 | setlocal indentexpr=GetMatlabIndent() 14 | setlocal indentkeys=!,o,O=end,=case,=else,=elseif,=otherwise,=catch 15 | 16 | " Only define the function once. 17 | if exists("*GetMatlabIndent") 18 | finish 19 | endif 20 | 21 | function! s:IsMatlabContinuationLine(lnum) 22 | let continuationLine = 0 23 | if a:lnum > 0 24 | let pnbline = getline(prevnonblank(a:lnum)) 25 | " if we have the line continuation operator (... at the end of a line or 26 | " ... followed by a comment) it may be a line continuation 27 | if pnbline =~ '\.\.\.\s*$' || pnbline =~ '\.\.\.\s*%.*$' 28 | let continuationLine = 1 29 | " but if the ... are part of a string or a comment, it is not a 30 | " continuation line 31 | let col = match(pnbline, '\.\.\.\s*$') 32 | if col == -1 33 | let col = match(pnbline, '\.\.\.\s*%.*$') 34 | endif 35 | if has('syntax_items') 36 | if synIDattr(synID(prevnonblank(a:lnum), col + 1, 1), "name") =~ "matlabString" || 37 | \ synIDattr(synID(prevnonblank(a:lnum), col + 1, 1), "name") =~ "matlabComment" 38 | let continuationLine = 0 39 | endif 40 | endif 41 | endif 42 | endif 43 | return continuationLine 44 | endfunction 45 | 46 | function GetMatlabIndent() 47 | " Find a non-blank line above the current line. 48 | let plnum = prevnonblank(v:lnum - 1) 49 | 50 | " If the previous line is a continuation line, get the beginning of the block to 51 | " use the indent of that line 52 | if s:IsMatlabContinuationLine(plnum - 1) 53 | while s:IsMatlabContinuationLine(plnum - 1) 54 | let plnum = plnum - 1 55 | endwhile 56 | endif 57 | 58 | " At the start of the file use zero indent. 59 | if plnum == 0 60 | return 0 61 | endif 62 | 63 | let curind = indent(plnum) 64 | if s:IsMatlabContinuationLine(v:lnum - 1) 65 | let curind = curind + &sw 66 | endif 67 | " Add a 'shiftwidth' after classdef, properties, switch, methods, events, 68 | " function, if, while, for, otherwise, case, try, catch, else, elseif 69 | if getline(plnum) =~ '^\s*\(classdef\|properties\|switch\|methods\|events\|function\|if\|while\|for\|otherwise\|case\|try\|catch\|else\|elseif\)\>' 70 | let curind = curind + &sw 71 | " In Matlab we have different kind of functions 72 | " - the main function (the function with the same name than the filename) 73 | " - the nested functions 74 | " - the functions defined in methods (for classes) 75 | " - subfunctions 76 | " Principles for the indentation : 77 | " - all the function keywords are indented (corresponding to the 78 | " 'indent all functions' in the Matlab Editor) 79 | " - if we have only subfonctions (ie if the main function doesn't have 80 | " any mayching end), then each function is dedented 81 | if getline(plnum) =~ '^\s*\function\>' 82 | let pplnum = plnum - 1 83 | while pplnum > 1 && (getline(pplnum) =~ '^\s*%') 84 | let pplnum = pplnum - 1 85 | endwhile 86 | " If it is the main function, determine if function has a matching end 87 | " or not 88 | if pplnum <= 1 89 | " look for a matching end : 90 | " - if we find a matching end everything is fine : end of functions 91 | " will be dedented when 'end' is reached 92 | " - if not, then all other functions are subfunctions : 'function' 93 | " keyword has to be dedended 94 | let old_lnum = v:lnum 95 | let motion = plnum . "gg" 96 | execute "normal" . motion 97 | normal % 98 | if getline(line('.')) =~ '^\s*end' 99 | let s:functionWithoutEndStatement = 0 100 | else 101 | let s:functionWithoutEndStatement = 1 102 | endif 103 | normal % 104 | let motion = old_lnum . "gg" 105 | execute "normal" . motion 106 | endif 107 | endif 108 | " if the for-end block (or while-end) is on the same line : dedent 109 | if getline(plnum) =~ '\' 116 | let curind = curind - &sw 117 | endif 118 | " No indentation in a subfunction 119 | if getline(v:lnum) =~ '^\s*\function\>' && s:functionWithoutEndStatement 120 | let curind = curind - &sw 121 | endif 122 | " First case after a switch : indent 123 | if getline(v:lnum) =~ '^\s*case' 124 | while plnum > 0 && (getline(plnum) =~ '^\s*%' || getline(plnum) =~ '^\s*$') 125 | let plnum = plnum - 1 126 | endwhile 127 | if getline(plnum) =~ '^\s*switch' 128 | let curind = indent(plnum) + &sw 129 | endif 130 | endif 131 | 132 | " end in a switch / end block : dedent twice 133 | " we use the matchit script to know if this end is the end of a switch block 134 | if exists("b:match_words") 135 | if getline(v:lnum) =~ '^\s*end' 136 | normal % 137 | if getline(line('.')) =~ '^\s*switch' 138 | let curind = curind - &sw 139 | endif 140 | normal % 141 | end 142 | end 143 | return curind 144 | endfunction 145 | 146 | " vim:sw=2 147 | -------------------------------------------------------------------------------- /syntax/matlab.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " Language: Matlab 3 | " Maintainer: Fabrice Guy 4 | " Original authors: Mario Eusebio and Preben Guldberg 5 | " Last Change: 2008 Oct 16 : added try/catch/rethrow and class statements 6 | " 2008 Oct 28 : added highlighting for most of Matlab functions 7 | " 2009 Nov 23 : added 'todo' keyword in the matlabTodo keywords 8 | " (for doxygen support) 9 | 10 | " For version 5.x: Clear all syntax items 11 | " For version 6.x: Quit when a syntax file was already loaded 12 | if version < 600 13 | syntax clear 14 | elseif exists("b:current_syntax") 15 | finish 16 | endif 17 | 18 | syn keyword matlabStatement return function 19 | syn keyword matlabConditional switch case else elseif end if otherwise break continue 20 | syn keyword matlabRepeat do for while 21 | syn keyword matlabStorageClass classdef methods properties events persistent global 22 | syn keyword matlabExceptions try catch rethrow throw 23 | 24 | syn keyword matlabTodo contained TODO NOTE FIXME XXX 25 | syn keyword matlabImport import 26 | " If you do not want these operators lit, uncommment them and the "hi link" below 27 | syn match matlabRelationalOperator "\(==\|\~=\|>=\|<=\|=\~\|>\|<\|=\)" 28 | syn match matlabArithmeticOperator "[-+]" 29 | syn match matlabArithmeticOperator "\.\=[*/\\^]" 30 | syn match matlabLogicalOperator "[&|~]" 31 | syn keyword matlabBoolean true false 32 | 33 | syn match matlabLineContinuation "\.\{3}" 34 | 35 | " String 36 | syn region matlabString start=+'+ end=+'+ oneline 37 | 38 | " If you don't like tabs 39 | syn match matlabTab "\t" 40 | 41 | " Standard numbers 42 | syn match matlabNumber "\<\d\+[ij]\=\>" 43 | " floating point number, with dot, optional exponent 44 | syn match matlabFloat "\<\d\+\(\.\d*\)\=\([edED][-+]\=\d\+\)\=[ij]\=\>" 45 | " floating point number, starting with a dot, optional exponent 46 | syn match matlabFloat "\.\d\+\([edED][-+]\=\d\+\)\=[ij]\=\>" 47 | syn keyword matlabConstant eps Inf NaN pi 48 | 49 | 50 | " Transpose character and delimiters: Either use just [...] or (...) aswell 51 | syn match matlabDelimiter "[][]" 52 | "syn match matlabDelimiter "[][()]" 53 | syn match matlabTransposeOperator "[])a-zA-Z0-9.]'"lc=1 54 | 55 | syn match matlabSemicolon ";" 56 | 57 | syn match matlabComment "%.*$" contains=matlabTodo,matlabTab 58 | syn region matlabBlockComment start=+%{+ end=+%}+ contains=matlabBlockComment 59 | 60 | 61 | " trigonometric 62 | syn keyword matlabFunc acos acosd acosh acot acotd acoth acsc acscd acsch asec asecd asech asin asind asinh 63 | syn keyword matlabFunc atan atan2 atand atanh cos cosd cosh cot cotd coth csc cscd csch hypot sec secd 64 | syn keyword matlabFunc sech sin sind sinh tan tand tanh 65 | " exponential 66 | syn keyword matlabFunc exp expm1 log log10 log1p log2 nextpow2 nthroot pow2 reallog realpow realsqrt sqrt 67 | " Complex 68 | syn keyword matlabFunc abs angle complex conj cplxpair imag real sign unwrap 69 | " Rounding and Remainder 70 | syn keyword matlabFunc ceil fix floor idivide mod rem round 71 | "Discrete Math (e.g., Prime Factors) 72 | syn keyword matlabFunc factor factorial gcd isprime lcm nchoosek perms primes rat rats 73 | "Polynomials 74 | syn keyword matlabFunc conv deconv poly polyder polyeig polyfit polyint polyval polyvalm residue roots 75 | "Numeric Types 76 | 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 77 | "Characters and Strings 78 | syn keyword matlabFunc cellstr char eval findstr isstr regexp sprintf sscanf strcat strcmp strcmpi strings strjust strmatch strread strrep strtrim strvcat 79 | "Structures 80 | syn keyword matlabFunc cell2struct deal fieldnames getfield isfield isstruct orderfields rmfield setfield struct struct2cell structfun 81 | "Cell Arrays 82 | syn keyword matlabFunc cell cell2mat celldisp cellfun cellplot iscell iscellstr mat2cell num2cell 83 | "Function Handles 84 | syn keyword matlabFunc feval func2str functions str2func 85 | "Java Classes and Objects 86 | syn keyword matlabFunc clear depfun exist im2java inmem javaaddpath javaArray javachk Generate javaclasspath javaMethod javaObject javarmpath methodsview usejava which 87 | "Data Type Identification 88 | syn keyword matlabFunc ischar isfloat isinteger isjava islogical isobject validateattributes who whos 89 | "Data type conversion 90 | "Numeric 91 | syn keyword matlabFunc double int8 int16 int32 int64 single typecast uint8 uint16 uint32 uint64 92 | "String to Numeric 93 | syn keyword matlabFunc base2dec bin2dec hex2dec hex2num str2double str2num unicode2native 94 | "Numeric to String 95 | syn keyword matlabFunc dec2base dec2bin dec2hex int2str mat2str native2unicode num2str 96 | "Other Conversions 97 | syn keyword matlabFunc datestr logical num2hex str2mat 98 | "String Creation 99 | syn keyword matlabFunc blanks 100 | "String Identification 101 | syn keyword matlabFunc isletter isspace isstrprop validatestring 102 | "String Manipulation 103 | syn keyword matlabFunc deblank lower upper 104 | "String Parsing 105 | syn keyword matlabFunc regexpi regexprep regexptranslate strfind strtok 106 | "String Evaluation 107 | syn keyword matlabFunc evalc evalin 108 | "String Comparison 109 | syn keyword matlabFunc strncmp strncmpi 110 | "Bit-wise Functions 111 | syn keyword matlabFunc bitand bitcmp bitget bitmax bitor bitset bitshift bitxor swapbytes 112 | "Logical Functions 113 | syn keyword matlabFunc all and any iskeyword isvarname not or xor 114 | "Predefined Dialog Boxes 115 | syn keyword matlabFunc dialog errordlg export2wsdlg helpdlg inputdlg listdlg msgbox printdlg printpreview questdlg uigetdir uigetfile uigetpref uiopen uiputfile uisave uisetcolor uisetfont waitbar warndlg 116 | "Deploying User Interfaces 117 | syn keyword matlabFunc guidata guihandles movegui openfig 118 | "Developing User Interfaces 119 | syn keyword matlabFunc addpref getappdata getpref ginput guide inspect isappdata ispref rmappdata rmpref setappdata setpref uisetpref waitfor waitforbuttonpress 120 | "User Interface Objects 121 | syn keyword matlabFunc uibuttongroup uicontextmenu uicontrol uimenu uipanel uipushtool uitoggletool uitoolbar menu 122 | "Finding Objects from Callbacks 123 | syn keyword matlabFunc findall findfigs findobj gcbf gcbo 124 | "GUI Utility Functions 125 | syn keyword matlabFunc align getpixelposition listfonts selectmoveresize setpixelposition textwrap uistack 126 | "Controlling Program Execution 127 | syn keyword matlabFunc uiresume uiwait 128 | "Basic Plots and Graphs 129 | syn keyword matlabFunc box errorbar hold loglog plot plot3 plotyy polar semilogx semilogy subplot 130 | "Plotting Tools 131 | syn keyword matlabFunc figurepalette pan plotbrowser plotedit plottools propertyeditor rotate3d showplottool zoom 132 | 133 | "Annotating Plots 134 | syn keyword matlabFunc annotation clabel datacursormode datetick gtext legend line rectangle texlabel title xlabel ylabel zlabel 135 | "Area, Bar, and Pie Plots 136 | syn keyword matlabFunc area bar barh bar3 bar3h pareto pie pie3 137 | "Contour Plots 138 | syn keyword matlabFunc contour contour3 contourc contourf ezcontour ezcontourf 139 | "Direction and Velocity Plots 140 | syn keyword matlabFunc comet comet3 compass feather quiver quiver3 141 | "Discrete Data Plots 142 | syn keyword matlabFunc stairs stem stem3 143 | "Function Plots 144 | syn keyword matlabFunc ezmesh ezmeshc ezplot ezplot3 ezpolar ezsurf ezsurfc fplot 145 | "Histograms 146 | syn keyword matlabFunc hist histc rose 147 | "Polygons and Surfaces 148 | syn keyword matlabFunc convhull cylinder delaunay delaunay3 delaunayn dsearch dsearchn ellipsoid fill fill3 inpolygon pcolor polyarea rectint ribbon slice sphere tsearch tsearchn voronoi waterfall 149 | "Scatter/Bubble Plots 150 | syn keyword matlabFunc plotmatrix scatter scatter3 151 | "Animation 152 | syn keyword matlabFunc getframe im2frame movie noanimate 153 | "Bit-Mapped Images 154 | syn keyword matlabFunc frame2im image imagesc imfinfo imformats imread imwrite ind2rgb 155 | "Printing 156 | syn keyword matlabFunc frameedit hgexport orient print printopt saveas 157 | "Handle Graphics 158 | syn keyword matlabFunc allchild ancestor copyobj delete gca gco get ishandle propedit set 159 | "Object 160 | syn keyword matlabFunc axes figure hggroup hgtransform light patch 161 | "root object 162 | syn keyword matlabFunc surface text 163 | "Plot Objects 164 | syn keyword matlabFunc clf close closereq drawnow gcf hgload hgsave newplot opengl refresh 165 | "Axes Operations 166 | syn keyword matlabFunc axis cla grid ishold makehgtform 167 | "Operating on Object Properties 168 | syn keyword matlabFunc linkaxes linkprop refreshdata 169 | "Data analysis 170 | "Basic Operations 171 | syn keyword matlabFunc brush cumprod cumsum linkdata prod sort sortrows sum 172 | "Descriptive Statistics 173 | syn keyword matlabFunc corrcoef cov max mean median min mode std var 174 | "Filtering and Convolution 175 | syn keyword matlabFunc conv2 convn detrend filter filter2 176 | "Interpolation and Regression 177 | syn keyword matlabFunc interp1 interp2 interp3 interpn mldivide mrdivide 178 | "Fourier Transforms 179 | syn keyword matlabFunc fft fft2 fftn fftshift fftw ifft ifft2 ifftn ifftshift 180 | "Derivatives and Integrals 181 | syn keyword matlabFunc cumtrapz del2 diff gradient trapz 182 | "File Operations 183 | syn keyword matlabFunc cd copyfile dir fileattrib filebrowser isdir lookfor ls matlabroot mkdir movefile pwd recycle rehash rmdir toolboxdir type what 184 | "Operating System Interface 185 | syn keyword matlabFunc clipboard computer dos getenv hostid maxNumCompThreads perl setenv system unix winqueryreg 186 | "MATLAB Version and License 187 | syn keyword matlabFunc ismac ispc isstudent isunix javachk license prefdir usejava ver verLessThan version 188 | "Basic Information 189 | syn keyword matlabFunc disp display isempty issparse length ndims numel size 190 | "Elementary Matrices and Arrays 191 | syn keyword matlabFunc blkdiag diag eye freqspace ind2sub linspace logspace meshgrid ndgrid ones rand randn sub2ind 192 | "Array Operations 193 | syn keyword matlabFunc accumarray bsxfun cross dot kron tril triu 194 | "Array Manipulation 195 | syn keyword matlabFunc circshift flipdim fliplr flipud horzcat inline repmat rot90 shiftdim vectorize vertcat 196 | "Specialized Matrices 197 | syn keyword matlabFunc compan gallery hadamard hankel hilb invhilb magic pascal rosser toeplitz vander wilkinson 198 | "Matrix Analysis 199 | syn keyword matlabFunc cond condeig det norm normest null orth rank rcond rref subspace trace 200 | "Linear Equations 201 | syn keyword matlabFunc chol cholinc condest funm ilu inv linsolve lscov lsqnonneg lu luinc pinv qr 202 | "Eigenvalues and Singular Values 203 | syn keyword matlabFunc balance cdf2rdf eig eigs gsvd hess ordeig ordqz ordschur rsf2csf schur sqrtm ss2tf svd svds 204 | "Matrix Logarithms and Exponentials 205 | syn keyword matlabFunc expm logm 206 | "Factorization 207 | syn keyword matlabFunc cholupdate planerot qrdelete qrinsert qrupdate qz 208 | "Interpolation 209 | syn keyword matlabFunc griddata griddata3 griddatan interp1q interpft mkpp padecoef pchip ppval spline unmkpp 210 | "Delaunay Triangulation and Tessellation 211 | syn keyword matlabFunc tetramesh trimesh triplot trisurf 212 | "Convex Hull 213 | syn keyword matlabFunc convhulln 214 | "Voronoi Diagrams 215 | syn keyword matlabFunc voronoin 216 | "Cartesian Coordinate System Conversion 217 | syn keyword matlabFunc cart2pol cart2sph pol2cart sph2cart 218 | "Ordinary Differential Equations (IVP) 219 | syn keyword matlabFunc decic deval ode15i ode23 ode45 ode113 ode15s ode23s ode23t ode23tb odefile odeget odeset odextend 220 | "Delay Differential Equations 221 | syn keyword matlabFunc dde23 ddeget ddesd ddeset 222 | "Boundary Value Problems 223 | syn keyword matlabFunc bvp4c bvp5c bvpget bvpinit bvpset bvpxtend 224 | "Partial Differential Equations 225 | syn keyword matlabFunc pdepe pdeval 226 | "Optimization 227 | syn keyword matlabFunc fminbnd fminsearch fzero optimget optimset 228 | "Numerical Integration (Quadrature) 229 | syn keyword matlabFunc dblquad quad quadgk quadl quadv triplequad 230 | "Specialized Math 231 | 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 232 | "Elementary Sparse Matrices 233 | syn keyword matlabFunc spdiags speye sprand sprandn sprandsym 234 | "Full to Sparse Conversion 235 | syn keyword matlabFunc full sparse spconvert 236 | "Working with Sparse Matrices 237 | syn keyword matlabFunc nnz nonzeros nzmax spalloc spfun spones spparms spy 238 | "Reordering Algorithms 239 | syn keyword matlabFunc amd colamd colperm dmperm ldl randperm symamd symrcm 240 | "Linear Algebra 241 | syn keyword matlabFunc spaugment sprank 242 | "Linear Equations (Iterative Methods) 243 | syn keyword matlabFunc bicg bicgstab cgs gmres lsqr minres pcg qmr symmlq 244 | "Tree Operations 245 | syn keyword matlabFunc etree etreeplot gplot symbfact treelayout treeplot 246 | "Timeseries 247 | "General Purpose 248 | syn keyword matlabFunc getdatasamplesize getqualitydesc timeseries tsprops tstool 249 | "Data Manipulation 250 | syn keyword matlabFunc addsample ctranspose delsample getabstime getinterpmethod getsampleusingtime idealfilter resample setabstime setinterpmethod synchronize transpose 251 | "Event Data 252 | syn keyword matlabFunc addevent delevent gettsafteratevent gettsafterevent gettsatevent gettsbeforeatevent gettsbeforeevent gettsbetweenevents 253 | "Descriptive Statistics 254 | syn keyword matlabFunc iqr 255 | 256 | "Time Series Collections 257 | "General Purpose 258 | syn keyword matlabFunc tscollection 259 | "Data Manipulation 260 | syn keyword matlabFunc addsampletocollection addts delsamplefromcollection gettimeseriesnames removets settimeseriesnames 261 | "Set Functions 262 | syn keyword matlabFunc intersect ismember issorted setdiff setxor union unique 263 | "Date and Time Functions 264 | syn keyword matlabFunc addtodate calendar clock cputime date datenum datevec eomday etime now weekday 265 | "M-File Functions and Scripts 266 | syn keyword matlabFunc addOptional addParamValue addRequired createCopy depdir echo input inputname inputParser mfilename namelengthmax nargchk nargin nargout nargoutchk parse pcode 267 | "script Script M-file description 268 | syn keyword matlabFunc varargin varargout 269 | "Evaluation of Expressions and Functions 270 | syn keyword matlabFunc ans assert builtin pause run script symvar 271 | "Timer Functions 272 | syn keyword matlabFunc isvalid start startat stop timer timerfind timerfindall wait 273 | "Variables and Functions in Memory 274 | syn keyword matlabFunc assignin datatipinfo genvarname isglobal memory mislocked mlock munlock pack 275 | "Control Flow 276 | syn keyword matlabFunc parfor 277 | "Error Handling 278 | syn keyword matlabFunc addCause error ferror getReport last lasterr lasterror lastwarn warning 279 | "Classes and Objects 280 | syn keyword matlabFunc addlistener addprop dynamicprops 281 | "events Display class event names 282 | syn keyword matlabFunc findprop getdisp handle hgsetget inferiorto loadobj metaclass notify saveobj setdisp subsasgn subsindex subsref substruct superiorto 283 | "File Name Construction 284 | syn keyword matlabFunc filemarker fileparts filesep fullfile tempdir tempname 285 | "Opening, Loading, Saving Files 286 | syn keyword matlabFunc daqread filehandle importdata load open save uiimport winopen 287 | "Memory Mapping 288 | syn keyword matlabFunc memmapfile 289 | "Low-Level File I/O 290 | syn keyword matlabFunc fclose feof fgetl fgets fopen fprintf fread frewind fscanf fseek ftell fwrite 291 | 292 | "Text Files 293 | syn keyword matlabFunc csvread csvwrite dlmread dlmwrite textread textscan 294 | "XML Documents 295 | syn keyword matlabFunc xmlread xmlwrite xslt 296 | "Microsoft Excel Functions 297 | syn keyword matlabFunc xlsfinfo xlsread xlswrite 298 | "Lotus 1-2-3 Functions 299 | syn keyword matlabFunc wk1finfo wk1read wk1write 300 | "Common Data Format (CDF) 301 | syn keyword matlabFunc cdfepoch cdfinfo cdfread cdfwrite todatenum 302 | "Flexible Image Transport System 303 | syn keyword matlabFunc fitsinfo fitsread 304 | "Hierarchical Data Format (HDF) 305 | syn keyword matlabFunc hdf hdf5 hdf5info hdf5read hdf5write hdfinfo hdfread hdftool 306 | "Band-Interleaved Data 307 | syn keyword matlabFunc multibandread multibandwrite 308 | 309 | 310 | " Define the default highlighting. 311 | " For version 5.7 and earlier: only when not done already 312 | " For version 5.8 and later: only when an item doesn't have highlighting yet 313 | if version >= 508 || !exists("did_matlab_syntax_inits") 314 | if version < 508 315 | let did_matlab_syntax_inits = 1 316 | command -nargs=+ HiLink hi link 317 | else 318 | command -nargs=+ HiLink hi def link 319 | endif 320 | 321 | HiLink matlabTransposeOperator matlabOperator 322 | HiLink matlabLineContinuation Special 323 | HiLink matlabLabel Label 324 | HiLink matlabConditional Conditional 325 | HiLink matlabRepeat Repeat 326 | HiLink matlabTodo Todo 327 | HiLink matlabString String 328 | HiLink matlabDelimiter Identifier 329 | HiLink matlabTransposeOther Identifier 330 | HiLink matlabNumber Number 331 | HiLink matlabFloat Float 332 | HiLink matlabConstant Constant 333 | HiLink matlabImplicit matlabStatement 334 | HiLink matlabStatement Statement 335 | HiLink matlabSemicolon SpecialChar 336 | HiLink matlabComment Comment 337 | HiLink matlabBlockComment Comment 338 | HiLink matlabImport Include 339 | HiLink matlabBoolean Boolean 340 | HiLink matlabStorageClass StorageClass 341 | 342 | HiLink matlabArithmeticOperator matlabOperator 343 | HiLink matlabRelationalOperator matlabOperator 344 | HiLink matlabLogicalOperator matlabOperator 345 | HiLink matlabOperator Operator 346 | HiLink matlabExceptions Exception 347 | HiLink matlabFunc Function 348 | 349 | "optional highlighting 350 | "HiLink matlabIdentifier Identifier 351 | "HiLink matlabTab Error 352 | delcommand HiLink 353 | endif 354 | 355 | let b:current_syntax = "matlab" 356 | 357 | "EOF vim: ts=8 noet tw=100 sw=8 sts=0 358 | --------------------------------------------------------------------------------