This commit is contained in:
Adam Stankiewicz 2019-07-01 16:25:37 +02:00
parent d527002849
commit 140430ffb7
19 changed files with 262 additions and 170 deletions

View File

@ -6,7 +6,7 @@ endif
" Language: C++ Additions " Language: C++ Additions
" Maintainer: Jon Haggblad <jon@haeggblad.com> " Maintainer: Jon Haggblad <jon@haeggblad.com>
" URL: http://www.haeggblad.com " URL: http://www.haeggblad.com
" Last Change: 1 Feb 2018 " Last Change: 29 Jun 2019
" Version: 0.6 " Version: 0.6
" Changelog: " Changelog:
" 0.1 - initial version. " 0.1 - initial version.
@ -964,6 +964,12 @@ if !exists("cpp_no_cpp11")
syntax keyword cppSTLtype atomic_uintmax_t syntax keyword cppSTLtype atomic_uintmax_t
syntax keyword cppSTLconstant ATOMIC_FLAG_INIT syntax keyword cppSTLconstant ATOMIC_FLAG_INIT
syntax keyword cppSTLenum memory_order syntax keyword cppSTLenum memory_order
syntax keyword cppSTLtype memory_order_relaxed
syntax keyword cppSTLtype memory_order_consume
syntax keyword cppSTLtype memory_order_acquire
syntax keyword cppSTLtype memory_order_release
syntax keyword cppSTLtype memory_order_acq_rel
syntax keyword cppSTLtype memory_order_seq_cst
syntax keyword cppSTLfunction is_lock_free syntax keyword cppSTLfunction is_lock_free
syntax keyword cppSTLfunction compare_exchange_weak syntax keyword cppSTLfunction compare_exchange_weak
syntax keyword cppSTLfunction compare_exchange_strong syntax keyword cppSTLfunction compare_exchange_strong
@ -1983,6 +1989,9 @@ endif " C++17
if !exists("cpp_no_cpp20") if !exists("cpp_no_cpp20")
" type_traits " type_traits
syntax keyword cppSTLtype remove_cvref remove_cvref_t syntax keyword cppSTLtype remove_cvref remove_cvref_t
syntax keyword cppType char8_t
syntax keyword cppStatement co_yield co_return co_await
syntax keyword cppStorageClass consteval
endif endif

View File

@ -18,10 +18,6 @@ function! go#config#VersionWarning() abort
return get(g:, 'go_version_warning', 1) return get(g:, 'go_version_warning', 1)
endfunction endfunction
function! go#config#NullModuleWarning() abort
return get(g:, 'go_null_module_warning', 1)
endfunction
function! go#config#BuildTags() abort function! go#config#BuildTags() abort
return get(g:, 'go_build_tags', '') return get(g:, 'go_build_tags', '')
endfunction endfunction
@ -279,10 +275,6 @@ function! go#config#MetalinterEnabled() abort
return get(g:, "go_metalinter_enabled", default_enabled) return get(g:, "go_metalinter_enabled", default_enabled)
endfunction endfunction
function! go#config#MetalinterDisabled() abort
return get(g:, "go_metalinter_disabled", [])
endfunction
function! go#config#GolintBin() abort function! go#config#GolintBin() abort
return get(g:, "go_golint_bin", "golint") return get(g:, "go_golint_bin", "golint")
endfunction endfunction

View File

