From de0cad11b2ab8da93ae15c1461e197967754ce6b Mon Sep 17 00:00:00 2001 From: Max Wash Date: Thu, 7 May 2026 10:46:19 +0100 Subject: [PATCH] meta: add vim plugin for syntax highlighting --- bshell.vim/autoload/bshell.vim | 0 bshell.vim/ftdetect/bshell.vim | 1 + bshell.vim/ftplugin/bshell.vim | 4 ++ bshell.vim/syntax/bshell.vim | 126 +++++++++++++++++++++++++++++++++ 4 files changed, 131 insertions(+) create mode 100755 bshell.vim/autoload/bshell.vim create mode 100755 bshell.vim/ftdetect/bshell.vim create mode 100755 bshell.vim/ftplugin/bshell.vim create mode 100755 bshell.vim/syntax/bshell.vim diff --git a/bshell.vim/autoload/bshell.vim b/bshell.vim/autoload/bshell.vim new file mode 100755 index 0000000..e69de29 diff --git a/bshell.vim/ftdetect/bshell.vim b/bshell.vim/ftdetect/bshell.vim new file mode 100755 index 0000000..d407f93 --- /dev/null +++ b/bshell.vim/ftdetect/bshell.vim @@ -0,0 +1 @@ +autocmd BufNewFile,BufRead *.bshell setfiletype bshell diff --git a/bshell.vim/ftplugin/bshell.vim b/bshell.vim/ftplugin/bshell.vim new file mode 100755 index 0000000..8d1c193 --- /dev/null +++ b/bshell.vim/ftplugin/bshell.vim @@ -0,0 +1,4 @@ +setlocal tabstop=8 +setlocal softtabstop=4 +setlocal shiftwidth=4 +setlocal expandtab diff --git a/bshell.vim/syntax/bshell.vim b/bshell.vim/syntax/bshell.vim new file mode 100755 index 0000000..8d3439a --- /dev/null +++ b/bshell.vim/syntax/bshell.vim @@ -0,0 +1,126 @@ +if exists('b:current_syntax') + finish +endif + +let s:save_cpo = &cpoptions +set cpoptions&vim +setlocal iskeyword+=- + +syn match bshellFunctionRef /\<[A-Za-z][A-Za-z0-9]*\(-[A-Za-z0-9][A-Za-z0-9]*\)\+\>/ +syn match bshellVariable /\$[A-Za-z][A-Za-z0-9_]*/ +syn match bshellArgFlag /\<-[A-Za-z][A-Za-z0-9]*\(-[A-Za-z0-9][A-Za-z0-9]*\)*\>/ +syn keyword bshellKeyword func + +syn keyword bshellTodo contained TODO FIXME XXX NOTE HACK TBD +syn match bshellLineComment /#.*$/ contains=bshellTodo + +syn region bshellInterpolatedString matchgroup=bshellString start=+"+ end=+"+ extend contains=bshellVariable +syn region bshellLiteralString matchgroup=bshellString start=+\'+ end=+\'+ extend contains=bshellSpecialChar,bshellSpecialError,bshellUnicodeNumber,@Spell + +hi def link bshellKeyword Statement +hi def link bshellArgFlag Tag +hi def link bshellVariable Identifier +hi def link bshellLineComment Comment +hi def link bshellFunctionRef Function +hi def link bshellString String +hi def link bshellInterpolatedString String +hi def link bshellLiteralString String + + +" The default highlighting. +" hi def link bshellUnspecifiedStatement Statement +" hi def link bshellUnsupportedStatement Statement +" +" hi def link bshellGlobalNamespaceAlias Include +" +" hi def link bshellType Type +" +" hi def link bshellStorage Keyword +" hi def link bshellIsAs Keyword +" hi def link bshellAccessor Keyword +" hi def link bshellBuiltinVar @variable.builtin +" hi def link bshellSelfVar @variable.builtin +" +" hi def link bshellStatement Statement +" hi def link bshellRepeat Repeat +" hi def link bshellConditional Conditional +" hi def link bshellSelectorLabel Tag +" hi def link bshellUnnamedLabel Comment +" hi def link bshellUnnamedVariable Comment +" hi def link bshellLambdaParameter @variable.builtin +" hi def link bshellException Exception +" +" hi def link bshellParens Delimiter +" hi def link bshellBraces Structure +" hi def link bshellControlSymbols Keyword +" +" hi def link bshellModifier StorageClass +" hi def link bshellAccessModifier bshellModifier +" hi def link bshellAsyncModifier bshellModifier +" hi def link bshellCheckedModifier bshellModifier +" hi def link bshellManagedModifier bshellModifier +" hi def link bshellUsingModifier bshellModifier +" +" hi def link bshellTodo Todo +" hi def link bshellComment Comment +" hi def link bshellLineComment bshellComment +" hi def link bshellBlockComment bshellComment +" hi def link bshellLineContinuation bshellComment +" +" hi def link bshellKeywordOperator Keyword +" hi def link bshellAsyncOperator bshellKeywordOperator +" hi def link bshellTypeOf bshellKeywordOperator +" hi def link bshellTypeOfOperand Typedef +" hi def link bshellTypeOfError Error +" hi def link bshellOpSymbols Operator +" hi def link bshellPackageAccessOperator Operator +" hi def link bshellOtherSymbols Structure +" hi def link bshellLogicSymbols Operator +" hi def link bshellWordOperator Operator +" +" hi def link bshellSpecialError Error +" hi def link bshellSpecialCharError Error +" hi def link bshellString String +" hi def link bshellQuote String +" hi def link bshellInterpolatedString String +" hi def link bshellVerbatimString String +" hi def link bshellInterVerbString String +" hi def link bshellVerbatimQuote SpecialChar +" +" hi def link bshellConstant Constant +" hi def link bshellNull Constant +" hi def link bshellBoolean Boolean +" hi def link bshellCharacter Character +" hi def link bshellSpecialChar SpecialChar +" hi def link bshellInteger Number +" hi def link bshellReal Float +" hi def link bshellWord Identifier +" hi def link bshellUnicodeNumber SpecialChar +" hi def link bshellUnicodeSpecifier SpecialChar +" hi def link bshellInterpolationDelimiter Delimiter +" hi def link bshellInterpolationAlignDel bshellInterpolationDelimiter +" hi def link bshellInterpolationFormat bshellInterpolationDelimiter +" hi def link bshellInterpolationFormatDel bshellInterpolationDelimiter +" +" hi def link bshellGenericBraces bshellBraces +" +" hi def link bshellAtomName Constant +" +" hi def link bshellComplexMessageName Function +" hi def link bshellUnaryMessageName Function +" hi def link bshellPropertyName @property +" hi def link bshellPropertySymbol Statement +" +" hi def link bshellStatementSeparator Comment +" hi def link bshellMessageTerminator @punctuation.special +" +" hi def link bshellPackageStmtIdentifier @string.special.url +" hi def link bshellUseStmtIdentifier @module + + +let b:current_syntax = 'bshell' + +let &cpoptions = s:save_cpo +unlet s:save_cpo + +" vim: vts=16,28