neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

matlab.vim (4316B)


      1 " Vim syntax file
      2 " Language:	Matlab
      3 " Maintainer:	Alex Burka <vim@alexburka.com>
      4 " Credits:	Preben 'Peppe' Guldberg <peppe-vim@wielders.org>
      5 "		Maurizio Tranchero - maurizio(.)tranchero(@)gmail(.)com
      6 "		Original author: Mario Eusebio
      7 " Last Change:	June 10 2019
      8 " 		added highlight rule for double-quoted string literals
      9 " Change History:
     10 "               - double-quoted string literals added
     11 " 		- now highlights cell-mode separator comments
     12 " 		- 'global' and 'persistent' keyword are now recognized
     13 
     14 " quit when a syntax file was already loaded
     15 if exists("b:current_syntax")
     16  finish
     17 endif
     18 
     19 syn keyword matlabStatement		return
     20 syn keyword matlabLabel			case switch
     21 syn keyword matlabConditional		else elseif end if otherwise
     22 syn keyword matlabRepeat		do for while
     23 " MT_ADDON - added exception-specific keywords
     24 syn keyword matlabExceptions		try catch
     25 syn keyword matlabOO			classdef properties events methods
     26 
     27 syn keyword matlabTodo			contained  TODO
     28 syn keyword matlabScope			global persistent
     29 
     30 " If you do not want these operators lit, uncommment them and the "hi link" below
     31 syn match matlabArithmeticOperator	"[-+]"
     32 syn match matlabArithmeticOperator	"\.\=[*/\\^]"
     33 syn match matlabRelationalOperator	"[=~]="
     34 syn match matlabRelationalOperator	"[<>]=\="
     35 syn match matlabLogicalOperator		"[&|~]"
     36 
     37 syn match matlabLineContinuation	"\.\{3}"
     38 
     39 "syn match matlabIdentifier		"\<\a\w*\>"
     40 
     41 " String
     42 " MT_ADDON - added 'skip' in order to deal with 'tic' escaping sequence 
     43 syn region matlabString			start=+'+ end=+'+	oneline skip=+''+
     44 syn region matlabStringArray		start=+"+ end=+"+	oneline skip=+""+
     45 
     46 " If you don't like tabs
     47 syn match matlabTab			"\t"
     48 
     49 " Standard numbers
     50 syn match matlabNumber		"\<\d\+[ij]\=\>"
     51 " floating point number, with dot, optional exponent
     52 syn match matlabFloat		"\<\d\+\(\.\d*\)\=\([edED][-+]\=\d\+\)\=[ij]\=\>"
     53 " floating point number, starting with a dot, optional exponent
     54 syn match matlabFloat		"\.\d\+\([edED][-+]\=\d\+\)\=[ij]\=\>"
     55 
     56 " Transpose character and delimiters: Either use just [...] or (...) aswell
     57 syn match matlabDelimiter		"[][]"
     58 "syn match matlabDelimiter		"[][()]"
     59 syn match matlabTransposeOperator	"[])a-zA-Z0-9.]'"lc=1
     60 
     61 syn match matlabSemicolon		";"
     62 
     63 syn match matlabComment			"%.*$"	contains=matlabTodo,matlabTab
     64 " MT_ADDON - correctly highlights words after '...' as comments
     65 syn match matlabComment			"\.\.\..*$"	contains=matlabTodo,matlabTab
     66 syn region matlabMultilineComment	start=+%{+ end=+%}+ contains=matlabTodo,matlabTab
     67 syn match matlabCellComment     "^%%.*$"
     68 
     69 syn keyword matlabOperator		break zeros default margin round ones rand
     70 syn keyword matlabOperator		ceil floor size clear zeros eye mean std cov
     71 
     72 syn keyword matlabFunction		error eval function
     73 
     74 syn keyword matlabImplicit		abs acos atan asin cos cosh exp log prod sum
     75 syn keyword matlabImplicit		log10 max min sign sin sinh sqrt tan reshape
     76 
     77 syn match matlabError	"-\=\<\d\+\.\d\+\.[^*/\\^]"
     78 syn match matlabError	"-\=\<\d\+\.\d\+[eEdD][-+]\=\d\+\.\([^*/\\^]\)"
     79 
     80 " Define the default highlighting.
     81 " Only when an item doesn't have highlighting yet
     82 
     83 hi def link matlabTransposeOperator	matlabOperator
     84 hi def link matlabOperator			Operator
     85 hi def link matlabLineContinuation		Special
     86 hi def link matlabLabel			Label
     87 hi def link matlabConditional		Conditional
     88 hi def link matlabExceptions		Conditional
     89 hi def link matlabRepeat			Repeat
     90 hi def link matlabTodo			Todo
     91 hi def link matlabString			String
     92 hi def link matlabStringArray			String
     93 hi def link matlabDelimiter		Identifier
     94 hi def link matlabTransposeOther		Identifier
     95 hi def link matlabNumber			Number
     96 hi def link matlabFloat			Float
     97 hi def link matlabFunction			Function
     98 hi def link matlabError			Error
     99 hi def link matlabImplicit			matlabStatement
    100 hi def link matlabStatement		Statement
    101 hi def link matlabOO			Statement
    102 hi def link matlabSemicolon		SpecialChar
    103 hi def link matlabComment			Comment
    104 hi def link matlabMultilineComment		Comment
    105 hi def link matlabCellComment          Todo
    106 hi def link matlabScope			Type
    107 
    108 hi def link matlabArithmeticOperator	matlabOperator
    109 hi def link matlabRelationalOperator	matlabOperator
    110 hi def link matlabLogicalOperator		matlabOperator
    111 
    112 "optional highlighting
    113 "hi def link matlabIdentifier		Identifier
    114 "hi def link matlabTab			Error
    115 
    116 
    117 let b:current_syntax = "matlab"
    118 
    119 "EOF	vim: ts=8 noet tw=100 sw=8 sts=0