📄 dosbatch.vim
字号:
" Vim syntax file" Language: MSDOS batch file (with NT command extensions)" Maintainer: Mike Williams <mrw@netcomuk.co.uk>" Filenames: *.bat" Last Change: 14th May 1999" Web Page: N/A" For version 5.x: Clear all syntax items" For version 6.x: Quit when a syntax file was already loadedif version < 600 syntax clearelseif exists("b:current_syntax") finishendif" DOS bat files are case insensitive but case preserving!syn case ignoresyn keyword dosbatchTodo contained TODO" Dosbat keywordssyn keyword dosbatchStatement goto call exitsyn keyword dosbatchConditional if elsesyn keyword dosbatchRepeat for" Some operators - first lot are case sensitive!syn case matchsyn keyword dosbatchOperator EQU NEQ LSS LEQ GTR GEQsyn case ignoresyn match dosbatchOperator "\s[-+\*/%]\s"syn match dosbatchOperator "="syn match dosbatchOperator "[-+\*/%]="syn match dosbatchOperator "\s\(&\||\|^\|<<\|>>\)=\=\s"syn match dosbatchIfOperator "if\s\+\(\(not\)\=\s\+\)\=\(exist\|defined\|errorlevel\|cmdextversion\)\="lc=2" String - using "'s is a convenience rather than a requirement outside of FORsyn match dosbatchString "\"[^"]*\"" contains=dosbatchVariable,dosBatchArgument,@dosbatchNumbersyn match dosbatchString "\<echo[^)>|]*"lc=4 contains=dosbatchVariable,dosbatchArgument,@dosbatchNumbersyn match dosbatchEchoOperator "\<echo\s\+\(on\|off\)\s*$"lc=4" For embedded commandssyn match dosbatchCmd "(\s*'[^']*'"lc=1 contains=dosbatchString,dosbatchVariable,dosBatchArgument,@dosbatchNumber,dosbatchImplicit,dosbatchStatement,dosbatchConditional,dosbatchRepeat,dosbatchOperator" Numbers - surround with ws to not include in dir and filenamessyn match dosbatchInteger "[[:space:]=(/:]\d\+"lc=1syn match dosbatchHex "[[:space:]=(/:]0x\x\+"lc=1syn match dosbatchBinary "[[:space:]=(/:]0b[01]\+"lc=1syn match dosbatchOctal "[[:space:]=(/:]0\o\+"lc=1syn cluster dosbatchNumber contains=dosbatchInteger,dosbatchHex,dosbatchBinary,dosbatchOctal" Command line switchessyn match dosbatchSwitch "/\(\a\+\|?\)"" Various special escaped char formatssyn match dosbatchSpecialChar "\^[&|()<>^]"syn match dosbatchSpecialChar "\$[a-hl-npqstv_$+]"syn match dosbatchSpecialChar "%%"" Environment variablessyn match dosbatchIdentifier contained "\s\h\w*\>"syn match dosbatchVariable "%\h\w*%"syn match dosbatchVariable "%\h\w*:\*\=[^=]*=[^%]*%"syn match dosbatchVariable "%\h\w*:\~\d\+,\d\+%" contains=dosbatchIntegersyn match dosbatchSet "\s\h\w*[+-]\==\{-1}" contains=dosbatchIdentifier,dosbatchOperator" Args to bat files and for loops, etcsyn match dosbatchArgument "%\(\d\|\*\)"syn match dosbatchArgument "%%[a-z]\>"syn match dosbatchArgument "%\~[fdpnxs]\+\(\($PATH:\)\=[a-z]\|\d\)\>"" Line labelssyn match dosbatchLabel "^\s*:\s*\h\w*\>"syn match dosbatchLabel "\<\(goto\|call\)\s\+:\h\w*\>"lc=4syn match dosbatchLabel "\<goto\s\+\h\w*\>"lc=4syn match dosbatchLabel ":\h\w*\>"" Comments - usual rem but also two colons as first non-space is an idiomsyn match dosbatchComment "^rem\($\|\s.*$\)"lc=3 contains=dosbatchTodo,@dosbatchNumber,dosbatchVariable,dosbatchArgumentsyn match dosbatchComment "\srem\($\|\s.*$\)"lc=4 contains=dosbatchTodo,@dosbatchNumber,dosbatchVariable,dosbatchArgumentsyn match dosbatchComment "\s*:\s*:.*$" contains=dosbatchTodo,@dosbatchNumber,dosbatchVariable,dosbatchArgument" Comments in ()'s - still to handle spaces before remsyn match dosbatchComment "(rem[^)]*"lc=4 contains=dosbatchTodo,@dosbatchNumber,dosbatchVariable,dosbatchArgumentsyn keyword dosbatchImplicit append assoc at attrib break cacls cd chcp chdirsyn keyword dosbatchImplicit chkdsk cls cmd color comp compact convert copysyn keyword dosbatchImplicit date del dir diskcomp diskcopy doskey echo endlocalsyn keyword dosbatchImplicit erase fc find findstr format ftypesyn keyword dosbatchImplicit graftabl help keyb label md mkdir mode more movesyn keyword dosbatchImplicit path pause popd print prompt pushd rd recover remsyn keyword dosbatchImplicit ren rename replace restore rmdir set setlocal shiftsyn keyword dosbatchImplicit sort start subst time title tree type ver verifysyn keyword dosbatchImplicit vol xcopy" 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 yetif version >= 508 || !exists("did_dosbatch_syntax_inits") if version < 508 let did_dosbatch_syntax_inits = 1 command -nargs=+ HiLink hi link <args> else command -nargs=+ HiLink hi def link <args> endif HiLink dosbatchTodo Todo HiLink dosbatchStatement Statement HiLink dosbatchCommands dosbatchStatement HiLink dosbatchLabel Label HiLink dosbatchConditional Conditional HiLink dosbatchRepeat Repeat HiLink dosbatchOperator Operator HiLink dosbatchEchoOperator dosbatchOperator HiLink dosbatchIfOperator dosbatchOperator HiLink dosbatchArgument Identifier HiLink dosbatchIdentifier Identifier HiLink dosbatchVariable dosbatchIdentifier HiLink dosbatchSpecialChar SpecialChar HiLink dosbatchString String HiLink dosbatchNumber Number HiLink dosbatchInteger dosbatchNumber HiLink dosbatchHex dosbatchNumber HiLink dosbatchBinary dosbatchNumber HiLink dosbatchOctal dosbatchNumber HiLink dosbatchComment Comment HiLink dosbatchImplicit Function HiLink dosbatchSwitch Special HiLink dosbatchCmd PreProc delcommand HiLinkendiflet b:current_syntax = "dosbatch"" vim: ts=8
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -