From 8c1154fc649fc2dca1cf225e025399c89af88a8d Mon Sep 17 00:00:00 2001 From: Maxim Likhachev Date: Mon, 27 Jul 2020 10:49:49 +0300 Subject: [PATCH] vim: helm --- etc/soft/nvim/+plugins/vim-helm/LICENSE | 33 ++++++++ etc/soft/nvim/+plugins/vim-helm/README.md | 8 ++ etc/soft/nvim/+plugins/vim-helm/ftdetect/helm.vim | 1 + etc/soft/nvim/+plugins/vim-helm/syntax/helm.vim | 95 +++++++++++++++++++++++ 4 files changed, 137 insertions(+) create mode 100644 etc/soft/nvim/+plugins/vim-helm/LICENSE create mode 100644 etc/soft/nvim/+plugins/vim-helm/README.md create mode 100644 etc/soft/nvim/+plugins/vim-helm/ftdetect/helm.vim create mode 100644 etc/soft/nvim/+plugins/vim-helm/syntax/helm.vim diff --git a/etc/soft/nvim/+plugins/vim-helm/LICENSE b/etc/soft/nvim/+plugins/vim-helm/LICENSE new file mode 100644 index 0000000..7edb88b --- /dev/null +++ b/etc/soft/nvim/+plugins/vim-helm/LICENSE @@ -0,0 +1,33 @@ +Copyright (c) 2018, Tobias Wolf +All rights reserved. + +Contains syntax portions licensed from: +https://github.com/fatih/vim-go + +Copyright (c) 2015, Fatih Arslan +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/etc/soft/nvim/+plugins/vim-helm/README.md b/etc/soft/nvim/+plugins/vim-helm/README.md new file mode 100644 index 0000000..1a38dcc --- /dev/null +++ b/etc/soft/nvim/+plugins/vim-helm/README.md @@ -0,0 +1,8 @@ +# vim-helm +vim syntax for helm templates (yaml + gotmpl + sprig + custom) + +Install via vundle: + +```vim +Plugin 'towolf/vim-helm' +``` diff --git a/etc/soft/nvim/+plugins/vim-helm/ftdetect/helm.vim b/etc/soft/nvim/+plugins/vim-helm/ftdetect/helm.vim new file mode 100644 index 0000000..9a502ac --- /dev/null +++ b/etc/soft/nvim/+plugins/vim-helm/ftdetect/helm.vim @@ -0,0 +1 @@ +autocmd BufRead,BufNewFile */templates/*.yaml,*/templates/*.tpl set ft=helm diff --git a/etc/soft/nvim/+plugins/vim-helm/syntax/helm.vim b/etc/soft/nvim/+plugins/vim-helm/syntax/helm.vim new file mode 100644 index 0000000..0b874fc --- /dev/null +++ b/etc/soft/nvim/+plugins/vim-helm/syntax/helm.vim @@ -0,0 +1,95 @@ +if exists("b:current_syntax") + finish +endif + +if !exists("main_syntax") + let main_syntax = 'yaml' +endif + +let b:current_syntax = '' +unlet b:current_syntax +runtime! syntax/yaml.vim + +let b:current_syntax = '' +unlet b:current_syntax +syntax include @Yaml syntax/yaml.vim + +syn case match + +" Go escapes +syn match goEscapeOctal display contained "\\[0-7]\{3}" +syn match goEscapeC display contained +\\[abfnrtv\\'"]+ +syn match goEscapeX display contained "\\x\x\{2}" +syn match goEscapeU display contained "\\u\x\{4}" +syn match goEscapeBigU display contained "\\U\x\{8}" +syn match goEscapeError display contained +\\[^0-7xuUabfnrtv\\'"]+ + +hi def link goEscapeOctal goSpecialString +hi def link goEscapeC goSpecialString +hi def link goEscapeX goSpecialString +hi def link goEscapeU goSpecialString +hi def link goEscapeBigU goSpecialString +hi def link goSpecialString Special +hi def link goEscapeError Error + +" Strings and their contents +syn cluster goStringGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU,goEscapeError +syn region goString contained start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@goStringGroup +syn region goRawString contained start=+`+ end=+`+ + +hi def link goString String +hi def link goRawString String + +" Characters; their contents +syn cluster goCharacterGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU +syn region goCharacter contained start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@goCharacterGroup + +hi def link goCharacter Character + +" Integers +syn match goDecimalInt contained "\<\d\+\([Ee]\d\+\)\?\>" +syn match goHexadecimalInt contained "\<0x\x\+\>" +syn match goOctalInt contained "\<0\o\+\>" +syn match goOctalError contained "\<0\o*[89]\d*\>" +syn cluster goInt contains=goDecimalInt,goHexadecimalInt,goOctalInt +" Floating point +syn match goFloat contained "\<\d\+\.\d*\([Ee][-+]\d\+\)\?\>" +syn match goFloat contained "\<\.\d\+\([Ee][-+]\d\+\)\?\>" +syn match goFloat contained "\<\d\+[Ee][-+]\d\+\>" +" Imaginary literals +syn match goImaginary contained "\<\d\+i\>" +syn match goImaginary contained "\<\d\+\.\d*\([Ee][-+]\d\+\)\?i\>" +syn match goImaginary contained "\<\.\d\+\([Ee][-+]\d\+\)\?i\>" +syn match goImaginary contained "\<\d\+[Ee][-+]\d\+i\>" + +hi def link goInt Number +hi def link goFloat Number +hi def link goImaginary Number + +" Token groups +syn cluster gotplLiteral contains=goString,goRawString,goCharacter,@goInt,goFloat,goImaginary +syn keyword gotplControl contained if else end range with template include tpl required define +syn keyword gotplFunctions contained and call html index js len not or print printf println urlquery eq ne lt le gt ge +syn keyword goSprigFunctions contained abbrev abbrevboth add add1 adler32sum ago append atoi b32dec b32enc b64dec b64enc base biggest buildCustomCert camelcase cat ceil clean coalesce \contains compact date dateInZone dateModify date_in_zone date_modify default derivePassword dict dir div empty ext fail first float64 floor fromJson fromYaml genCA genPrivateKey genSelfSignedCert genSignedCert has hasKey hasPrefix hasSuffix hello htmlDate htmlDateInZone indent initial initials int int64 isAbs join kebabcase keys kindIs kindOf last list lower max merge mergeOverwrite min mod mul nindent nospace now omit pick pluck plural prepend quote randAlpha randAlphaNum randAscii randNumeric regexFind regexFindAll regexMatch regexReplaceAll regexReplaceAllLiteral regexSplit repeat replace rest reverse round semver semverCompare set sha1sum sha256sum shuffle slice snakecase sortAlpha split splitList splitn squote sub substr swapcase ternary title toDate toJson toPrettyJson toString toStrings toToml toYaml trim trimAll trimPrefix trimSuffix trimall trunc tuple typeIs typeIsLike typeOf uniq unixEpoch unset until untilStep untitle upper uuidv4 values without wrap wrapWith +syn match goTplVariable contained /\$[a-zA-Z0-9_]*\>/ +syn match goTplIdentifier contained /\.[^\s}]+\>/ + +" hi def link gotplControl Keyword +" hi def link gotplFunctions Function +" hi def link goSprigFunctions Function +" hi def link goTplVariable Special +hi def link gotplControl goConditional +hi def link gotplFunctions goConditional +hi def link goSprigFunctions goConditional +hi def link goTplVariable goStatement + +syn region gotplAction start="{{\(-? \)\?" end="\( -?\)\?}}" contains=@gotplLiteral,gotplControl,gotplFunctions,goSprigFunctions,gotplVariable,goTplIdentifier containedin=yamlFlowString display +syn region gotplAction start="\[\[\(-? \)\?" end="\( -?\)\?\]\]" contains=@gotplLiteral,gotplControl,gotplFunctions,goSprigFunctions,gotplVariable containedin=yamlFlowString display +syn region goTplComment start="{{\(-? \)\?/\*" end="\*/\( -?\)\?}}" display +syn region goTplComment start="\[\[\(-? \)\?/\*" end="\*/\( -?\)\?\]\]" display + +hi def link goTplAction Operator +hi def link goTplComment Comment +let b:current_syntax = "helm" + +" vim: sw=2 ts=2 et