├── README.md ├── ftdetect └── rsc.vim └── syntax └── rsc.vim /README.md: -------------------------------------------------------------------------------- 1 | Vim RouterOS Syntax 2 | ============ 3 | 4 | This syntax file now comes with the official vim runtime (patch version >=8.2.3606). 5 | 6 | Note that the syntax changed the name from `rsc` to `routeros` during the move. 7 | 8 | ---------- 9 | Vim syntax highlighting plugin for Mikrotik scripts. 10 | Original author: ndbjorne @ [Mikrotik forums](http://forum.mikrotik.com/viewtopic.php?f=9&t=59761) 11 | -------------------------------------------------------------------------------- /ftdetect/rsc.vim: -------------------------------------------------------------------------------- 1 | au BufRead,BufNewFile *.rsc set filetype=rsc 2 | -------------------------------------------------------------------------------- /syntax/rsc.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " Language: RouterOS scripts 3 | " Maintainer: zainin 4 | " Last Change: 2017-07-26 5 | 6 | syntax clear 7 | if exists("b:current_syntax") 8 | if b:current_syntax =~ "rsc" 9 | finish 10 | else 11 | unlet b:current_syntax 12 | endif 13 | endif 14 | 15 | syn case ignore 16 | 17 | " set iskeyword=@,-,_,. 18 | set iskeyword=A-Z,a-z 19 | 20 | " comments 21 | syn match rscComment /^\s*#.*/ 22 | 23 | " options submenus: /interface ether1 etc 24 | syn match rscSubMenu "\([a-z]\)\@\=\!\~\^\&\.\,] " 49 | syn match rscOperator "[\<\>\!]=" 50 | syn match rscOperator "\(<<\|>>\)" 51 | syn match rscOperator "[\+\-]\(\d\)\@=" 52 | 53 | " commands 54 | syn keyword rscCommands beep delay put len typeof pick log time set find environment 55 | syn keyword rscCommands terminal error parse resolve toarray tobool toid toip toip6 56 | syn keyword rscCommands tonum tostr totime add remove enable disable set get print 57 | syn keyword rscCommands export edit find append as-value brief detail count-only file 58 | syn keyword rscCommands follow follow-only from interval terse value-list without-paging 59 | syn keyword rscCommands where 60 | 61 | " variable types 62 | syn keyword rscType global local 63 | 64 | " loop keywords 65 | syn keyword rscRepeat do while for foreach 66 | 67 | syn match rscSpecial "[():\[\]{|}]" 68 | 69 | syn region rscString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=rscSpecial 70 | 71 | 72 | "----------- 73 | 74 | "syn keyword rscConnState new related established invalid 75 | "syn keyword rscProtocol bgp ip ipsec ipv6 ldp ospf ospf-v3 ppp rip snmp tcp udp 76 | "syn keyword rscKeyword detail error file info led nothing password time 77 | 78 | 79 | " 80 | " *Comment any comment 81 | " 82 | " *Constant any constant 83 | " String a string constant: "this is a string" 84 | " Character a character constant: 'c', '\n' 85 | " Number a number constant: 234, 0xff 86 | " Boolean a boolean constant: TRUE, false 87 | " Float a floating point constant: 2.3e10 88 | " 89 | " *Identifier any variable name 90 | " Function function name (also: methods for classes) 91 | " 92 | " *Statement any statement 93 | " Conditional if, then, else, endif, switch, etc. 94 | " Repeat for, do, while, etc. 95 | " Label case, default, etc. 96 | " Operator "sizeof", "+", "*", etc. 97 | " Keyword any other keyword 98 | " Exception try, catch, throw 99 | " 100 | " *PreProc generic Preprocessor 101 | " Include preprocessor #include 102 | " Define preprocessor #define 103 | " Macro same as Define 104 | " PreCondit preprocessor #if, #else, #endif, etc. 105 | " 106 | " *Type int, long, char, etc. 107 | " StorageClass static, register, volatile, etc. 108 | " Structure struct, union, enum, etc. 109 | " Typedef A typedef 110 | " 111 | " *Special any special symbol 112 | " SpecialChar special character in a constant 113 | " Tag you can use CTRL-] on this 114 | " Delimiter character that needs attention 115 | " SpecialComment special things inside a comment 116 | " Debug debugging statements 117 | " 118 | " *Underlined text that stands out, HTML links 119 | " 120 | " *Ignore left blank, hidden |hl-Ignore| 121 | " 122 | " *Error any erroneous construct 123 | " 124 | " *Todo anything that needs extra attention; mostly the 125 | " keywords TODO FIXME and XXX 126 | " 127 | 128 | hi link rscComment Comment 129 | hi link rscSubMenu Function 130 | hi link rscVariable Identifier 131 | hi link rscDelimiter Operator 132 | hi link rscService Type 133 | hi link rscInterface Type 134 | hi link rscBoolean Boolean 135 | hi link rscConditional Conditional 136 | hi link rscOperator Operator 137 | hi link rscCommands Operator 138 | hi link rscType Type 139 | hi link rscRepeat Repeat 140 | hi link rscSpecial Delimiter 141 | "hi link rscConnState Underlined 142 | hi link rscString String 143 | 144 | "hi link rscKeyword Identifier 145 | "hi link rscProtocol Type 146 | 147 | " source :p:h/rsc.vim 148 | 149 | let b:current_syntax = "rsc" 150 | --------------------------------------------------------------------------------