@ -73,17 +73,27 @@ function! jsx_pretty#indent#get(js_indent)
let line = substitute(getline(lnum), '^\s*\|\s*$', '', 'g') let line = substitute(getline(lnum), '^\s*\|\s*$', '', 'g')
let current_syn = s:syn_sol(lnum) let current_syn = s:syn_sol(lnum)
let current_syn_eol = s:syn_eol(lnum) let current_syn_eol = s:syn_eol(lnum)
let prev_syn_sol = s:syn_sol(lnum - 1) let prev_line_num = prevnonblank(lnum - 1)
let prev_syn_eol = s:syn_eol(lnum - 1) let prev_syn_sol = s:syn_sol(prev_line_num)
let prev_syn_eol = s:syn_eol(prev_line_num)
let prev_line = s:prev_line(lnum) let prev_line = s:prev_line(lnum)
let prev_ind = s:prev_indent(lnum) let prev_ind = s:prev_indent(lnum)
if s:syn_xmlish(current_syn) if s:syn_xmlish(current_syn)
if !s:syn_xmlish(prev_syn_sol)
\ && !s:syn_jsx_escapejs(prev_syn_sol)
\ && !s:syn_jsx_escapejs(prev_syn_eol)
\ && !s:syn_js_comment(prev_syn_sol)
if line =~ '^/\s*>' || line =~ '^<\s*' . s:end_tag
return prev_ind
else
return prev_ind + s:sw()
endif
" { " {
" <div></div> " <div></div>
" ##} <-- " ##} <--
if s:syn_jsx_element(current_syn) && line =~ '}$' elseif s:syn_jsx_element(current_syn) && line =~ '}$'
let pair_line = searchpair('{', '', '}', 'b') let pair_line = searchpair('{', '', '}', 'b')
return indent(pair_line) return indent(pair_line)
elseif line =~ '^-->$' elseif line =~ '^-->$'
@ -143,16 +153,6 @@ function! jsx_pretty#indent#get(js_indent)
else else
return prev_ind return prev_ind
endif endif
elseif !s:syn_xmlish(prev_syn_sol)
if prev_line =~ '^\<\(return\|default\|await\|yield\)'
if line !~ '^/\s*>' || line !~ '^<\s*' . s:end_tag
return prev_ind + s:sw()
else
return prev_ind
endif
else
return prev_ind
endif
else else
return prev_ind return prev_ind
endif endif
@ -193,9 +193,10 @@ function! jsx_pretty#indent#get(js_indent)
" Issue #68 " Issue #68
" return (<div> " return (<div>
" |<div>) " |<div>)
if prev_line =~ '^\<return' && line =~ '^<\s*' . s:end_tag if (line =~ '^/\s*>' || line =~ '^<\s*' . s:end_tag)
\ && !s:syn_xmlish(prev_syn_sol)
return prev_ind return prev_ind
endif endif
" If current syntax is not a jsx syntax group " If current syntax is not a jsx syntax group
if s:syn_xmlish(prev_syn_eol) && line !~ '^[)\]}]' if s:syn_xmlish(prev_syn_eol) && line !~ '^[)\]}]'

View File

@ -23,3 +23,71 @@ function! terraform#fmt()
endif endif
call winrestview(l:curw) call winrestview(l:curw)
endfunction endfunction
function! terraform#folds()
let thisline = getline(v:lnum)
if match(thisline, '^resource') >= 0
return '>1'
elseif match(thisline, '^provider') >= 0
return '>1'
elseif match(thisline, '^module') >= 0
return '>1'
elseif match(thisline, '^variable') >= 0
return '>1'
elseif match(thisline, '^output') >= 0
return '>1'
elseif match(thisline, '^data') >= 0
return '>1'
elseif match(thisline, '^terraform') >= 0
return '>1'
elseif match(thisline, '^locals') >= 0
return '>1'
else
return '='
endif
endfunction
function! terraform#foldText()
let foldsize = (v:foldend-v:foldstart)
return getline(v:foldstart).' ('.foldsize.' lines)'
endfunction
function! terraform#align()
let p = '^.*=[^>]*$'
if exists(':Tabularize') && getline('.') =~# '^.*=' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
let column = strlen(substitute(getline('.')[0:col('.')],'[^=]','','g'))
let position = strlen(matchstr(getline('.')[0:col('.')],'.*=\s*\zs.*'))
Tabularize/=/l1
normal! 0
call search(repeat('[^=]*=',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
endif
endfunction
function! terraform#commands(A, L, P)
return [
\ 'apply',
\ 'console',
\ 'destroy',
\ 'env',
\ 'fmt',
\ 'get',
\ 'graph',
\ 'import',
\ 'init',
\ 'output',
\ 'plan',
\ 'providers',
\ 'push',
\ 'refresh',
\ 'show',
\ 'taint',
\ 'untaint',
\ 'validate',
\ 'version',
\ 'workspace',
\ '0.12checklist',
\ 'debug',
\ 'force-unlock',
\ 'state'
\ ]
endfunction

View File

@ -631,11 +631,11 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'jenkins') == -1
augroup filetypedetect augroup filetypedetect
" jenkins, from Jenkinsfile.vim in martinda/Jenkinsfile-vim-syntax " jenkins, from Jenkinsfile.vim in martinda/Jenkinsfile-vim-syntax
" Jenkinsfile " Jenkinsfile
autocmd BufRead,BufNewFile Jenkinsfile set ft=Jenkinsfile
autocmd BufRead,BufNewFile Jenkinsfile* setf Jenkinsfile augroup JenkinsAUGroup
autocmd BufRead,BufNewFile *.jenkinsfile set ft=Jenkinsfile autocmd BufRead,BufNewFile *Jenkins* set ft=Jenkinsfile
autocmd BufRead,BufNewFile *.jenkinsfile setf Jenkinsfile autocmd BufRead,BufNewFile *jenkins* set ft=Jenkinsfile
autocmd BufRead,BufNewFile *.Jenkinsfile setf Jenkinsfile augroup END
augroup end augroup end
endif endif
@ -1085,7 +1085,7 @@ endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'racket') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'racket') == -1
augroup filetypedetect augroup filetypedetect
" racket, from racket.vim in wlangstroth/vim-racket " racket, from racket.vim in wlangstroth/vim-racket
au BufRead,BufNewFile *.rkt,*.rktl setf racket au BufRead,BufNewFile *.rkt,*.rktl set filetype=racket
augroup end augroup end
endif endif
@ -1348,6 +1348,8 @@ endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'terraform') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'terraform') == -1
augroup filetypedetect augroup filetypedetect
" terraform, from terraform.vim in hashivim/vim-terraform " 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
autocmd BufRead,BufNewFile *.tf set filetype=terraform autocmd BufRead,BufNewFile *.tf set filetype=terraform
autocmd BufRead,BufNewFile *.tfvars set filetype=terraform autocmd BufRead,BufNewFile *.tfvars set filetype=terraform
autocmd BufRead,BufNewFile *.tfstate set filetype=json autocmd BufRead,BufNewFile *.tfstate set filetype=json

