diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2020-01-25 16:56:10 +0100 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2020-01-25 16:56:10 +0100 |
commit | 35ea4d2b9072594b6c0ccf87bde7978ed9f94755 (patch) | |
tree | e829bad239fea3150cd0963933f3e33214f069b4 | |
parent | 967486dd716de860db3ef091a9dcb9cb65023534 (diff) | |
download | vim-polyglot-4.2.1.tar.gz vim-polyglot-4.2.1.zip |
Updatev4.2.1
-rw-r--r-- | autoload/rustfmt.vim | 22 | ||||
-rw-r--r-- | autoload/terraform.vim | 6 | ||||
-rw-r--r-- | ftdetect/polyglot.vim | 36 | ||||
-rw-r--r-- | ftplugin/dhall.vim | 6 | ||||
-rw-r--r-- | ftplugin/mail_vifm.vim | 2 | ||||
-rw-r--r-- | syntax/basic/decorator.vim | 2 | ||||
-rw-r--r-- | syntax/basic/function.vim | 2 | ||||
-rw-r--r-- | syntax/basic/keyword.vim | 11 | ||||
-rw-r--r-- | syntax/basic/members.vim | 2 | ||||
-rw-r--r-- | syntax/common.vim | 4 | ||||
-rw-r--r-- | syntax/go.vim | 18 | ||||
-rw-r--r-- | syntax/helm.vim | 8 | ||||
-rw-r--r-- | syntax/javascript.vim | 2 | ||||
-rw-r--r-- | syntax/zig.vim | 8 |
14 files changed, 84 insertions, 45 deletions
diff --git a/autoload/rustfmt.vim b/autoload/rustfmt.vim index 53ea9b28..514e4147 100644 --- a/autoload/rustfmt.vim +++ b/autoload/rustfmt.vim @@ -62,18 +62,19 @@ function! s:RustfmtWriteMode() endif endfunction -function! s:RustfmtConfig() +function! s:RustfmtConfigOptions() let l:rustfmt_toml = findfile('rustfmt.toml', expand('%:p:h') . ';') if l:rustfmt_toml !=# '' - return '--config-path '.l:rustfmt_toml + return '--config-path '.fnamemodify(l:rustfmt_toml, ":p") endif let l:_rustfmt_toml = findfile('.rustfmt.toml', expand('%:p:h') . ';') if l:_rustfmt_toml !=# '' - return '--config-path '.l:_rustfmt_toml + return '--config-path '.fnamemodify(l:_rustfmt_toml, ":p") endif - return '' + " Default to edition 2018 in case no rustfmt.toml was found. + return '--edition 2018' endfunction function! s:RustfmtCommandRange(filename, line1, line2) @@ -84,7 +85,7 @@ function! s:RustfmtCommandRange(filename, line1, line2) let l:arg = {"file": shellescape(a:filename), "range": [a:line1, a:line2]} let l:write_mode = s:RustfmtWriteMode() - let l:rustfmt_config = s:RustfmtConfig() + let l:rustfmt_config = s:RustfmtConfigOptions() " FIXME: When --file-lines gets to be stable, add version range checking " accordingly. @@ -98,14 +99,9 @@ function! s:RustfmtCommandRange(filename, line1, line2) endfunction function! s:RustfmtCommand() - if g:rustfmt_emit_files - let l:write_mode = "--emit=stdout" - else - let l:write_mode = "--write-mode=display" - endif - " rustfmt will pick on the right config on its own due to the - " current directory change. - return g:rustfmt_command . " ". l:write_mode . " " . g:rustfmt_options + let write_mode = g:rustfmt_emit_files ? '--emit=stdout' : '--write-mode=display' + let config = s:RustfmtConfigOptions() + return join([g:rustfmt_command, write_mode, config, g:rustfmt_options]) endfunction function! s:DeleteLines(start, end) abort diff --git a/autoload/terraform.vim b/autoload/terraform.vim index b156b6b9..dc96ce0a 100644 --- a/autoload/terraform.vim +++ b/autoload/terraform.vim @@ -1,5 +1,8 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'terraform') == -1 +let s:cpo_save = &cpoptions +set cpoptions&vim + " Ensure no conflict with arguments from the environment let $TF_CLI_ARGS_fmt='' @@ -61,4 +64,7 @@ function! terraform#commands(ArgLead, CmdLine, CursorPos) return join(l:commands, "\n") endfunction +let &cpoptions = s:cpo_save +unlet s:cpo_save + endif diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index c42c5852..b3b6ea4c 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -692,11 +692,11 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jenkins') == -1 augroup filetypedetect " jenkins, from Jenkinsfile.vim in martinda/Jenkinsfile-vim-syntax " Jenkinsfile - -augroup JenkinsAUGroup - autocmd BufRead,BufNewFile *Jenkins* set ft=Jenkinsfile - autocmd BufRead,BufNewFile *jenkins* set ft=Jenkinsfile -augroup END +autocmd BufRead,BufNewFile Jenkinsfile set ft=Jenkinsfile +autocmd BufRead,BufNewFile Jenkinsfile* setf Jenkinsfile +autocmd BufRead,BufNewFile *.jenkinsfile set ft=Jenkinsfile +autocmd BufRead,BufNewFile *.jenkinsfile setf Jenkinsfile +autocmd BufRead,BufNewFile *.Jenkinsfile setf Jenkinsfile augroup end endif @@ -769,15 +769,15 @@ endif if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'llvm') == -1 augroup filetypedetect - " llvm, from llvm-lit.vim in rhysd/vim-llvm -au BufRead,BufNewFile lit.*cfg set filetype=python + " llvm, from llvm.vim in rhysd/vim-llvm +au BufRead,BufNewFile *.ll set filetype=llvm augroup end endif if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'llvm') == -1 augroup filetypedetect - " llvm, from llvm.vim in rhysd/vim-llvm -au BufRead,BufNewFile *.ll set filetype=llvm + " llvm, from llvm-lit.vim in rhysd/vim-llvm +au BufRead,BufNewFile lit.*cfg set filetype=python augroup end endif @@ -854,6 +854,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'meson') == -1 " meson, from meson.vim in mesonbuild/meson:_ALL:/data/syntax-highlighting/vim/ au BufNewFile,BufRead meson.build set filetype=meson au BufNewFile,BufRead meson_options.txt set filetype=meson +au BufNewFile,BufRead *.wrap set filetype=dosini augroup end endif @@ -1296,6 +1297,9 @@ au BufNewFile,BufRead [rR]outefile call s:setf('ruby') " SimpleCov au BufNewFile,BufRead .simplecov call s:setf('ruby') +" Sorbet RBI files +au BufNewFile,BufRead *.rbi call s:setf('ruby') + " Thor au BufNewFile,BufRead [tT]horfile,*.thor call s:setf('ruby') @@ -1420,7 +1424,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'terraform') == augroup filetypedetect " terraform, from terraform.vim in hashivim/vim-terraform " By default, Vim associates .tf files with TinyFugue - tell it not to. -autocmd! filetypedetect BufRead,BufNewFile *.tf +silent! autocmd! filetypedetect BufRead,BufNewFile *.tf autocmd BufRead,BufNewFile *.tf set filetype=terraform autocmd BufRead,BufNewFile *.tfvars set filetype=terraform autocmd BufRead,BufNewFile *.tfstate set filetype=json @@ -1532,17 +1536,17 @@ endif if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vifm') == -1 augroup filetypedetect - " vifm, from vifm-rename.vim in vifm/vifm.vim -autocmd BufRead,BufNewFile vifm.rename* :set filetype=vifm-rename + " vifm, from vifm.vim in vifm/vifm.vim +autocmd BufRead,BufNewFile vifmrc :set filetype=vifm +autocmd BufRead,BufNewFile *vifm/colors/* :set filetype=vifm +autocmd BufRead,BufNewFile *.vifm :set filetype=vifm augroup end endif if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vifm') == -1 augroup filetypedetect - " vifm, from vifm.vim in vifm/vifm.vim -autocmd BufRead,BufNewFile vifmrc :set filetype=vifm -autocmd BufRead,BufNewFile *vifm/colors/* :set filetype=vifm -autocmd BufRead,BufNewFile *.vifm :set filetype=vifm + " vifm, from vifm-rename.vim in vifm/vifm.vim +autocmd BufRead,BufNewFile vifm.rename* :set filetype=vifm-rename augroup end endif diff --git a/ftplugin/dhall.vim b/ftplugin/dhall.vim index d09f4c31..c5553f49 100644 --- a/ftplugin/dhall.vim +++ b/ftplugin/dhall.vim @@ -34,14 +34,16 @@ endif function! DhallFormat() let cursor = getpos('.') - exec 'silent %!dhall format' + exec 'normal! gg' + exec 'silent !dhall format --inplace ' . expand('%') + exec 'e' call setpos('.', cursor) endfunction if exists('g:dhall_format') if g:dhall_format == 1 augroup dhall - au BufWritePre *.dhall call DhallFormat() + au BufWritePost *.dhall call DhallFormat() augroup END endif endif diff --git a/ftplugin/mail_vifm.vim b/ftplugin/mail_vifm.vim index 33e62683..c9849fbc 100644 --- a/ftplugin/mail_vifm.vim +++ b/ftplugin/mail_vifm.vim @@ -54,7 +54,7 @@ function! s:HandleRunResults(exitcode, listf) if filereadable(a:listf) && l:insert_pos != 0 for line in readfile(a:listf) - call append(l:insert_pos, 'Attach: '.line) + call append(l:insert_pos, 'Attach: '.escape(line, " ")) let l:insert_pos += 1 endfor endif diff --git a/syntax/basic/decorator.vim b/syntax/basic/decorator.vim index 1a8fc2c7..2a7a1dd1 100644 --- a/syntax/basic/decorator.vim +++ b/syntax/basic/decorator.vim @@ -1,7 +1,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'typescript') == -1 syntax match typescriptDecorator /@\([_$a-zA-Z][_$a-zA-Z0-9]*\.\)*[_$a-zA-Z][_$a-zA-Z0-9]*\>/ - \ nextgroup=typescriptArgumentList,typescriptTypeArguments + \ nextgroup=typescriptFuncCallArg,typescriptTypeArguments \ contains=@_semantic,typescriptDotNotation endif diff --git a/syntax/basic/function.vim b/syntax/basic/function.vim index ac1c4a4c..5acbb55c 100644 --- a/syntax/basic/function.vim +++ b/syntax/basic/function.vim @@ -40,7 +40,7 @@ syntax match typescriptArrowFuncDef contained /\K\k*\s*=>/ \ skipwhite skipempty " TODO: optimize this pattern -syntax region typescriptArrowFuncDef contained start=/(\_[^)]*):/ end=/=>/ +syntax region typescriptArrowFuncDef contained start=/(\_[^(^)]*):/ end=/=>/ \ contains=typescriptArrowFuncArg,typescriptArrowFunc,typescriptTypeAnnotation \ nextgroup=@typescriptExpression,typescriptBlock \ skipwhite skipempty keepend diff --git a/syntax/basic/keyword.vim b/syntax/basic/keyword.vim index ff1e169a..11639c43 100644 --- a/syntax/basic/keyword.vim +++ b/syntax/basic/keyword.vim @@ -1,8 +1,17 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'typescript') == -1 "Import -syntax keyword typescriptImport from as import +syntax keyword typescriptImport from as +syntax keyword typescriptImport import + \ nextgroup=typescriptImportType + \ skipwhite +syntax keyword typescriptImportType type + \ contained syntax keyword typescriptExport export + \ nextgroup=typescriptExportType + \ skipwhite +syntax match typescriptExportType /\<type\s*{\@=/ + \ contained skipwhite skipempty skipnl syntax keyword typescriptModule namespace module "this diff --git a/syntax/basic/members.vim b/syntax/basic/members.vim index 267bd110..343559b9 100644 --- a/syntax/basic/members.vim +++ b/syntax/basic/members.vim @@ -7,7 +7,7 @@ syntax keyword typescriptConstructor contained constructor syntax cluster memberNextGroup contains=typescriptMemberOptionality,typescriptTypeAnnotation,@typescriptCallSignature -syntax match typescriptMember /\K\k*/ +syntax match typescriptMember /#\?\K\k*/ \ nextgroup=@memberNextGroup \ contained skipwhite diff --git a/syntax/common.vim b/syntax/common.vim index c7a755cc..fed39cf6 100644 --- a/syntax/common.vim +++ b/syntax/common.vim @@ -13,6 +13,8 @@ if main_syntax == 'typescript' || main_syntax == 'typescriptreact' setlocal iskeyword+=$ " syntax cluster htmlJavaScript contains=TOP endif +" For private field added from TypeScript 3.8 +setlocal iskeyword+=# " lowest priority on least used feature syntax match typescriptLabel /[a-zA-Z_$]\k*:/he=e-1 contains=typescriptReserved nextgroup=@typescriptStatement skipwhite skipempty @@ -101,8 +103,10 @@ if exists("did_typescript_hilink") HiLink typescriptLabel Label HiLink typescriptStringProperty String HiLink typescriptImport Special + HiLink typescriptImportType Special HiLink typescriptAmbientDeclaration Special HiLink typescriptExport Special + HiLink typescriptExportType Special HiLink typescriptModule Special HiLink typescriptTry Special HiLink typescriptExceptions Special diff --git a/syntax/go.vim b/syntax/go.vim index 38a4993c..fef0e689 100644 --- a/syntax/go.vim +++ b/syntax/go.vim @@ -395,6 +395,24 @@ function! s:hi() hi def link goDiagnosticError SpellBad hi def link goDiagnosticWarning SpellRare + " TODO(bc): is it appropriate to define text properties in a syntax file? + " The highlight groups need to be defined before the text properties types + " are added, and when users have syntax enabled in their vimrc after + " filetype plugin on, the highlight groups won't be defined when + " ftplugin/go.vim is executed when the first go file is opened. + " See https://github.com/fatih/vim-go/issues/2658. + if exists('*prop_type_add') + if empty(prop_type_get('goSameId')) + call prop_type_add('goSameId', {'highlight': 'goSameId'}) + endif + if empty(prop_type_get('goDiagnosticError')) + call prop_type_add('goDiagnosticError', {'highlight': 'goDiagnosticError'}) + endif + if empty(prop_type_get('goDiagnosticWarning')) + call prop_type_add('goDiagnosticWarning', {'highlight': 'goDiagnosticWarning'}) + endif + endif + hi def link goDeclsFzfKeyword Keyword hi def link goDeclsFzfFunction Function hi def link goDeclsFzfSpecialComment SpecialComment diff --git a/syntax/helm.vim b/syntax/helm.vim index 9e8be342..8118a573 100644 --- a/syntax/helm.vim +++ b/syntax/helm.vim @@ -81,10 +81,10 @@ hi def link gotplFunctions Function hi def link goSprigFunctions Function hi def link goTplVariable Special -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 +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 PreProc hi def link goTplComment Comment diff --git a/syntax/javascript.vim b/syntax/javascript.vim index 29863ee1..0ffc5aa1 100644 --- a/syntax/javascript.vim +++ b/syntax/javascript.vim @@ -201,7 +201,7 @@ syntax match jsDestructuringNoise contained /[,[\]]/ syntax region jsDestructuringPropertyComputed contained matchgroup=jsDestructuringBraces start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsDestructuringValue,jsDestructuringValueAssignment,jsDestructuringNoise extend fold " Comments -syntax keyword jsCommentTodo contained TODO FIXME XXX TBD +syntax keyword jsCommentTodo contained TODO FIXME XXX TBD NOTE syntax region jsComment start=+//+ end=/$/ contains=jsCommentTodo,@Spell extend keepend syntax region jsComment start=+/\*+ end=+\*/+ contains=jsCommentTodo,@Spell fold extend keepend syntax region jsEnvComment start=/\%^#!/ end=/$/ display diff --git a/syntax/zig.vim b/syntax/zig.vim index 3b559f49..bdb9ac27 100644 --- a/syntax/zig.vim +++ b/syntax/zig.vim @@ -10,7 +10,7 @@ if exists("b:current_syntax") endif let b:current_syntax = "zig" -syn keyword zigStorage const var extern packed export pub noalias inline noinline comptime nakedcc stdcallcc volatile allowzero align linksection threadlocal +syn keyword zigStorage const var extern packed export pub noalias inline noinline comptime callconv volatile allowzero align linksection threadlocal syn keyword zigStructure struct enum union error syn keyword zigStatement break return continue asm defer errdefer unreachable try catch async noasync await suspend resume syn keyword zigConditional if else switch and or orelse @@ -29,7 +29,7 @@ syn match zigType "\v<[iu][1-9]\d*>" syn match zigOperator display "\%(+%\?\|-%\?\|/\|*%\?\|=\|\^\|&\|?\||\|!\|>\|<\|%\|<<%\?\|>>\)=\?" syn match zigArrowCharacter display "->" -syn match zigBuiltinFn "\v\@(addWithOverflow|ArgType|atomicLoad|bitCast|breakpoint)>" +syn match zigBuiltinFn "\v\@(addWithOverflow|ArgType|atomicLoad|atomicStore|bitCast|breakpoint)>" syn match zigBuiltinFn "\v\@(alignCast|alignOf|cDefine|cImport|cInclude)>" syn match zigBuiltinFn "\v\@(cUndef|canImplicitCast|clz|cmpxchgWeak|cmpxchgStrong|compileError)>" syn match zigBuiltinFn "\v\@(compileLog|ctz|popCount|divExact|divFloor|divTrunc)>" @@ -42,10 +42,10 @@ syn match zigBuiltinFn "\v\@(bitOffsetOf|byteOffsetOf|OpaqueType|panic|ptrCast)> syn match zigBuiltinFn "\v\@(ptrToInt|rem|returnAddress|setCold|Type|shuffle)>" syn match zigBuiltinFn "\v\@(setRuntimeSafety|setEvalBranchQuota|setFloatMode)>" syn match zigBuiltinFn "\v\@(setGlobalLinkage|setGlobalSection|shlExact|This|hasDecl|hasField)>" -syn match zigBuiltinFn "\v\@(shlWithOverflow|shrExact|sizeOf|sqrt|byteSwap|subWithOverflow|intCast|floatCast|intToFloat|floatToInt|boolToInt|errSetCast)>" +syn match zigBuiltinFn "\v\@(shlWithOverflow|shrExact|sizeOf|bitSizeOf|sqrt|byteSwap|subWithOverflow|intCast|floatCast|intToFloat|floatToInt|boolToInt|errSetCast)>" syn match zigBuiltinFn "\v\@(truncate|typeId|typeInfo|typeName|TypeOf|atomicRmw|bytesToSlice|sliceToBytes)>" syn match zigBuiltinFn "\v\@(intToError|errorToInt|intToEnum|enumToInt|setAlignStack|frame|Frame|frameSize|bitReverse|Vector)>" -syn match zigBuiltinFn "\v\@(sin|cos|exp|exp2|ln|log2|log10|fabs|floor|ceil|trunc|round)>" +syn match zigBuiltinFn "\v\@(sin|cos|exp|exp2|log|log2|log10|fabs|floor|ceil|trunc|round)>" syn match zigDecNumber display "\<[0-9]\+\%(.[0-9]\+\)\=\%([eE][+-]\?[0-9]\+\)\=" syn match zigHexNumber display "\<0x[a-fA-F0-9]\+\%([a-fA-F0-9]\+\%([pP][+-]\?[0-9]\+\)\?\)\=" |