This commit is contained in:
Adam Stankiewicz
2020-04-25 21:03:34 +02:00
parent 14dc82fc4e
commit 68b2748af1
15 changed files with 292 additions and 300 deletions

View File

@@ -31,6 +31,11 @@ lockvar g:crystal#indent#sol
let g:crystal#indent#eol = '\s*\%(%}\)\=\ze\s*\%(#.*\)\=$'
lockvar g:crystal#indent#eol
" Regex that defines blocks.
let g:crystal#indent#block_regex =
\ '\%(\<do\>\|%\@1<!{\)\s*\%(|[^|]*|\)\='.g:crystal#indent#eol
lockvar g:crystal#indent#block_regex
" Regex that defines the start-match for the 'end' keyword.
" NOTE: This *should* properly match the 'do' only at the end of the
" line
@@ -43,7 +48,7 @@ let g:crystal#indent#end_start_regex =
\ '\<\%(if\|unless\|while\|until\|case\|begin\|for\|union\)\>' .
\ '\)' .
\ '\|' .
\ '.\{-}\zs\<do\s*\%(|.*|\)\='.g:crystal#indent#eol
\ g:crystal#indent#block_regex
lockvar g:crystal#indent#end_start_regex
" Regex that defines the middle-match for the 'end' keyword.
@@ -80,13 +85,15 @@ lockvar g:crystal#indent#crystal_type_declaration
" Regex that defines continuation lines, not including (, {, or [.
let g:crystal#indent#non_bracket_continuation_regex =
\ '\%(' .
\ '[\\.,:/%+\-=~<>|&^]' .
\ '[\\.,:/%+\-=~<>&^]' .
\ '\|' .
\ '\%(\%(\<do\>\|%\@1<!{\)\s*|[^|]*\)\@<!|' .
\ '\|' .
\ '\W?' .
\ '\|' .
\ '\<\%(if\|unless\)\>' .
\ '\|' .
\ '\%('.g:crystal#indent#sol.g:crystal#indent#crystal_type_declaration.'\h\k*\)\@<!\*' .
\ '\%('.g:crystal#indent#crystal_type_declaration.'\h\k*\)\@<!\*' .
\ '\)' .
\ g:crystal#indent#eol
lockvar g:crystal#indent#non_bracket_continuation_regex
@@ -117,19 +124,6 @@ lockvar g:crystal#indent#continuable_regex
let g:crystal#indent#splat_regex = '[[,(]\s*\*\s*\%(#.*\)\=$'
lockvar g:crystal#indent#splat_regex
" Regex that defines blocks.
"
" Note that there's a slight problem with this regex and crystal#indent#continuation_regex.
" Code like this will be matched by both:
"
" method_call do |(a, b)|
"
" The reason is that the pipe matches a hanging "|" operator.
"
let g:crystal#indent#block_regex =
\ '\%(\<do:\@!\>\|%\@1<!{\)\s*\%(|\s*(*\s*\%([*@&]\=\h\w*,\=\s*\)\%(,\s*(*\s*[*@&]\=\h\w*\s*)*\s*\)*|\)\=\s*\%(%}\)\=\s*\%(#.*\)\=$'
lockvar g:crystal#indent#block_regex
let g:crystal#indent#block_continuation_regex = '^\s*[^])}\t ].*'.g:crystal#indent#block_regex
lockvar g:crystal#indent#block_continuation_regex
@@ -368,4 +362,6 @@ function! crystal#indent#FindContainingClass() abort
return 0
endfunction
" vim: sw=2 sts=2 et:
endif

View File

@@ -368,4 +368,6 @@ endfunction
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: sw=2 sts=2 et:
endif

View File

@@ -31,4 +31,6 @@ function! ecrystal#SetSubtype() abort
endif
endfunction
" vim: sw=2 sts=2 et:
endif

View File

@@ -310,7 +310,7 @@ function! go#config#FmtAutosave() abort
endfunction
function! go#config#ImportsAutosave() abort
return get(g:, 'go_imports_autosave', 1)
return get(g:, 'go_imports_autosave', 0)
endfunction
function! go#config#SetFmtAutosave(value) abort

View File

@@ -502,13 +502,13 @@ function! s:SearchTestFunctionNameUnderCursor() abort
" Search the end of test function (closing brace) to ensure that the
" cursor position is within function definition
if maparg('<Plug>(MatchitNormalForward)') ==# ''
normal! %
keepjumps normal! %
else
" Prefer matchit.vim official plugin to native % since the plugin
" provides better behavior than original % (#391)
" To load the plugin, run:
" :packadd matchit
execute 'normal' "\<Plug>(MatchitNormalForward)"
execute 'keepjumps' 'normal' "\<Plug>(MatchitNormalForward)"
endif
if line('.') < cursor_line
return ''

View File

@@ -89,6 +89,6 @@ endif
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: nowrap sw=2 sts=2 ts=8:
" vim: sw=2 sts=2 et:
endif

View File

@@ -33,7 +33,7 @@ if exists("loaded_matchit")
" note: begin_keywords must contain all blocks, in order
" for nested-structures-skipping to work properly
" note: 'mutable struct' and 'strcut' are defined separately because
" note: 'mutable struct' and 'struct' are defined separately because
" using \? puts the cursor on 'struct' instead of 'mutable' for some reason
let b:julia_begin_keywords = '\%(\%(\.\s*\)\@<!\|\%(@\s*.\s*\)\@<=\)\<\%(function\|macro\|begin\|mutable\s\+struct\|\%(mutable\s\+\)\@<!struct\|\%(abstract\|primitive\)\s\+type\|let\|do\|\%(bare\)\?module\|quote\|if\|for\|while\|try\)\>'
" note: the following regex not only recognizes macros, but also local/global keywords.

