From 35ea4d2b9072594b6c0ccf87bde7978ed9f94755 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Sat, 25 Jan 2020 16:56:10 +0100 Subject: Update --- autoload/rustfmt.vim | 22 +++++++++------------- autoload/terraform.vim | 6 ++++++ ftdetect/polyglot.vim | 36 ++++++++++++++++++++---------------- ftplugin/dhall.vim | 6 ++++-- ftplugin/mail_vifm.vim | 2 +- syntax/basic/decorator.vim | 2 +- syntax/basic/function.vim | 2 +- syntax/basic/keyword.vim | 11 ++++++++++- syntax/basic/members.vim | 2 +- syntax/common.vim | 4 ++++ syntax/go.vim | 18 ++++++++++++++++++ syntax/helm.vim | 8 ++++---- syntax/javascript.vim | 2 +- 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 /\" 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]\+\)\?\)\=" -- cgit v1.2.3