View File

@ -29,8 +29,8 @@ setlocal commentstring=//\ %s
setlocal shiftwidth=2 softtabstop=2 expandtab setlocal shiftwidth=2 softtabstop=2 expandtab
setlocal include='^\s*import' setlocal include=^\\s*import
setlocal includeexpr='substitute(v:fname,"\\.","/","g")' setlocal includeexpr=substitute(v:fname,'\\.','/','g')
setlocal path+=src/main/scala,src/test/scala setlocal path+=src/main/scala,src/test/scala
setlocal suffixesadd=.scala setlocal suffixesadd=.scala

View File

@ -11,127 +11,44 @@ endif
let b:did_ftplugin = 1 let b:did_ftplugin = 1
let s:cpo_save = &cpoptions let s:cpo_save = &cpoptions
setlocal formatoptions-=t
let b:undo_ftplugin = 'setlocal formatoptions<'
" Include hyphens as keyword characters so that a keyword appearing as part of
" a longer name doesn't get partially highlighted.
setlocal iskeyword+=-
let b:undo_ftplugin .= ' iskeyword<'
set cpoptions&vim set cpoptions&vim
if !exists('g:terraform_align') " j is a relatively recent addition; silence warnings when setting it.
let g:terraform_align = 0 setlocal formatoptions-=t formatoptions+=croql
silent! setlocal formatoptions+=j
let b:undo_ftplugin = 'setlocal formatoptions<'
if !has('patch-7.4.1142')
" Include hyphens as keyword characters so that a keyword appearing as
" part of a longer name doesn't get partially highlighted.
setlocal iskeyword+=-
let b:undo_ftplugin .= ' iskeyword<'
endif endif
if !exists('g:terraform_remap_spacebar') if get(g:, 'terraform_fold_sections', 0)
let g:terraform_remap_spacebar = 0
endif
if !exists('g:terraform_fold_sections')
let g:terraform_fold_sections = 0
endif
if g:terraform_align && exists(':Tabularize')
inoremap <buffer> <silent> = =<Esc>:call <SID>terraformalign()<CR>a
function! s:terraformalign()
let p = '^.*=[^>]*$'
if exists(':Tabularize') && getline('.') =~# '^.*=' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
let column = strlen(substitute(getline('.')[0:col('.')],'[^=]','','g'))
let position = strlen(matchstr(getline('.')[0:col('.')],'.*=\s*\zs.*'))
Tabularize/=/l1
normal! 0
call search(repeat('[^=]*=',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
endif
endfunction
endif
if g:terraform_fold_sections
function! TerraformFolds()
let thisline = getline(v:lnum)
if match(thisline, '^resource') >= 0
return '>1'
elseif match(thisline, '^provider') >= 0
return '>1'
elseif match(thisline, '^module') >= 0
return '>1'
elseif match(thisline, '^variable') >= 0
return '>1'
elseif match(thisline, '^output') >= 0
return '>1'
elseif match(thisline, '^data') >= 0
return '>1'
elseif match(thisline, '^terraform') >= 0
return '>1'
elseif match(thisline, '^locals') >= 0
return '>1'
else
return '='
endif
endfunction
setlocal foldmethod=expr setlocal foldmethod=expr
setlocal foldexpr=TerraformFolds() setlocal foldexpr=terraform#folds()
setlocal foldlevel=1 setlocal foldlevel=1
let b:undo_ftplugin .= ' foldmethod< foldexpr< foldlevel<' setlocal foldtext=terraform#foldText()
let b:undo_ftplugin .= ' foldmethod< foldexpr< foldlevel< foldtext<'
function! TerraformFoldText()
let foldsize = (v:foldend-v:foldstart)
return getline(v:foldstart).' ('.foldsize.' lines)'
endfunction
setlocal foldtext=TerraformFoldText()
let b:undo_ftplugin .= ' foldtext<'
endif
" Re-map the space bar to fold and unfold
if get(g:, 'terraform_remap_spacebar', 1)
"inoremap <space> <C-O>za
nnoremap <space> za
onoremap <space> <C-C>za
vnoremap <space> zf
endif endif
" Set the commentstring " Set the commentstring
if exists('g:terraform_commentstring') let &l:commentstring = get(g:, 'terraform_commentstring', '#%s')
let &l:commentstring=g:terraform_commentstring
else
setlocal commentstring=#%s
endif
let b:undo_ftplugin .= ' commentstring<' let b:undo_ftplugin .= ' commentstring<'
if !exists('g:terraform_fmt_on_save') " Re-map the space bar to fold and unfold
let g:terraform_fmt_on_save = 0 if get(g:, 'terraform_remap_spacebar', 0)
nnoremap <buffer> <space> za
onoremap <buffer> <space> <C-C>za
vnoremap <buffer> <space> zf
let b:undo_ftplugin .= '|unmap <buffer> <space>'
endif endif
function! s:commands(A, L, P) if get(g:, 'terraform_align', 0) && exists(':Tabularize')
return [ inoremap <buffer> <silent> = =<Esc>:call terraform#align()<CR>a
\ 'apply', let b:undo_ftplugin .= '|iunmap <buffer> ='
\ 'console', endif
\ 'destroy',
\ 'env',
\ 'fmt',
\ 'get',
\ 'graph',
\ 'import',
\ 'init',
\ 'output',
\ 'plan',
\ 'providers',
\ 'push',
\ 'refresh',
\ 'show',
\ 'taint',
\ 'untaint',
\ 'validate',
\ 'version',
\ 'workspace',
\ '0.12checklist',
\ 'debug',
\ 'force-unlock',
\ 'state'
\ ]
endfunction
let &cpoptions = s:cpo_save let &cpoptions = s:cpo_save
unlet s:cpo_save unlet s:cpo_save
@ -141,13 +58,14 @@ if !executable('terraform')
endif endif
let s:cpo_save = &cpoptions let s:cpo_save = &cpoptions
set cpoptions&vim
command! -nargs=+ -complete=customlist,s:commands -buffer Terraform execute '!terraform '.<q-args>. ' -no-color' command! -nargs=+ -complete=customlist,terraform#commands -buffer Terraform execute '!terraform '.<q-args>. ' -no-color'
command! -nargs=0 -buffer TerraformFmt call terraform#fmt() command! -nargs=0 -buffer TerraformFmt call terraform#fmt()
let b:undo_ftplugin .= '|delcommand Terraform|delcommand TerraformFmt' let b:undo_ftplugin .= '|delcommand Terraform|delcommand TerraformFmt'
if get(g:, 'terraform_fmt_on_save', 1) if get(g:, 'terraform_fmt_on_save', 0)
augroup terraform augroup vim.terraform.fmt
autocmd! autocmd!
autocmd BufWritePre *.tf call terraform#fmt() autocmd BufWritePre *.tf call terraform#fmt()
autocmd BufWritePre *.tfvars call terraform#fmt() autocmd BufWritePre *.tfvars call terraform#fmt()

14
indent/dune.vim Normal file
View File

@ -0,0 +1,14 @@
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'ocaml') != -1
finish
endif
" Vim indent file
" Language: dune
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
" dune format-dune-file uses 1 space to indent
set softtabstop=1 shiftwidth=1 expandtab

View File

@ -85,8 +85,17 @@ function! s:is_string_comment(lnum, col)
endif endif
endfunction endfunction
function GetRustIndent(lnum) if exists('*shiftwidth')
function! s:shiftwidth()
return shiftwidth()
endfunc
else
function! s:shiftwidth()
return &shiftwidth
endfunc
endif
function GetRustIndent(lnum)
" Starting assumption: cindent (called at the end) will do it right " Starting assumption: cindent (called at the end) will do it right
" normally. We just want to fix up a few cases. " normally. We just want to fix up a few cases.
@ -132,14 +141,65 @@ function GetRustIndent(lnum)
let prevline = s:get_line_trimmed(prevlinenum) let prevline = s:get_line_trimmed(prevlinenum)
endwhile endwhile
" A standalone '{', '}', or 'where'
let l:standalone_open = line =~# '\V\^\s\*{\s\*\$'
let l:standalone_close = line =~# '\V\^\s\*}\s\*\$'
let l:standalone_where = line =~# '\V\^\s\*where\s\*\$'
if l:standalone_open || l:standalone_close || l:standalone_where
" ToDo: we can search for more items than 'fn' and 'if'.
let [l:found_line, l:col, l:submatch] =
\ searchpos('\<\(fn\)\|\(if\)\>', 'bnWp')
if l:found_line !=# 0
" Now we count the number of '{' and '}' in between the match
" locations and the current line (there is probably a better
" way to compute this).
let l:i = l:found_line
let l:search_line = strpart(getline(l:i), l:col - 1)
let l:opens = 0
let l:closes = 0
while l:i < a:lnum
let l:search_line2 = substitute(l:search_line, '\V{', '', 'g')
let l:opens += strlen(l:search_line) - strlen(l:search_line2)
let l:search_line3 = substitute(l:search_line2, '\V}', '', 'g')
let l:closes += strlen(l:search_line2) - strlen(l:search_line3)
let l:i += 1
let l:search_line = getline(l:i)
endwhile
if l:standalone_open || l:standalone_where
if l:opens ==# l:closes
return indent(l:found_line)
endif
else
" Expect to find just one more close than an open
if l:opens ==# l:closes + 1
return indent(l:found_line)
endif
endif
endif
endif
" A standalone 'where' adds a shift.
let l:standalone_prevline_where = prevline =~# '\V\^\s\*where\s\*\$'
if l:standalone_prevline_where
return indent(prevlinenum) + 4
endif
" Handle where clauses nicely: subsequent values should line up nicely. " Handle where clauses nicely: subsequent values should line up nicely.
if prevline[len(prevline) - 1] ==# "," if prevline[len(prevline) - 1] ==# ","
\ && prevline =~# '^\s*where\s' \ && prevline =~# '^\s*where\s'
return indent(prevlinenum) + 6 return indent(prevlinenum) + 6
endif endif
if prevline[len(prevline) - 1] ==# "," let l:last_prevline_character = prevline[len(prevline) - 1]
\ && s:get_line_trimmed(a:lnum) !~# '^\s*[\[\]{}]'
" A line that ends with '.<expr>;' is probably an end of a long list
" of method operations.
if prevline =~# '\V\^\s\*.' && l:last_prevline_character ==# ';'
return indent(prevlinenum) - s:shiftwidth()
endif
if l:last_prevline_character ==# ","
\ && s:get_line_trimmed(a:lnum) !~# '^\s*[\[\]{})]'
\ && prevline !~# '^\s*fn\s' \ && prevline !~# '^\s*fn\s'
\ && prevline !~# '([^()]\+,$' \ && prevline !~# '([^()]\+,$'
\ && s:get_line_trimmed(a:lnum) !~# '^\s*\S\+\s*=>' \ && s:get_line_trimmed(a:lnum) !~# '^\s*\S\+\s*=>'

View File

@ -21,7 +21,10 @@ if exists("*GetScalaIndent")
finish finish
endif endif
let s:defMatcher = '\%(\%(private\|protected\)\%(\[[^\]]*\]\)\?\s\+\|abstract\s\+\|override\s\+\)*\<def\>' let s:annotationMatcher = '@[A-Za-z._]\+\s\+'
let s:modifierMatcher = s:annotationMatcher . '\|\%(private\|protected\)\%(\[[^\]]*\]\)\?\s\+\|abstract\s\+\|override\s\+\|final\s\+'
let s:defMatcher = '\%(' . s:modifierMatcher . '\)*\<def\>'
let s:valMatcher = '\%(' . s:modifierMatcher . '\|lazy\s\+\)*\<va[lr]\>'
let s:funcNameMatcher = '\w\+' let s:funcNameMatcher = '\w\+'
let s:typeSpecMatcher = '\%(\s*\[\_[^\]]*\]\)' let s:typeSpecMatcher = '\%(\s*\[\_[^\]]*\]\)'
let s:defArgMatcher = '\%((\_.\{-})\)' let s:defArgMatcher = '\%((\_.\{-})\)'
@ -185,7 +188,7 @@ function! scala#NumberOfBraceGroups(line)
endfunction endfunction
function! scala#MatchesIncompleteDefValr(line) function! scala#MatchesIncompleteDefValr(line)
if a:line =~ '^\s*\%(' . s:defMatcher . '\|\<va[lr]\>\).*[=({]\s*$' if a:line =~ '^\s*\%(' . s:defMatcher . '\|' . s:valMatcher . '\).*[=({]\s*$'
return 1 return 1
else else
return 0 return 0
@ -435,7 +438,7 @@ function! GetScalaIndent()
" If 'val', 'var', 'def' end with =, this is a one-line block " If 'val', 'var', 'def' end with =, this is a one-line block
if (prevline =~ '^\s*\<\%(\%(}\?\s*else\s\+\)\?if\|for\|while\)\>.*[)=]\s*$' && scala#NumberOfBraceGroups(prevline) <= 1) if (prevline =~ '^\s*\<\%(\%(}\?\s*else\s\+\)\?if\|for\|while\)\>.*[)=]\s*$' && scala#NumberOfBraceGroups(prevline) <= 1)
\ || prevline =~ '^\s*' . s:defMatcher . '.*=\s*$' \ || prevline =~ '^\s*' . s:defMatcher . '.*=\s*$'
\ || prevline =~ '^\s*\<va[lr]\>.*[=]\s*$' \ || prevline =~ '^\s*' . s:valMatcher . '.*[=]\s*$'
\ || prevline =~ '^\s*\%(}\s*\)\?\<else\>\s*$' \ || prevline =~ '^\s*\%(}\s*\)\?\<else\>\s*$'
\ || prevline =~ '=\s*$' \ || prevline =~ '=\s*$'
call scala#ConditionalConfirm("4") call scala#ConditionalConfirm("4")

View File

@ -34,24 +34,19 @@ function! TerraformIndent(lnum)
return 0 return 0
endif endif
" Previous non-blank line should continue the indent level " Usual case is to continue at the same indent as the previous non-blank line.
let prevlnum = prevnonblank(a:lnum-1) let prevlnum = prevnonblank(a:lnum-1)
let thisindent = indent(prevlnum)
" Previous line without comments should continue the indent level " If that previous line is a non-comment ending in [ { (, increase the
let prevline = substitute(getline(prevlnum), '//.*$', '', '') " indent level.
let previndent = indent(prevlnum) let prevline = getline(prevlnum)
let thisindent = previndent if prevline !~# '^\s*\(#\|//\)' && prevline =~# '[\[{\(]\s*$'
" Config block starting with [ { ( should increase the indent level
if prevline =~# '[\[{\(]\s*$'
let thisindent += &shiftwidth let thisindent += &shiftwidth
endif endif
" Current line without comments should continue the indent level " If the current line ends a block, decrease the indent level.
let thisline = substitute(getline(a:lnum), '//.*$', '', '') let thisline = getline(a:lnum)
" Config block ending with ) } ] should get the indentation
" level from the initial config block
if thisline =~# '^\s*[\)}\]]' if thisline =~# '^\s*[\)}\]]'
let thisindent -= &shiftwidth let thisindent -= &shiftwidth
endif endif

View File

@ -6,7 +6,7 @@ endif
" Language: Erlang (http://www.erlang.org) " Language: Erlang (http://www.erlang.org)
" Maintainer: Csaba Hoch <csaba.hoch@gmail.com> " Maintainer: Csaba Hoch <csaba.hoch@gmail.com>
" Contributor: Adam Rutkowski <hq@mtod.org> " Contributor: Adam Rutkowski <hq@mtod.org>
" Last Update: 2017-Mar-05 " Last Update: 2019-Jun-18
" License: Vim license " License: Vim license
" URL: https://github.com/vim-erlang/vim-erlang-runtime " URL: https://github.com/vim-erlang/vim-erlang-runtime
@ -121,7 +121,7 @@ syn keyword erlangBIF garbage_collect get get_keys group_leader contained
syn keyword erlangBIF halt hd integer_to_binary integer_to_list contained syn keyword erlangBIF halt hd integer_to_binary integer_to_list contained
syn keyword erlangBIF iolist_to_binary iolist_size is_alive contained syn keyword erlangBIF iolist_to_binary iolist_size is_alive contained
syn keyword erlangBIF is_atom is_binary is_bitstring is_boolean contained syn keyword erlangBIF is_atom is_binary is_bitstring is_boolean contained
syn keyword erlangBIF is_float is_function is_integer is_list is_map contained syn keyword erlangBIF is_float is_function is_integer is_list is_map is_map_key contained
syn keyword erlangBIF is_number is_pid is_port is_process_alive contained syn keyword erlangBIF is_number is_pid is_port is_process_alive contained
syn keyword erlangBIF is_record is_reference is_tuple length link contained syn keyword erlangBIF is_record is_reference is_tuple length link contained
syn keyword erlangBIF list_to_atom list_to_binary contained syn keyword erlangBIF list_to_atom list_to_binary contained

View File

@ -34,7 +34,7 @@ hi def link gitconfigBoolean Boolean
hi def link gitconfigNumber Number hi def link gitconfigNumber Number
hi def link gitconfigString String hi def link gitconfigString String
hi def link gitconfigDelim Delimiter hi def link gitconfigDelim Delimiter
hi def link gitconfigEscape Delimiter hi def link gitconfigEscape Special
hi def link gitconfigError Error hi def link gitconfigError Error
let b:current_syntax = "gitconfig" let b:current_syntax = "gitconfig"

View File

@ -65,7 +65,7 @@ syntax match jsFloat /\c\<\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%(e[+-]\=
" Regular Expressions " Regular Expressions
syntax match jsSpecial contained "\v\\%(x\x\x|u%(\x{4}|\{\x{4,5}})|c\u|.)" syntax match jsSpecial contained "\v\\%(x\x\x|u%(\x{4}|\{\x{4,5}})|c\u|.)"
syntax region jsTemplateExpression contained matchgroup=jsTemplateBraces start=+${+ end=+}+ contains=@jsExpression keepend syntax region jsTemplateExpression contained matchgroup=jsTemplateBraces start=+${+ end=+}+ contains=@jsExpression keepend
syntax region jsRegexpCharClass contained start=+\[+ skip=+\\.+ end=+\]+ contains=jsSpecial syntax region jsRegexpCharClass contained start=+\[+ skip=+\\.+ end=+\]+ contains=jsSpecial extend
syntax match jsRegexpBoundary contained "\v\c[$^]|\\b" syntax match jsRegexpBoundary contained "\v\c[$^]|\\b"
syntax match jsRegexpBackRef contained "\v\\[1-9]\d*" syntax match jsRegexpBackRef contained "\v\\[1-9]\d*"
syntax match jsRegexpQuantifier contained "\v[^\\]%([?*+]|\{\d+%(,\d*)?})\??"lc=1 syntax match jsRegexpQuantifier contained "\v[^\\]%([?*+]|\{\d+%(,\d*)?})\??"lc=1

View File

@ -94,7 +94,14 @@ execute 'syn match rstSubstitutionDefinition contained' .
\ ' /|.*|\_s\+/ nextgroup=@rstDirectives' \ ' /|.*|\_s\+/ nextgroup=@rstDirectives'
function! s:DefineOneInlineMarkup(name, start, middle, end, char_left, char_right) function! s:DefineOneInlineMarkup(name, start, middle, end, char_left, char_right)
execute 'syn match rstEscape'.a:name.' +\\\\\|\\'.a:start.'+'.' contained' " Only escape the first char of a multichar delimiter (e.g. \* inside **)
if a:start[0] == '\'
let first = a:start[0:1]
else
let first = a:start[0]
endif
execute 'syn match rstEscape'.a:name.' +\\\\\|\\'.first.'+'.' contained'
execute 'syn region rst' . a:name . execute 'syn region rst' . a:name .
\ ' start=+' . a:char_left . '\zs' . a:start . \ ' start=+' . a:char_left . '\zs' . a:start .
@ -170,7 +177,7 @@ syn match rstStandaloneHyperlink contains=@NoSpell
\ "\<\%(\%(\%(https\=\|file\|ftp\|gopher\)://\|\%(mailto\|news\):\)[^[:space:]'\"<>]\+\|www[[:alnum:]_-]*\.[[:alnum:]_-]\+\.[^[:space:]'\"<>]\+\)[[:alnum:]/]" \ "\<\%(\%(\%(https\=\|file\|ftp\|gopher\)://\|\%(mailto\|news\):\)[^[:space:]'\"<>]\+\|www[[:alnum:]_-]*\.[[:alnum:]_-]\+\.[^[:space:]'\"<>]\+\)[[:alnum:]/]"
syn region rstCodeBlock contained matchgroup=rstDirective syn region rstCodeBlock contained matchgroup=rstDirective
\ start=+\%(sourcecode\|code\%(-block\)\=\)::\s\+.*\_s*\n\ze\z(\s\+\)+ \ start=+\%(sourcecode\|code\%(-block\)\=\)::\s*\n\%(\s*:.*:\s*.*\s*\n\)*\n\ze\z(\s\+\)+
\ skip=+^$+ \ skip=+^$+
\ end=+^\z1\@!+ \ end=+^\z1\@!+
\ contains=@NoSpell \ contains=@NoSpell

View File

@ -153,7 +153,16 @@ syn region rustString start=+b"+ skip=+\\\\\|\\"+ end=+"+ contains=rustE
syn region rustString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustEscape,rustEscapeUnicode,rustEscapeError,rustStringContinuation,@Spell syn region rustString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustEscape,rustEscapeUnicode,rustEscapeError,rustStringContinuation,@Spell
syn region rustString start='b\?r\z(#*\)"' end='"\z1' contains=@Spell syn region rustString start='b\?r\z(#*\)"' end='"\z1' contains=@Spell
syn region rustAttribute start="#!\?\[" end="\]" contains=rustString,rustDerive,rustCommentLine,rustCommentBlock,rustCommentLineDocError,rustCommentBlockDocError " Match attributes with either arbitrary syntax or special highlighting for
" derives. We still highlight strings and comments inside of the attribute.
syn region rustAttribute start="#!\?\[" end="\]" contains=@rustAttributeContents,rustAttributeParenthesizedParens,rustAttributeParenthesizedCurly,rustAttributeParenthesizedBrackets,rustDerive
syn region rustAttributeParenthesizedParens matchgroup=rustAttribute start="\w\%(\w\)*("rs=e end=")"re=s transparent contained contains=rustAttributeBalancedParens,@rustAttributeContents
syn region rustAttributeParenthesizedCurly matchgroup=rustAttribute start="\w\%(\w\)*{"rs=e end="}"re=s transparent contained contains=rustAttributeBalancedCurly,@rustAttributeContents
syn region rustAttributeParenthesizedBrackets matchgroup=rustAttribute start="\w\%(\w\)*\["rs=e end="\]"re=s transparent contained contains=rustAttributeBalancedBrackets,@rustAttributeContents
syn region rustAttributeBalancedParens matchgroup=rustAttribute start="("rs=e end=")"re=s transparent contained contains=rustAttributeBalancedParens,@rustAttributeContents
syn region rustAttributeBalancedCurly matchgroup=rustAttribute start="{"rs=e end="}"re=s transparent contained contains=rustAttributeBalancedCurly,@rustAttributeContents
syn region rustAttributeBalancedBrackets matchgroup=rustAttribute start="\["rs=e end="\]"re=s transparent contained contains=rustAttributeBalancedBrackets,@rustAttributeContents
syn cluster rustAttributeContents contains=rustString,rustCommentLine,rustCommentBlock,rustCommentLineDocError,rustCommentBlockDocError
syn region rustDerive start="derive(" end=")" contained contains=rustDeriveTrait syn region rustDerive start="derive(" end=")" contained contains=rustDeriveTrait
" This list comes from src/libsyntax/ext/deriving/mod.rs " This list comes from src/libsyntax/ext/deriving/mod.rs
" Some are deprecated (Encodable, Decodable) or to be removed after a new snapshot (Show). " Some are deprecated (Encodable, Decodable) or to be removed after a new snapshot (Show).

View File

@ -50,6 +50,7 @@ syn cluster scssSelectors contains=@comment,cssSelectorOp,cssTagName,cssPseudoCl
syn match scssProperty "\([[:alnum:]-]\)\+\s*\(:\)\@=" contained contains=css.*Prop,cssVendor containedin=cssMediaBlock nextgroup=scssAttribute,scssAttributeWithNestedDefinition syn match scssProperty "\([[:alnum:]-]\)\+\s*\(:\)\@=" contained contains=css.*Prop,cssVendor containedin=cssMediaBlock nextgroup=scssAttribute,scssAttributeWithNestedDefinition
syn match scssAttribute ":[^;]*\ze\(;\|}\)" contained contains=css.*Attr,cssValue.*,cssColor,cssFunction,cssString.*,cssURL,scssFunction,scssInterpolation,scssVariable syn match scssAttribute ":[^;]*\ze\(;\|}\)" contained contains=css.*Attr,cssValue.*,cssColor,cssFunction,cssString.*,cssURL,scssFunction,scssInterpolation,scssVariable
syn match scssSemicolon ";" containedin=scssDefinition,scssNestedDefinition
syn match scssAttributeWithNestedDefinition ": [^#"]*{\@=" nextgroup=scssNestedDefinition contained contains=css.*Attr,cssValue.*,scssVariable syn match scssAttributeWithNestedDefinition ": [^#"]*{\@=" nextgroup=scssNestedDefinition contained contains=css.*Attr,cssValue.*,scssVariable
syn region scssNestedDefinition matchgroup=cssBraces start="{" end="}" contained contains=@comment,scssProperty,scssNestedProperty syn region scssNestedDefinition matchgroup=cssBraces start="{" end="}" contained contains=@comment,scssProperty,scssNestedProperty
@ -218,6 +219,7 @@ hi def link scssImport Include
hi def link scssTodo Todo hi def link scssTodo Todo
hi def link scssAtRoot Keyword hi def link scssAtRoot Keyword
hi def link scssMapParens Delimiter hi def link scssMapParens Delimiter
hi def link scssSemicolon Delimiter
let b:current_syntax = "scss" let b:current_syntax = "scss"
if main_syntax == 'scss' if main_syntax == 'scss'

View File

@ -48,7 +48,10 @@ syntax match svelteKeyword "#await" contained containedin=jsBlock,javascriptBloc
syntax match svelteKeyword "/await" contained containedin=jsBlock,javascriptBlock syntax match svelteKeyword "/await" contained containedin=jsBlock,javascriptBlock
syntax match svelteKeyword ":catch" contained containedin=jsBlock,javascriptBlock syntax match svelteKeyword ":catch" contained containedin=jsBlock,javascriptBlock
syntax match svelteKeyword ":then" contained containedin=jsBlock,javascriptBlock syntax match svelteKeyword ":then" contained containedin=jsBlock,javascriptBlock
" Inline keywords.
syntax match svelteKeyword "@html" contained containedin=jsBlock,javascriptBlock syntax match svelteKeyword "@html" contained containedin=jsBlock,javascriptBlock
syntax match svelteKeyword "@debug" contained containedin=jsBlock,javascriptBlock
" Repeat functions. " Repeat functions.
syntax match svelteRepeat "#each" contained containedin=jsBlock,javascriptBlock syntax match svelteRepeat "#each" contained containedin=jsBlock,javascriptBlock

View File

@ -9,6 +9,12 @@ if exists('b:current_syntax')
finish finish
endif endif
" Identifiers are made up of alphanumeric characters, underscores, and
" hyphens.
if has('patch-7.4.1142')
syn iskeyword a-z,A-Z,48-57,_,-
endif
syn case match syn case match
syn keyword terraSection connection output provider variable data terraform locals syn keyword terraSection connection output provider variable data terraform locals
@ -3732,7 +3738,7 @@ syn region terraDynamicName start=/"/ end=/"/ nextgroup=terraDynamicBlock skipwh
""" misc. """ misc.
syn match terraValueDec "\<[0-9]\+\([kKmMgG]b\?\)\?\>" syn match terraValueDec "\<[0-9]\+\([kKmMgG]b\?\)\?\>"
syn match terraValueHexaDec "\<0x[0-9a-f]\+\([kKmMgG]b\?\)\?\>" syn match terraValueHexaDec "\<0x[0-9a-f]\+\([kKmMgG]b\?\)\?\>"
syn match terraBraces "[{}\[\]]" syn match terraBraces "[\[\]]"
""" skip \" in strings. """ skip \" in strings.
""" we may also want to pass \\" into a function to escape quotes. """ we may also want to pass \\" into a function to escape quotes.
@ -3757,6 +3763,9 @@ syn keyword terraValueNull null
""" Terraform v0.12 """ Terraform v0.12
syn keyword terraTodo contained TF-UPGRADE-TODO syn keyword terraTodo contained TF-UPGRADE-TODO
" enable block folding
syn region terraBlock matchgroup=terraBraces start="{" end="}" fold transparent
hi def link terraComment Comment hi def link terraComment Comment
hi def link terraTodo Todo hi def link terraTodo Todo
hi def link terraBrackets Operator hi def link terraBrackets Operator