View File

@@ -42,7 +42,7 @@ function GetCrystalIndent(...)
let clnum = a:0 ? a:1 : v:lnum
" Set up variables for restoring position in file
let vcol = col(clnum)
let vcol = col('.')
" Work on the current line {{{2
" ------------------------
@@ -170,7 +170,7 @@ function GetCrystalIndent(...)
"
" If it contained hanging closing brackets, find the rightmost one, find its
" match and indent according to that.
if line =~# '[[({]' || line =~# '[])}]\s*\%(#.*\)\=$'
if line =~# '[[({]' || line =~# '[])]\s*\%(#.*\)\=$'
let [opening, closing] = crystal#indent#ExtraBrackets(lnum)
if opening.pos != -1
@@ -186,7 +186,7 @@ function GetCrystalIndent(...)
endif
elseif closing.pos != -1
call cursor(lnum, closing.pos + 1)
normal! %
keepjumps normal! %
if crystal#indent#Match(line('.'), g:crystal#indent#crystal_indent_keywords)
return indent('.') + s:sw()

View File

@@ -370,23 +370,13 @@ function GetJuliaIndent()
" Analyse the reference line
let [num_open_blocks, num_closed_blocks] = GetJuliaNestingStruct(lnum, st, lim)
" Increase indentation for each newly opened block
" in the reference line
while num_open_blocks > 0
let ind += &sw
let num_open_blocks -= 1
endwhile
" Increase indentation for each newly opened block in the reference line
let ind += shiftwidth() * num_open_blocks
" Analyse the current line
let [num_open_blocks, num_closed_blocks] = GetJuliaNestingStruct(v:lnum)
" Decrease indentation for each closed block
" in the current line
while num_closed_blocks > 0
let ind -= &sw
let num_closed_blocks -= 1
endwhile
" Decrease indentation for each closed block in the current line
let ind -= shiftwidth() * num_closed_blocks
return ind
endfunction

View File

@@ -7,8 +7,9 @@ syntax match shellbang "^#!.*iojs\>"
"JavaScript comments
syntax keyword typescriptCommentTodo TODO FIXME XXX TBD
syntax match typescriptMagicComment "@ts-\%(ignore\|expect-error\)\>"
syntax match typescriptLineComment "//.*"
\ contains=@Spell,typescriptCommentTodo,typescriptRef
\ contains=@Spell,typescriptCommentTodo,typescriptRef,typescriptMagicComment
syntax region typescriptComment
\ start="/\*" end="\*/"
\ contains=@Spell,typescriptCommentTodo extend

View File

@@ -57,6 +57,7 @@ if exists("did_typescript_hilink")
HiLink typescriptLineComment Comment
HiLink typescriptDocComment Comment
HiLink typescriptCommentTodo Todo
HiLink typescriptMagicComment SpecialComment
HiLink typescriptRef Include
HiLink typescriptDocNotation SpecialComment
HiLink typescriptDocTags SpecialComment

View File

@@ -486,6 +486,6 @@ let b:current_syntax = 'crystal'
delc SynFold
" vim: nowrap sw=2 sts=2:
" vim: sw=2 sts=2 et:
endif

View File

@@ -197,7 +197,7 @@ syntax match juliaConstGeneric display "\<\%(nothing\|Main\|undef\|missing\)\>
syntax match juliaPossibleMacro transparent "@" contains=juliaMacroCall,juliaMacroCallP,juliaPrintfMacro
exec 'syntax match juliaMacro contained "@' . s:idregex . '\%(\.' . s:idregex . '\)*"'
syntax match juliaMacro contained "@\.\ze[^0-9]"
syntax match juliaMacro contained "@[!.~$%^*/\\|<>+-]\ze[^0-9]"
exec 'syntax region juliaMacroCall contained transparent start="\(@' . s:idregex . '\%(\.' . s:idregex . '\)*\)\@=\1\%([^(]\|$\)" end="\ze\%([])};#]\|$\|\<for\>\|\<end\>\)" contains=@juliaExpressions,juliaMacro,juliaSymbolS,juliaQuotedParBlockS'
exec 'syntax region juliaMacroCall contained transparent start="\(@.\)\@=\1\%([^(]\|$\)" end="\ze\%([])};#]\|$\|\<for\>\|\<end\>\)" contains=@juliaExpressions,juliaMacro,juliaSymbolS,juliaQuotedParBlockS'
exec 'syntax region juliaMacroCallP contained transparent start="@' . s:idregex . '\%(\.' . s:idregex . '\)*(" end=")\@'.s:d(1).'<=" contains=juliaMacro,juliaParBlock'

View File

@@ -58,8 +58,8 @@ endif
if s:Enabled('g:python_highlight_builtins')
call s:EnableByDefault('g:python_highlight_builtin_objs')
call s:EnableByDefault('g:python_highlight_builtin_funcs')
call s:EnableByDefault('g:python_highlight_builtin_types')
call s:EnableByDefault('g:python_highlight_builtin_funcs')
endif
"

View File

@@ -463,7 +463,7 @@ endif
syn match rubyDefinedOperator "\%#=1\<defined?" display
" 1.9-style Hash Keys and Keyword Parameters {{{1
syn match rubySymbol "\%([{(|,]\_s*\)\@<=\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[?!]\=::\@!"he=e-1
syn match rubySymbol "\%(\w\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[?!]\=::\@!"he=e-1 contained containedin=rubyBlockParameterList,rubyCurlyBlock
syn match rubySymbol "[]})\"':]\@1<!\<\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],;]\@="he=e-1
syn match rubySymbol "[[:space:],{(]\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],;]\@="hs=s+1,he=e-1