This commit is contained in:
Adam Stankiewicz
2020-04-14 13:17:26 +02:00
parent e86e0ad36e
commit 14dc82fc4e
58 changed files with 1505 additions and 666 deletions

View File

@@ -161,7 +161,7 @@ If you need full functionality of any plugin, please use it directly with your p
- [smt2](https://github.com/bohlender/vim-smt2) (syntax, autoload, ftplugin) - [smt2](https://github.com/bohlender/vim-smt2) (syntax, autoload, ftplugin)
- [solidity](https://github.com/tomlion/vim-solidity) (syntax, indent, ftplugin) - [solidity](https://github.com/tomlion/vim-solidity) (syntax, indent, ftplugin)
- [stylus](https://github.com/wavded/vim-stylus) (syntax, indent, ftplugin) - [stylus](https://github.com/wavded/vim-stylus) (syntax, indent, ftplugin)
- [svelte](https://github.com/evanleck/vim-svelte) (syntax, indent) - [svelte](https://github.com/evanleck/vim-svelte) (syntax, indent, ftplugin)
- [svg-indent](https://github.com/jasonshell/vim-svg-indent) (indent) - [svg-indent](https://github.com/jasonshell/vim-svg-indent) (indent)
- [svg](https://github.com/vim-scripts/svg.vim) (syntax) - [svg](https://github.com/vim-scripts/svg.vim) (syntax)
- [swift](https://github.com/keith/swift.vim) (syntax, indent, compiler, ftplugin, ctags) - [swift](https://github.com/keith/swift.vim) (syntax, indent, compiler, ftplugin, ctags)

View File

@@ -39,11 +39,11 @@ if exists("loaded_matchup")
let b:match_skip = 's:comment\|string' let b:match_skip = 's:comment\|string'
endif endif
let b:original_commentstring = &l:commentstring let b:jsx_pretty_old_cms = &l:commentstring
augroup jsx_comment augroup jsx_comment
autocmd! CursorMoved <buffer> autocmd! CursorMoved <buffer>
autocmd CursorMoved <buffer> call jsx_pretty#comment#update_commentstring(b:original_commentstring) autocmd CursorMoved <buffer> call jsx_pretty#comment#update_commentstring(b:jsx_pretty_old_cms)
augroup end augroup end
setlocal suffixesadd+=.jsx setlocal suffixesadd+=.jsx

View File

@@ -57,7 +57,7 @@ function! s:is_section_delim(line, func_delim) abort
return 0 return 0
endif endif
let kind = sec[0] let kind = sec[0]
return kind == s:KIND_BLOCK_PREC || kind == s:KIND_BLOCK_FOLLOW || kind == func_delim return kind == s:KIND_BLOCK_PREC || kind == s:KIND_BLOCK_FOLLOW || kind == a:func_delim
endfunction endfunction
function! s:next_section(stop_func_begin) abort function! s:next_section(stop_func_begin) abort
@@ -85,11 +85,16 @@ function! s:prev_section(stop_func_begin) abort
endwhile endwhile
endfunction endfunction
nnoremap <buffer><Plug>(llvm-next-section-begin) :<C-u>call <SID>next_section(1)<CR>
nnoremap <buffer><Plug>(llvm-prev-section-begin) :<C-u>call <SID>prev_section(1)<CR>
nnoremap <buffer><Plug>(llvm-next-section-end) :<C-u>call <SID>next_section(0)<CR>
nnoremap <buffer><Plug>(llvm-prev-section-end) :<C-u>call <SID>prev_section(0)<CR>
if !g:llvm_ext_no_mapping if !g:llvm_ext_no_mapping
nnoremap <buffer><silent>]] :<C-u>call <SID>next_section(1)<CR> nmap <buffer><silent>]] <Plug>(llvm-next-section-begin)
nnoremap <buffer><silent>[[ :<C-u>call <SID>prev_section(1)<CR> nmap <buffer><silent>[[ <Plug>(llvm-prev-section-begin)
nnoremap <buffer><silent>][ :<C-u>call <SID>next_section(0)<CR> nmap <buffer><silent>][ <Plug>(llvm-next-section-end)
nnoremap <buffer><silent>[] :<C-u>call <SID>prev_section(0)<CR> nmap <buffer><silent>[] <Plug>(llvm-prev-section-end)
endif endif
function! s:function_range_at(linum) abort function! s:function_range_at(linum) abort
@@ -222,9 +227,12 @@ function! s:move_to_following_block() abort
endtry endtry
endfunction endfunction
nnoremap <buffer><Plug>(llvm-move-block-prev) :<C-u>call <SID>move_to_pred_block()<CR>
nnoremap <buffer><Plug>(llvm-move-block-next) :<C-u>call <SID>move_to_following_block()<CR>
if !g:llvm_ext_no_mapping if !g:llvm_ext_no_mapping
nnoremap <buffer><silent>[b :<C-u>call <SID>move_to_pred_block()<CR> nmap <buffer><silent>[b <Plug>(llvm-move-block-prev)
nnoremap <buffer><silent>]b :<C-u>call <SID>move_to_following_block()<CR> nmap <buffer><silent>]b <Plug>(llvm-move-block-next)
endif endif
function! s:get_func_identifiers(line) abort function! s:get_func_identifiers(line) abort
@@ -438,8 +446,10 @@ function! s:goto_definition() abort
echom "No definition for '" . ident . "' found" echom "No definition for '" . ident . "' found"
endfunction endfunction
nnoremap <buffer><Plug>(llvm-goto-definition) :<C-u>call <SID>goto_definition()<CR>
if !g:llvm_ext_no_mapping if !g:llvm_ext_no_mapping
nnoremap <buffer><silent>K :<C-u>call <SID>goto_definition()<CR> nmap <buffer><silent>K <Plug>(llvm-goto-definition)
endif endif
function! s:run_lli(...) abort function! s:run_lli(...) abort

View File

@@ -20,11 +20,11 @@ if exists("loaded_matchup")
let b:match_skip = 's:comment\|string' let b:match_skip = 's:comment\|string'
endif endif
let b:original_commentstring = &l:commentstring let b:jsx_pretty_old_cms = &l:commentstring
augroup jsx_comment augroup jsx_comment
autocmd! CursorMoved <buffer> autocmd! CursorMoved <buffer>
autocmd CursorMoved <buffer> call jsx_pretty#comment#update_commentstring(b:original_commentstring) autocmd CursorMoved <buffer> call jsx_pretty#comment#update_commentstring(b:jsx_pretty_old_cms)
augroup end augroup end
setlocal suffixesadd+=.tsx setlocal suffixesadd+=.tsx

View File

@@ -25,6 +25,8 @@ if exists('s:did_indent')
let b:did_indent = s:did_indent let b:did_indent = s:did_indent
endif endif
runtime! indent/typescript.vim
setlocal indentexpr=GetJsxIndent() setlocal indentexpr=GetJsxIndent()
setlocal indentkeys=0.,0{,0},0),0],0?,0\*,0\,,!^F,:,<:>,o,O,e,<>>,=*/ setlocal indentkeys=0.,0{,0},0),0],0?,0\*,0\,,!^F,:,<:>,o,O,e,<>>,=*/

View File

@@ -1,6 +1,6 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
" Copyright (c) 2016-2019 Jon Parise <jon@indelible.org> " Copyright (c) 2016-2020 Jon Parise <jon@indelible.org>
" "
" Permission is hereby granted, free of charge, to any person obtaining a copy " Permission is hereby granted, free of charge, to any person obtaining a copy
" of this software and associated documentation files (the "Software"), to " of this software and associated documentation files (the "Software"), to

View File

@@ -1,6 +1,6 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
" Copyright (c) 2016-2019 Jon Parise <jon@indelible.org> " Copyright (c) 2016-2020 Jon Parise <jon@indelible.org>
" "
" Permission is hereby granted, free of charge, to any person obtaining a copy " Permission is hereby granted, free of charge, to any person obtaining a copy
" of this software and associated documentation files (the "Software"), to " of this software and associated documentation files (the "Software"), to

View File

@@ -102,6 +102,22 @@ function! cargo#bench(args)
call cargo#cmd("bench " . a:args) call cargo#cmd("bench " . a:args)
endfunction endfunction
function! cargo#update(args)
call cargo#cmd("update " . a:args)
endfunction
function! cargo#search(args)
call cargo#cmd("search " . a:args)
endfunction
function! cargo#publish(args)
call cargo#cmd("publish " . a:args)
endfunction
function! cargo#install(args)
call cargo#cmd("install " . a:args)
endfunction
function! cargo#runtarget(args) function! cargo#runtarget(args)
let l:filename = expand('%:p') let l:filename = expand('%:p')
let l:read_manifest = system('cargo read-manifest') let l:read_manifest = system('cargo read-manifest')

371
autoload/crystal/indent.vim Normal file
View File

@@ -0,0 +1,371 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
" Variables {{{1
" =========
" Regex of syntax group names that are strings or characters.
let g:crystal#indent#syng_string =
\ '\<crystal\%(String\|Interpolation\|NoInterpolation\|StringEscape\|CharLiteral\|ASCIICode\)\>'
lockvar g:crystal#indent#syng_string
" Regex of syntax group names that are strings, characters, symbols,
" regexps, or comments.
let g:crystal#indent#syng_strcom =
\ g:crystal#indent#syng_string.'\|' .
\ '\<crystal\%(Regexp\|RegexpEscape\|Symbol\|Comment\)\>'
lockvar g:crystal#indent#syng_strcom
" Expression used to check whether we should skip a match with searchpair().
let g:crystal#indent#skip_expr =
\ 'synIDattr(synID(line("."), col("."), 1), "name") =~# "'.g:crystal#indent#syng_strcom.'"'
lockvar g:crystal#indent#skip_expr
" Regex for the start of a line:
" start of line + whitespace + optional opening macro delimiter
let g:crystal#indent#sol = '^\s*\zs\%(\\\={%\s*\)\='
lockvar g:crystal#indent#sol
" Regex for the end of a line:
" whitespace + optional closing macro delimiter + whitespace +
" optional comment + end of line
let g:crystal#indent#eol = '\s*\%(%}\)\=\ze\s*\%(#.*\)\=$'
lockvar g:crystal#indent#eol
" Regex that defines the start-match for the 'end' keyword.
" NOTE: This *should* properly match the 'do' only at the end of the
" line
let g:crystal#indent#end_start_regex =
\ g:crystal#indent#sol .
\ '\%(' .
\ '\%(\<\%(private\|protected\)\s\+\)\=' .
\ '\%(\<\%(abstract\s\+\)\=\%(class\|struct\)\>\|\<\%(def\|module\|macro\|lib\|enum\)\>\)' .
\ '\|' .
\ '\<\%(if\|unless\|while\|until\|case\|begin\|for\|union\)\>' .
\ '\)' .
\ '\|' .
\ '.\{-}\zs\<do\s*\%(|.*|\)\='.g:crystal#indent#eol
lockvar g:crystal#indent#end_start_regex
" Regex that defines the middle-match for the 'end' keyword.
let g:crystal#indent#end_middle_regex =
\ g:crystal#indent#sol .
\ '\<\%(else\|elsif\|rescue\|ensure\|when\)\>'
lockvar g:crystal#indent#end_middle_regex
" Regex that defines the end-match for the 'end' keyword.
let g:crystal#indent#end_end_regex =
\ g:crystal#indent#sol .
\ '\<end\>'
lockvar g:crystal#indent#end_end_regex
" Regex used for words that add a level of indent.
let g:crystal#indent#crystal_indent_keywords =
\ g:crystal#indent#end_start_regex .
\ '\|' .
\ g:crystal#indent#end_middle_regex
lockvar g:crystal#indent#crystal_indent_keywords
" Regex used for words that remove a level of indent.
let g:crystal#indent#crystal_deindent_keywords =
\ g:crystal#indent#end_middle_regex .
\ '\|' .
\ g:crystal#indent#end_end_regex
lockvar g:crystal#indent#crystal_deindent_keywords
" Regex that defines a type declaration
let g:crystal#indent#crystal_type_declaration =
\ '@\=\h\k*\s\+:\s\+\S.*'
lockvar g:crystal#indent#crystal_type_declaration
" Regex that defines continuation lines, not including (, {, or [.
let g:crystal#indent#non_bracket_continuation_regex =
\ '\%(' .
\ '[\\.,:/%+\-=~<>|&^]' .
\ '\|' .
\ '\W?' .
\ '\|' .
\ '\<\%(if\|unless\)\>' .
\ '\|' .
\ '\%('.g:crystal#indent#sol.g:crystal#indent#crystal_type_declaration.'\h\k*\)\@<!\*' .
\ '\)' .
\ g:crystal#indent#eol
lockvar g:crystal#indent#non_bracket_continuation_regex
" Regex that defines bracket continuations
let g:crystal#indent#bracket_continuation_regex = '%\@1<!\%([({[]\)\s*\%(#.*\)\=$'
lockvar g:crystal#indent#bracket_continuation_regex
" Regex that defines continuation lines.
let g:crystal#indent#continuation_regex =
\ g:crystal#indent#non_bracket_continuation_regex .
\ '\|' .
\ g:crystal#indent#bracket_continuation_regex
lockvar g:crystal#indent#continuation_regex
" Regex that defines end of bracket continuation followed by another continuation
let g:crystal#indent#bracket_switch_continuation_regex =
\ '^\([^(]\+\zs).\+\)\+'.g:crystal#indent#continuation_regex
lockvar g:crystal#indent#bracket_switch_continuation_regex
" Regex that defines continuable keywords
let g:crystal#indent#continuable_regex =
\ '\%(^\s*\|[=,*/%+\-|;{]\|<<\|>>\|:\s\)\s*\zs' .
\ '\<\%(if\|for\|while\|until\|unless\):\@!\>'
lockvar g:crystal#indent#continuable_regex
" Regex that defines the first part of a splat pattern
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
" Regex that describes a leading operator (only a method call's dot for now)
let g:crystal#indent#leading_operator_regex = '^\s*[.]'
lockvar g:crystal#indent#leading_operator_regex
" Auxiliary Functions {{{1
" ===================
" Check if the character at lnum:col is inside a string, comment, or is ascii.
function! crystal#indent#IsInStringOrComment(lnum, col) abort
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~# g:crystal#indent#syng_strcom
endfunction
" Check if the character at lnum:col is inside a string or character.
function! crystal#indent#IsInString(lnum, col) abort
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~# g:crystal#indent#syng_string
endfunction
" Check if the character at lnum:col is inside a string or regexp
" delimiter
function! crystal#indent#IsInStringDelimiter(lnum, col) abort
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~# '\<crystal\%(StringDelimiter\|RegexpDelimiter\)\>'
endfunction
" Find line above 'lnum' that isn't empty, in a comment, or in a string.
function! crystal#indent#PrevNonBlankNonString(lnum) abort
let lnum = prevnonblank(a:lnum)
while lnum > 0
let line = getline(lnum)
let start = match(line, '\S')
if !crystal#indent#IsInStringOrComment(lnum, start + 1)
break
endif
let lnum = prevnonblank(lnum - 1)
endwhile
return lnum
endfunction
" Find line above 'lnum' that started the continuation 'lnum' may be part of.
function! crystal#indent#GetMSL(lnum) abort
" Start on the line we're at and use its indent.
let msl = a:lnum
let msl_body = getline(msl)
let lnum = crystal#indent#PrevNonBlankNonString(a:lnum - 1)
while lnum > 0
" If we have a continuation line, or we're in a string, use line as MSL.
" Otherwise, terminate search as we have found our MSL already.
let line = getline(lnum)
if crystal#indent#Match(msl, g:crystal#indent#leading_operator_regex)
" If the current line starts with a leading operator, keep its indent
" and keep looking for an MSL.
let msl = lnum
elseif crystal#indent#Match(lnum, g:crystal#indent#splat_regex)
" If the above line looks like the "*" of a splat, use the current one's
" indentation.
"
" Example:
" Hash[*
" method_call do
" something
"
return msl
elseif crystal#indent#Match(lnum, g:crystal#indent#non_bracket_continuation_regex) &&
\ crystal#indent#Match(msl, g:crystal#indent#non_bracket_continuation_regex)
" If the current line is a non-bracket continuation and so is the
" previous one, keep its indent and continue looking for an MSL.
"
" Example:
" method_call one,
" two,
" three
"
let msl = lnum
elseif crystal#indent#Match(lnum, g:crystal#indent#non_bracket_continuation_regex) &&
\ (
\ crystal#indent#Match(msl, g:crystal#indent#bracket_continuation_regex) ||
\ crystal#indent#Match(msl, g:crystal#indent#block_continuation_regex)
\ )
" If the current line is a bracket continuation or a block-starter, but
" the previous is a non-bracket one, respect the previous' indentation,
" and stop here.
"
" Example:
" method_call one,
" two {
" three
"
return lnum
elseif crystal#indent#Match(lnum, g:crystal#indent#bracket_continuation_regex) &&
\ (
\ crystal#indent#Match(msl, g:crystal#indent#bracket_continuation_regex) ||
\ crystal#indent#Match(msl, g:crystal#indent#block_continuation_regex)
\ )
" If both lines are bracket continuations (the current may also be a
" block-starter), use the current one's and stop here
"
" Example:
" method_call(
" other_method_call(
" foo
return msl
elseif crystal#indent#Match(lnum, g:crystal#indent#block_regex) &&
\ !crystal#indent#Match(msl, g:crystal#indent#continuation_regex) &&
\ !crystal#indent#Match(msl, g:crystal#indent#block_continuation_regex)
" If the previous line is a block-starter and the current one is
" mostly ordinary, use the current one as the MSL.
"
" Example:
" method_call do
" something
" something_else
return msl
else
let col = match(line, g:crystal#indent#continuation_regex) + 1
if (col > 0 && !crystal#indent#IsInStringOrComment(lnum, col))
\ || crystal#indent#IsInString(lnum, strlen(line))
let msl = lnum
else
break
endif
endif
let msl_body = getline(msl)
let lnum = crystal#indent#PrevNonBlankNonString(lnum - 1)
endwhile
return msl
endfunction
" Check if line 'lnum' has more opening brackets than closing ones.
function! crystal#indent#ExtraBrackets(lnum) abort
let opening = {'parentheses': [], 'braces': [], 'brackets': []}
let closing = {'parentheses': [], 'braces': [], 'brackets': []}
let line = getline(a:lnum)
let pos = match(line, '[][(){}]', 0)
" Save any encountered opening brackets, and remove them once a matching
" closing one has been found. If a closing bracket shows up that doesn't
" close anything, save it for later.
while pos != -1
if !crystal#indent#IsInStringOrComment(a:lnum, pos + 1)
if line[pos] ==# '('
call add(opening.parentheses, {'type': '(', 'pos': pos})
elseif line[pos] ==# ')'
if empty(opening.parentheses)
call add(closing.parentheses, {'type': ')', 'pos': pos})
else
let opening.parentheses = opening.parentheses[0:-2]
endif
elseif line[pos] ==# '{'
call add(opening.braces, {'type': '{', 'pos': pos})
elseif line[pos] ==# '}'
if empty(opening.braces)
call add(closing.braces, {'type': '}', 'pos': pos})
else
let opening.braces = opening.braces[0:-2]
endif
elseif line[pos] ==# '['
call add(opening.brackets, {'type': '[', 'pos': pos})
elseif line[pos] ==# ']'
if empty(opening.brackets)
call add(closing.brackets, {'type': ']', 'pos': pos})
else
let opening.brackets = opening.brackets[0:-2]
endif
endif
endif
let pos = match(line, '[][(){}]', pos + 1)
endwhile
" Find the rightmost brackets, since they're the ones that are important in
" both opening and closing cases
let rightmost_opening = {'type': '(', 'pos': -1}
let rightmost_closing = {'type': ')', 'pos': -1}
for opening in opening.parentheses + opening.braces + opening.brackets
if opening.pos > rightmost_opening.pos
let rightmost_opening = opening
endif
endfor
for closing in closing.parentheses + closing.braces + closing.brackets
if closing.pos > rightmost_closing.pos
let rightmost_closing = closing
endif
endfor
return [rightmost_opening, rightmost_closing]
endfunction
function! crystal#indent#Match(lnum, regex) abort
let regex = '\C'.a:regex
let line = getline(a:lnum)
let col = match(line, regex) + 1
while col &&
\ crystal#indent#IsInStringOrComment(a:lnum, col) ||
\ crystal#indent#IsInStringDelimiter(a:lnum, col)
let col = match(line, regex, col) + 1
endwhile
return col
endfunction
" Locates the containing class/module/struct/enum/lib's definition line,
" ignoring nested classes along the way.
function! crystal#indent#FindContainingClass() abort
let saved_position = getcurpos()
while searchpair(
\ g:crystal#indent#end_start_regex,
\ g:crystal#indent#end_middle_regex,
\ g:crystal#indent#end_end_regex,
\ 'bWz',
\ g:crystal#indent#skip_expr) > 0
if expand('<cword>') =~# '\<\%(class\|module\|struct\|enum\|lib\)\>'
let found_lnum = line('.')
call setpos('.', saved_position)
return found_lnum
endif
endwhile
call setpos('.', saved_position)
return 0
endfunction
endif

View File

@@ -69,6 +69,10 @@ fu! csv#Init(start, end, ...) "{{{3
else else
let b:csv_cmt = split(g:csv_comment, '%s') let b:csv_cmt = split(g:csv_comment, '%s')
endif endif
" Make sure it is a list with 2 chars
if b:csv_cmt == []
let b:csv_cmt = ["", ""]
endif
if empty(b:delimiter) && !exists("b:csv_fixed_width") if empty(b:delimiter) && !exists("b:csv_fixed_width")
call csv#Warn("No delimiter found. See :h csv-delimiter to set it manually!") call csv#Warn("No delimiter found. See :h csv-delimiter to set it manually!")

View File

@@ -86,7 +86,7 @@ endfunction
" If the path cannot be resolved, or is not a package: uri, returns the " If the path cannot be resolved, or is not a package: uri, returns the
" original. " original.
function! dart#resolveUri(uri) abort function! dart#resolveUri(uri) abort
if a:uri !~ 'package:' if a:uri !~# 'package:'
return a:uri return a:uri
endif endif
let package_name = substitute(a:uri, 'package:\(\w\+\)\/.*', '\1', '') let package_name = substitute(a:uri, 'package:\(\w\+\)\/.*', '\1', '')
@@ -118,20 +118,20 @@ function! s:PackageMap() abort
let lines = readfile(dot_packages) let lines = readfile(dot_packages)
let map = {} let map = {}
for line in lines for line in lines
if line =~ '\s*#' if line =~# '\s*#'
continue continue
endif endif
let package = substitute(line, ':.*$', '', '') let package = substitute(line, ':.*$', '', '')
let lib_dir = substitute(line, '^[^:]*:', '', '') let lib_dir = substitute(line, '^[^:]*:', '', '')
if lib_dir =~ 'file:/' if lib_dir =~# 'file:/'
let lib_dir = substitute(lib_dir, 'file://', '', '') let lib_dir = substitute(lib_dir, 'file://', '', '')
if lib_dir =~ '/[A-Z]:/' if lib_dir =~# '/[A-Z]:/'
let lib_dir = lib_dir[1:] let lib_dir = lib_dir[1:]
endif endif
else else
let lib_dir = resolve(dot_packages_dir.'/'.lib_dir) let lib_dir = resolve(dot_packages_dir.'/'.lib_dir)
endif endif
if lib_dir =~ '/$' if lib_dir =~# '/$'
let lib_dir = lib_dir[:len(lib_dir) - 2] let lib_dir = lib_dir[:len(lib_dir) - 2]
endif endif
let map[package] = lib_dir let map[package] = lib_dir
@@ -141,7 +141,7 @@ endfunction
" Toggle whether dartfmt is run on save or not. " Toggle whether dartfmt is run on save or not.
function! dart#ToggleFormatOnSave() abort function! dart#ToggleFormatOnSave() abort
if get(g:, "dart_format_on_save", 0) if get(g:, 'dart_format_on_save', 0)
let g:dart_format_on_save = 0 let g:dart_format_on_save = 0
return return
endif endif

34
autoload/ecrystal.vim Normal file
View File

@@ -0,0 +1,34 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
let s:ecrystal_extensions = {
\ 'cr': 'crystal',
\ 'yml': 'yaml',
\ 'js': 'javascript',
\ 'txt': 'text',
\ 'md': 'markdown'
\ }
if exists('g:ecrystal_extensions')
call extend(s:ecrystal_extensions, g:ecrystal_extensions, 'force')
endif
function! ecrystal#SetSubtype() abort
if exists('b:ecrystal_subtype')
return
endif
let b:ecrystal_subtype = matchstr(substitute(expand('%:t'), '\c\%(\.ecr\)\+$', '', ''), '\.\zs\w\+\%(\ze+\w\+\)\=$')
let b:ecrystal_subtype = get(s:ecrystal_extensions, b:ecrystal_subtype, b:ecrystal_subtype)
if b:ecrystal_subtype ==# ''
let b:ecrystal_subtype = get(g:, 'ecrystal_default_subtype', 'html')
endif
if b:ecrystal_subtype !=# ''
exec 'setlocal filetype=ecrystal.' . b:ecrystal_subtype
exec 'setlocal syntax=ecrystal.' . b:ecrystal_subtype
endif
endfunction
endif

View File

@@ -54,7 +54,7 @@ function! fish#Complete(findstart, base)
let l:completions = let l:completions =
\ system('fish -c "complete -C'.shellescape(a:base).'"') \ system('fish -c "complete -C'.shellescape(a:base).'"')
let l:cmd = substitute(a:base, '\v\S+$', '', '') let l:cmd = substitute(a:base, '\v\S+$', '', '')
for l:line in split(l:completions, '\n') for l:line in filter(split(l:completions, '\n'), 'len(v:val)')
let l:tokens = split(l:line, '\t') let l:tokens = split(l:line, '\t')
call add(l:results, {'word': l:cmd.l:tokens[0], call add(l:results, {'word': l:cmd.l:tokens[0],
\'abbr': l:tokens[0], \'abbr': l:tokens[0],

View File

@@ -309,6 +309,10 @@ function! go#config#FmtAutosave() abort
return get(g:, "go_fmt_autosave", 1) return get(g:, "go_fmt_autosave", 1)
endfunction endfunction
function! go#config#ImportsAutosave() abort
return get(g:, 'go_imports_autosave', 1)
endfunction
function! go#config#SetFmtAutosave(value) abort function! go#config#SetFmtAutosave(value) abort
let g:go_fmt_autosave = a:value let g:go_fmt_autosave = a:value
endfunction endfunction
@@ -353,6 +357,10 @@ function! go#config#FmtCommand() abort
return get(g:, "go_fmt_command", "gofmt") return get(g:, "go_fmt_command", "gofmt")
endfunction endfunction
function! go#config#ImportsMode() abort
return get(g:, "go_imports_mode", "goimports")
endfunction
function! go#config#FmtOptions() abort function! go#config#FmtOptions() abort
return get(b:, "go_fmt_options", get(g:, "go_fmt_options", {})) return get(b:, "go_fmt_options", get(g:, "go_fmt_options", {}))
endfunction endfunction
@@ -509,6 +517,10 @@ function! go#config#ReferrersMode() abort
return get(g:, 'go_referrers_mode', 'gopls') return get(g:, 'go_referrers_mode', 'gopls')
endfunction endfunction
function! go#config#ImplementsMode() abort
return get(g:, 'go_implements_mode', 'guru')
endfunction
function! go#config#GoplsCompleteUnimported() abort function! go#config#GoplsCompleteUnimported() abort
return get(g:, 'go_gopls_complete_unimported', v:null) return get(g:, 'go_gopls_complete_unimported', v:null)
endfunction endfunction
@@ -536,6 +548,14 @@ function! go#config#GoplsTempModfile() abort
return get(g:, 'go_gopls_temp_modfile', v:null) return get(g:, 'go_gopls_temp_modfile', v:null)
endfunction endfunction
function! go#config#GoplsAnalyses() abort
return get(g:, 'go_gopls_analyses', v:null)
endfunction
function! go#config#GoplsLocal() abort
return get(g:, 'go_gopls_local', v:null)
endfunction
function! go#config#GoplsEnabled() abort function! go#config#GoplsEnabled() abort
return get(g:, 'go_gopls_enabled', 1) return get(g:, 'go_gopls_enabled', 1)
endfunction endfunction

View File

@@ -1,6 +1,6 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
" Copyright (c) 2016-2019 Jon Parise <jon@indelible.org> " Copyright (c) 2016-2020 Jon Parise <jon@indelible.org>
" "
" Permission is hereby granted, free of charge, to any person obtaining a copy " Permission is hereby granted, free of charge, to any person obtaining a copy
" of this software and associated documentation files (the "Software"), to " of this software and associated documentation files (the "Software"), to

View File

@@ -1,20 +1,20 @@
if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1) if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)
function! jsx_pretty#comment#update_commentstring(original) function! jsx_pretty#comment#update_commentstring(original)
let syn_current = s:syn_name(line('.'), col('.')) let line = getline(".")
let syn_start = s:syn_name(line('.'), 1) let col = col('.')
if line !~# '^\s*$' && line[: col - 1] =~# '^\s*$' " skip indent
let col = indent('.') + 1
endif
let syn_start = s:syn_name(line('.'), col)
let save_cursor = getcurpos() let save_cursor = getcurpos()
if syn_start =~? '^jsx' if syn_start =~? '^jsx'
let line = getline(".")
let start = len(matchstr(line, '^\s*'))
let syn_name = s:syn_name(line('.'), start + 1)
if line =~ '^\s*//' if line =~ '^\s*//'
let &l:commentstring = '// %s' let &l:commentstring = '// %s'
elseif s:syn_contains(line('.'), col('.'), 'jsxTaggedRegion') elseif s:syn_contains(line('.'), col, 'jsxTaggedRegion')
let &l:commentstring = '<!-- %s -->' let &l:commentstring = '<!-- %s -->'
elseif syn_name =~? '^jsxAttrib' elseif syn_start =~? '^jsxAttrib'
let &l:commentstring = '// %s' let &l:commentstring = '// %s'
else else
let &l:commentstring = '{/* %s */}' let &l:commentstring = '{/* %s */}'

View File

@@ -502,13 +502,8 @@ class VimRubyCompletion
return if rails_base == nil return if rails_base == nil
$:.push rails_base unless $:.index( rails_base ) $:.push rails_base unless $:.index( rails_base )
rails_config = rails_base + "config/" bootfile = rails_base + "config/boot.rb"
rails_lib = rails_base + "lib/" envfile = rails_base + "config/environment.rb"
$:.push rails_config unless $:.index( rails_config )
$:.push rails_lib unless $:.index( rails_lib )
bootfile = rails_config + "boot.rb"
envfile = rails_config + "environment.rb"
if File.exists?( bootfile ) && File.exists?( envfile ) if File.exists?( bootfile ) && File.exists?( envfile )
begin begin
require bootfile require bootfile

View File

@@ -501,7 +501,15 @@ function! s:SearchTestFunctionNameUnderCursor() abort
" Search the end of test function (closing brace) to ensure that the " Search the end of test function (closing brace) to ensure that the
" cursor position is within function definition " cursor position is within function definition
normal! % if maparg('<Plug>(MatchitNormalForward)') ==# ''
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)"
endif
if line('.') < cursor_line if line('.') < cursor_line
return '' return ''
endif endif
@@ -543,21 +551,20 @@ function! rust#Test(mods, winsize, all, options) abort
let saved = getpos('.') let saved = getpos('.')
try try
let func_name = s:SearchTestFunctionNameUnderCursor() let func_name = s:SearchTestFunctionNameUnderCursor()
if func_name ==# ''
echohl ErrorMsg
echomsg 'No test function was found under the cursor. Please add ! to command if you want to run all tests'
echohl None
return
endif
if a:options ==# ''
execute cmd . 'cargo test --manifest-path' manifest func_name
else
execute cmd . 'cargo test --manifest-path' manifest func_name a:options
endif
return
finally finally
call setpos('.', saved) call setpos('.', saved)
endtry endtry
if func_name ==# ''
echohl ErrorMsg
echomsg 'No test function was found under the cursor. Please add ! to command if you want to run all tests'
echohl None
return
endif
if a:options ==# ''
execute cmd . 'cargo test --manifest-path' manifest func_name
else
execute cmd . 'cargo test --manifest-path' manifest func_name a:options
endif
endfunction endfunction
" }}}1 " }}}1

View File

@@ -5,9 +5,9 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ocaml') == -1
" Maintainer: Markus Mottl <markus.mottl@gmail.com> " Maintainer: Markus Mottl <markus.mottl@gmail.com>
" URL: http://www.ocaml.info/vim/compiler/ocaml.vim " URL: http://www.ocaml.info/vim/compiler/ocaml.vim
" Last Change: " Last Change:
" 2020 Mar 28 - Improved error format (Thomas Leonard)
" 2017 Nov 26 - Improved error format (Markus Mottl) " 2017 Nov 26 - Improved error format (Markus Mottl)
" 2013 Aug 27 - Added a new OCaml error format (Markus Mottl) " 2013 Aug 27 - Added a new OCaml error format (Markus Mottl)
" 2013 Jun 30 - Initial version (Marc Weber)
" "
" Marc Weber's comments: " Marc Weber's comments:
" Setting makeprg doesn't make sense, because there is ocamlc, ocamlopt, " Setting makeprg doesn't make sense, because there is ocamlc, ocamlopt,
@@ -33,6 +33,7 @@ let s:cpo_save = &cpo
set cpo&vim set cpo&vim
CompilerSet errorformat = CompilerSet errorformat =
\%EFile\ \"%f\"\\,\ lines\ %*\\d-%l\\,\ characters\ %c-%*\\d:,
\%EFile\ \"%f\"\\,\ line\ %l\\,\ characters\ %c-%*\\d:, \%EFile\ \"%f\"\\,\ line\ %l\\,\ characters\ %c-%*\\d:,
\%EFile\ \"%f\"\\,\ line\ %l\\,\ characters\ %c-%*\\d\ %.%#, \%EFile\ \"%f\"\\,\ line\ %l\\,\ characters\ %c-%*\\d\ %.%#,
\%EFile\ \"%f\"\\,\ line\ %l\\,\ character\ %c:%m, \%EFile\ \"%f\"\\,\ line\ %l\\,\ character\ %c:%m,

View File

@@ -17,21 +17,28 @@ let s:cpo_save = &cpo
set cpo-=C set cpo-=C
if !exists("g:ps1_makeprg_cmd") if !exists("g:ps1_makeprg_cmd")
if !has('win32') || executable('pwsh') if executable('pwsh')
" pwsh is the future " pwsh is the future
let g:ps1_makeprg_cmd = 'pwsh' let g:ps1_makeprg_cmd = 'pwsh'
elseif executable('pwsh.exe')
let g:ps1_makeprg_cmd = 'pwsh.exe'
elseif executable('powershell.exe')
let g:ps1_makeprg_cmd = 'powershell.exe'
else else
" powershell is Windows-only let g:ps1_makeprg_cmd = ''
let g:ps1_makeprg_cmd = 'powershell'
endif endif
endif endif
if !executable(g:ps1_makeprg_cmd)
echoerr "To use the powershell compiler, please set g:ps1_makeprg_cmd to the powershell executable!"
endif
" Show CategoryInfo, FullyQualifiedErrorId, etc? " Show CategoryInfo, FullyQualifiedErrorId, etc?
let g:ps1_efm_show_error_categories = get(g:, 'ps1_efm_show_error_categories', 0) let g:ps1_efm_show_error_categories = get(g:, 'ps1_efm_show_error_categories', 0)
" Use absolute path because powershell requires explicit relative paths " Use absolute path because powershell requires explicit relative paths
" (./file.ps1 is okay, but # expands to file.ps1) " (./file.ps1 is okay, but # expands to file.ps1)
let &l:makeprg = g:ps1_makeprg_cmd .' %:p' let &l:makeprg = g:ps1_makeprg_cmd .' %:p:S'
" Parse file, line, char from callstacks: " Parse file, line, char from callstacks:
" Write-Ouput : The term 'Write-Ouput' is not recognized as the name of a " Write-Ouput : The term 'Write-Ouput' is not recognized as the name of a

View File

@@ -26,7 +26,7 @@ else
if has('patch-7.4.191') if has('patch-7.4.191')
CompilerSet makeprg=rustc\ \%:S CompilerSet makeprg=rustc\ \%:S
else else
CompilerSet makeprg=rustc\ \% CompilerSet makeprg=rustc\ \"%\"
endif endif
endif endif

View File

@@ -111,7 +111,7 @@ function! s:isAnsible()
let filename = expand("%:t") let filename = expand("%:t")
if filepath =~ '\v/(tasks|roles|handlers)/.*\.ya?ml$' | return 1 | en if filepath =~ '\v/(tasks|roles|handlers)/.*\.ya?ml$' | return 1 | en
if filepath =~ '\v/(group|host)_vars/' | return 1 | en if filepath =~ '\v/(group|host)_vars/' | return 1 | en
if filename =~ '\v(playbook|site|main|local)\.ya?ml$' | return 1 | en if filename =~ '\v(playbook|site|main|local|requirements)\.ya?ml$' | return 1 | en
let shebang = getline(1) let shebang = getline(1)
if shebang =~# '^#!.*/bin/env\s\+ansible-playbook\>' | return 1 | en if shebang =~# '^#!.*/bin/env\s\+ansible-playbook\>' | return 1 | en
@@ -260,7 +260,14 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
" vint: -ProhibitAutocmdWithNoGroup " vint: -ProhibitAutocmdWithNoGroup
autocmd BufNewFile,BufReadPost *.cr setlocal filetype=crystal autocmd BufNewFile,BufReadPost *.cr setlocal filetype=crystal
autocmd BufNewFile,BufReadPost Projectfile setlocal filetype=crystal autocmd BufNewFile,BufReadPost Projectfile setlocal filetype=crystal
autocmd BufNewFile,BufReadPost *.ecr setlocal filetype=eruby augroup end
endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
augroup filetypedetect
" crystal, from ecrystal.vim in rhysd/vim-crystal
" vint: -ProhibitAutocmdWithNoGroup
autocmd BufNewFile,BufReadPost *.ecr setlocal filetype=ecrystal
augroup end augroup end
endif endif
@@ -290,16 +297,18 @@ endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dart') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dart') == -1
augroup filetypedetect augroup filetypedetect
" dart, from dart.vim in dart-lang/dart-vim-plugin " dart, from dart.vim in dart-lang/dart-vim-plugin
autocmd BufRead,BufNewFile *.dart set filetype=dart augroup dart-vim-plugin-ftdetec
autocmd!
autocmd BufRead,BufNewFile *.dart set filetype=dart
autocmd BufRead * call s:DetectShebang()
augroup END
function! s:DetectShebang() function! s:DetectShebang()
if did_filetype() | return | endif if did_filetype() | return | endif
if getline(1) == '#!/usr/bin/env dart' if getline(1) ==# '#!/usr/bin/env dart'
setlocal filetype=dart setlocal filetype=dart
endif endif
endfunction endfunction
autocmd BufRead * call s:DetectShebang()
augroup end augroup end
endif endif
@@ -522,7 +531,7 @@ endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
augroup filetypedetect augroup filetypedetect
" graphql, from graphql.vim in jparise/vim-graphql:_ALL " graphql, from graphql.vim in jparise/vim-graphql:_ALL
" Copyright (c) 2016-2019 Jon Parise <jon@indelible.org> " Copyright (c) 2016-2020 Jon Parise <jon@indelible.org>
" "
" Permission is hereby granted, free of charge, to any person obtaining a copy " Permission is hereby granted, free of charge, to any person obtaining a copy
" of this software and associated documentation files (the "Software"), to " of this software and associated documentation files (the "Software"), to

View File

@@ -5,6 +5,11 @@ if exists('b:did_ftplugin')
endif endif
let b:did_ftplugin = 1 let b:did_ftplugin = 1
" This file is loaded on 'ecrystal' filetype
if &filetype !=# 'crystal'
finish
endif
let s:save_cpo = &cpo let s:save_cpo = &cpo
set cpo&vim set cpo&vim
@@ -76,6 +81,11 @@ if &l:ofu ==# ''
setlocal omnifunc=crystal_lang#complete setlocal omnifunc=crystal_lang#complete
endif endif
if exists('AutoPairsLoaded')
let b:AutoPairs = { '{%': '%}' }
call extend(b:AutoPairs, g:AutoPairs, 'force')
endif
let &cpo = s:save_cpo let &cpo = s:save_cpo
unlet s:save_cpo unlet s:save_cpo

100
ftplugin/ecrystal.vim Normal file
View File

@@ -0,0 +1,100 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
if exists('b:did_ftplugin')
finish
endif
" Define some defaults in case the included ftplugins don't set them.
let s:comments = ''
let s:shiftwidth = ''
let s:undo_ftplugin = ''
let s:browsefilter = 'All Files (*.*)\t*.*\n'
let s:match_words = ''
call ecrystal#SetSubtype()
if b:ecrystal_subtype !=# ''
exe 'runtime! ftplugin/'.b:ecrystal_subtype.'.vim ftplugin/'.b:ecrystal_subtype.'_*.vim ftplugin/'.b:ecrystal_subtype.'/*.vim'
unlet! b:did_ftplugin
" Keep the comments for this filetype
let s:comments = escape(&comments, ' \')
" Keep the shiftwidth for this filetype
let s:shiftwidth = &shiftwidth
" Override our defaults if these were set by an included ftplugin.
if exists('b:undo_ftplugin')
let s:undo_ftplugin = b:undo_ftplugin
unlet b:undo_ftplugin
endif
if exists('b:browsefilter')
let s:browsefilter = b:browsefilter
unlet b:browsefilter
endif
if exists('b:match_words')
let s:match_words = b:match_words
unlet b:match_words
endif
endif
runtime! ftplugin/crystal.vim ftplugin/crystal_*.vim ftplugin/crystal/*.vim
let b:did_ftplugin = 1
" Combine the new set of values with those previously included.
if exists('b:undo_ftplugin')
let s:undo_ftplugin = b:undo_ftplugin . ' | ' . s:undo_ftplugin
endif
if exists ('b:browsefilter')
let s:browsefilter = substitute(b:browsefilter,'\cAll Files (\*\.\*)\t\*\.\*\n','','') . s:browsefilter
endif
if exists('b:match_words')
let s:match_words = b:match_words . ',' . s:match_words
endif
" Change the browse dialog on Win32 to show mainly eCrystal-related files
if has('gui_win32')
let b:browsefilter='eCrystal Files (*.ecr)\t*.ecr\n' . s:browsefilter
endif
" Load the combined list of match_words for matchit.vim
if exists('loaded_matchit')
let b:match_words = s:match_words
endif
" Define additional pairs for jiangmiao/auto-pairs
if exists('AutoPairsLoaded')
let b:AutoPairs = {
\ '<%': '%>',
\ '<%=': '%>',
\ '<%#': '%>',
\ '<%-': '-%>',
\ '<%-=': '-%>',
\ '<%-#': '-%>',
\ }
call extend(b:AutoPairs, g:AutoPairs, 'force')
endif
" Load the subtype's vim-endwise settings
if exists('loaded_endwise') && b:ecrystal_subtype !=# ''
exec 'doautocmd endwise FileType ' . b:ecrystal_subtype
endif
" Start RagTag
if exists('loaded_ragtag')
call RagtagInit()
endif
exec 'setlocal comments='.s:comments
exec 'setlocal shiftwidth='.s:shiftwidth
setlocal commentstring=<%#%s%>
setlocal suffixesadd=.ecr
let b:undo_ftplugin = 'setlocal comments< commentstring< shiftwidth<' .
\ '| unlet! b:browsefilter b:match_words ' .
\ '| unlet! b:AutoPairs ' .
\ '| ' . s:undo_ftplugin
endif

View File

@@ -7,7 +7,6 @@ setlocal foldexpr=fish#Fold()
setlocal formatoptions+=ron1 setlocal formatoptions+=ron1
setlocal formatoptions-=t setlocal formatoptions-=t
setlocal include=\\v^\\s*\\.> setlocal include=\\v^\\s*\\.>
setlocal iskeyword=@,48-57,-,_,.,/
setlocal suffixesadd^=.fish setlocal suffixesadd^=.fish
" Use the 'j' format option when available. " Use the 'j' format option when available.

View File

@@ -1,6 +1,6 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
" Copyright (c) 2016-2019 Jon Parise <jon@indelible.org> " Copyright (c) 2016-2020 Jon Parise <jon@indelible.org>
" "
" Permission is hereby granted, free of charge, to any person obtaining a copy " Permission is hereby granted, free of charge, to any person obtaining a copy
" of this software and associated documentation files (the "Software"), to " of this software and associated documentation files (the "Software"), to

View File

@@ -30,8 +30,30 @@ if has("gui_win32")
\ "All Files (*.*)\t*.*\n" \ "All Files (*.*)\t*.*\n"
endif endif
" Look up keywords by Get-Help:
" check for PowerShell Core in Windows, Linux or MacOS
if executable('pwsh') | let s:pwsh_cmd = 'pwsh'
" on Windows Subsystem for Linux, check for PowerShell Core in Windows
elseif exists('$WSLENV') && executable('pwsh.exe') | let s:pwsh_cmd = 'pwsh.exe'
" check for PowerShell <= 5.1 in Windows
elseif executable('powershell.exe') | let s:pwsh_cmd = 'powershell.exe'
endif
if exists('s:pwsh_cmd')
if !has('gui_running') && executable('less') &&
\ !(exists('$ConEmuBuild') && &term =~? '^xterm')
" For exclusion of ConEmu, see https://github.com/Maximus5/ConEmu/issues/2048
command! -buffer -nargs=1 GetHelp silent exe '!' . s:pwsh_cmd . ' -NoLogo -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -Command Get-Help -Full "<args>" | ' . (has('unix') ? 'LESS= less' : 'less') | redraw!
elseif has('terminal')
command! -buffer -nargs=1 GetHelp silent exe 'term ' . s:pwsh_cmd . ' -NoLogo -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -Command Get-Help -Full "<args>"' . (executable('less') ? ' | less' : '')
else
command! -buffer -nargs=1 GetHelp echo system(s:pwsh_cmd . ' -NoLogo -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -Command Get-Help -Full <args>')
endif
endif
setlocal keywordprg=:GetHelp
" Undo the stuff we changed " Undo the stuff we changed
let b:undo_ftplugin = "setlocal tw< cms< fo<" . let b:undo_ftplugin = "setlocal tw< cms< fo< iskeyword< keywordprg<" .
\ " | unlet! b:browsefilter" \ " | unlet! b:browsefilter"

View File

@@ -55,8 +55,6 @@ endfunction
vnoremap <buffer> K :call <SID>Racket_visual_doc()<cr> vnoremap <buffer> K :call <SID>Racket_visual_doc()<cr>
nnoremap <buffer> <f9> :!racket -t %<cr>
"setl commentstring=;;%s "setl commentstring=;;%s
setl commentstring=#\|\ %s\ \|# setl commentstring=#\|\ %s\ \|#

View File

@@ -1,30 +1,10 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'razor') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'razor') == -1
" Vim filetype plugin
" Language: LessCSS
" Author: Tim Pope <vimNOSPAM@tpope.org>
" Maintainer: Leonard Ehrenfried <leonard.ehrenfried@web.de>
" Last Change: 2011 Sep 30
" Only do this when not done yet for this buffer
:UltiSnipsAddFiletypes razor.html
if exists("b:did_ftplugin") if exists("b:did_ftplugin")
finish finish
endif endif
let b:did_ftplugin = 1 let b:did_ftplugin = 1
"let b:undo_ftplugin = "setl cms< def< inc< inex< ofu< sua<"
"setlocal iskeyword+=-
"setlocal commentstring=//\ %s
"setlocal define=^\\s*\\%(@mixin\\\|=\\)
"setlocal includeexpr=substitute(v:fname,'\\%(.*/\\\|^\\)\\zs','_','')
"setlocal omnifunc=csscomplete#CompleteCSS
"setlocal suffixesadd=.less
"let &l:include = '^\s*@import\s\+\%(url(\)\=["'']\='
" vim:set sw=2: " vim:set sw=2:
endif endif

View File

@@ -123,7 +123,7 @@ command! -nargs=* -buffer RustEmitAsm call rust#Emit("asm", <q-args>)
command! -range=% RustPlay :call rust#Play(<count>, <line1>, <line2>, <f-args>) command! -range=% RustPlay :call rust#Play(<count>, <line1>, <line2>, <f-args>)
" See |:RustFmt| for docs " See |:RustFmt| for docs
command! -buffer RustFmt call rustfmt#Format() command! -bar -buffer RustFmt call rustfmt#Format()
" See |:RustFmtRange| for docs " See |:RustFmtRange| for docs
command! -range -buffer RustFmtRange call rustfmt#FormatRange(<line1>, <line2>) command! -range -buffer RustFmtRange call rustfmt#FormatRange(<line1>, <line2>)

47
ftplugin/svelte.vim Normal file
View File

@@ -0,0 +1,47 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'svelte') == -1
" Vim filetype plugin
" Language: Svelte 3 (HTML/JavaScript)
" Author: Evan Lecklider <evan@lecklider.com>
" Maintainer: Evan Lecklide <evan@lecklider.com>
" URL: https://github.com/evanleck/vim-svelte
if (exists('b:did_ftplugin'))
finish
endif
let b:did_ftplugin = 1
" Matchit support
if exists('loaded_matchit') && !exists('b:match_words')
let b:match_ignorecase = 0
" In order:
"
" 1. Svelte control flow keywords.
" 2. Parens.
" 3-5. HTML tags pulled from Vim itself.
"
" https://github.com/vim/vim/blob/5259275347667a90fb88d8ea74331f88ad68edfc/runtime/ftplugin/html.vim#L29-L35
let b:match_words =
\ '#\%(if\|await\|each\)\>:\:\%(else\|catch\|then\)\>:\/\%(if\|await\|each\)\>,' .
\ '{:},' .
\ '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' .
\ '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' .
\ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'
endif
" ALE fixing and linting.
if exists('g:loaded_ale')
if !exists('b:ale_fixers')
let b:ale_fixers = ['eslint', 'prettier', 'prettier_standard']
endif
if !exists('b:ale_linter_aliases')
let b:ale_linter_aliases = ['css', 'javascript']
endif
if !exists('b:ale_linters')
let b:ale_linters = ['stylelint', 'eslint']
endif
endif
endif

View File

@@ -10,6 +10,10 @@ if exists("loaded_matchit") && !exists('b:tsx_match_words')
\ : b:tsx_match_words \ : b:tsx_match_words
endif endif
" Comment formatting
setlocal comments=s1:/*,mb:*,ex:*/,://
setlocal formatoptions-=t formatoptions+=croql
set suffixesadd+=.tsx set suffixesadd+=.tsx
endif endif

View File

@@ -37,7 +37,7 @@ endfunction
command! -buffer -bar CCode call CCode() command! -buffer -bar CCode call CCode()
command! -buffer -bar ValaCodingStyle call ValaCodingStyle() command! -buffer -bar ValaCodingStyle call ValaCodingStyle()
if get(g:, 'vala_syntax_folding_enabled', 1) if get(g:, 'vala_syntax_folding_enabled', 0)
setlocal foldmethod=syntax setlocal foldmethod=syntax
endif endif

View File

@@ -6,431 +6,78 @@ if exists('b:did_indent')
endif endif
let b:did_indent = 1 let b:did_indent = 1
if !exists('g:crystal_indent_access_modifier_style')
" Possible values: "normal", "indent", "outdent"
let g:crystal_indent_access_modifier_style = 'normal'
endif
setlocal nosmartindent setlocal nosmartindent
" Now, set up our indentation expression and keys that trigger it. " Now, set up our indentation expression and keys that trigger it.
setlocal indentexpr=GetCrystalIndent(v:lnum) setlocal indentexpr=GetCrystalIndent(v:lnum)
setlocal indentkeys=0{,0},0),0],!^F,o,O,e,:,. setlocal indentkeys=0{,0},0),0],!^F,o,O,e,:,.
setlocal indentkeys+==end,=else,=elsif,=when,=ensure,=rescue,==begin,==end setlocal indentkeys+==end,=else,=elsif,=when,=ensure,=rescue
setlocal indentkeys+==private,=protected setlocal indentkeys+==private,=protected
let s:cpo_save = &cpo
set cpo&vim
" Only define the function once. " Only define the function once.
if exists('*GetCrystalIndent') if exists('*GetCrystalIndent')
finish finish
endif endif
let s:cpo_save = &cpo " Return the value of a single shift-width
set cpo&vim if exists('*shiftwidth')
let s:sw = function('shiftwidth')
else
function s:sw()
return &shiftwidth
endfunction
endif
" 1. Variables {{{1 " GetCrystalIndent Function {{{1
" ============
" Regex of syntax group names that are or delimit strings/symbols or are comments.
let s:syng_strcom = '\<crystal\%(Regexp\|RegexpDelimiter\|RegexpEscape' .
\ '\|Symbol\|String\|StringDelimiter\|StringEscape\|CharLiteral\|ASCIICode' .
\ '\|Interpolation\|InterpolationDelimiter\|NoInterpolation\|Comment\|Documentation\)\>'
" Regex of syntax group names that are strings.
let s:syng_string =
\ '\<crystal\%(String\|Interpolation\|NoInterpolation\|StringEscape\)\>'
" Regex of syntax group names that are strings or documentation.
let s:syng_stringdoc =
\'\<crystal\%(String\|Interpolation\|NoInterpolation\|StringEscape\|Documentation\)\>'
" Expression used to check whether we should skip a match with searchpair().
let s:skip_expr =
\ "synIDattr(synID(line('.'),col('.'),1),'name') =~ '".s:syng_strcom."'"
" Regex used for words that, at the start of a line, add a level of indent.
let s:crystal_indent_keywords =
\ '^\s*\zs\<\%(\%(\%(private\|protected\)\s\+\)\=\%(abstract\s\+\)\=\%(class\|struct\)' .
\ '\|if\|for\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure\|rescue\|union' .
\ '\|\%(private\|protected\)\=\s*\%(def\|class\|struct\|module\|macro\|lib\|enum\)\):\@!\>' .
\ '\|\%([=,*/%+-]\|<<\|>>\|:\s\)\s*\zs' .
\ '\<\%(if\|for\|while\|until\|case\|unless\|begin\):\@!\>' .
\ '\|{%\s*\<\%(if\|for\|while\|until\|case\|unless\|begin\|else\|elsif\|when\)'
" Regex used for words that, at the start of a line, remove a level of indent.
let s:crystal_deindent_keywords =
\ '^\s*\zs\<\%(ensure\|else\|rescue\|elsif\|when\|end\):\@!\>' .
\ '\|{%\s*\<\%(ensure\|else\|rescue\|elsif\|when\|end\)\>'
" Regex that defines the start-match for the 'end' keyword.
" TODO: the do here should be restricted somewhat (only at end of line)?
let s:end_start_regex =
\ '{%\s*\<\%(if\|for\|while\|until\|unless\|begin\)\>\|' .
\ '\C\%(^\s*\|[=,*/%+\-|;{]\|<<\|>>\|:\s\)\s*\zs' .
\ '\<\%(\%(\%(private\|protected\)\s\+\)\=\%(abstract\s\+\)\=\%(class\|struct\)' .
\ '\|if\|for\|while\|until\|case\|unless\|begin\|union' .
\ '\|\%(private\|protected\)\=\s*\%(def\|lib\|enum\|macro\|module\)\):\@!\>' .
\ '\|\%(^\|[^.:@$]\)\@<=\<do:\@!\>'
" Regex that defines the middle-match for the 'end' keyword.
let s:end_middle_regex =
\ '{%\s*\<\%(ensure\|else\|when\|elsif\)\>\s*%}\|' .
\ '\<\%(ensure\|else\|\%(\%(^\|;\)\s*\)\@<=\<rescue:\@!\>\|when\|elsif\):\@!\>'
" Regex that defines the end-match for the 'end' keyword.
let s:end_end_regex = '\%(^\|[^.:@$]\)\@<=\<end:\@!\>\|{%\s*\<\%(end\)\>'
" Expression used for searchpair() call for finding match for 'end' keyword.
let s:end_skip_expr = s:skip_expr .
\ ' || (expand("<cword>") == "do"' .
\ ' && getline(".") =~ "^\\s*\\<\\(while\\|until\\|for\\):\\@!\\>")'
" Regex that defines continuation lines, not including (, {, or [.
let s:non_bracket_continuation_regex = '\%([\\.,:*/%+]\|\<and\|\<or\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\)\s*\%(#.*\)\=$'
" Regex that defines continuation lines.
let s:continuation_regex =
\ '\%(%\@<![({[\\.,:*/%+]\|\<and\|\<or\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\)\s*\%(#.*\)\=$'
" Regex that defines continuable keywords
let s:continuable_regex =
\ '\C\%(^\s*\|[=,*/%+\-|;{]\|<<\|>>\|:\s\)\s*\zs' .
\ '\<\%(if\|for\|while\|until\|unless\):\@!\>'
" Regex that defines bracket continuations
let s:bracket_continuation_regex = '%\@<!\%([({[]\)\s*\%(#.*\)\=$'
" Regex that defines end of bracket continuation followed by another continuation
let s:bracket_switch_continuation_regex = '^\([^(]\+\zs).\+\)\+'.s:continuation_regex
" Regex that defines the first part of a splat pattern
let s:splat_regex = '[[,(]\s*\*\s*\%(#.*\)\=$'
" Regex that defines blocks.
"
" Note that there's a slight problem with this regex and s: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 s:block_regex =
\ '\%(\<do:\@!\>\|%\@<!{\)\s*\%(|\s*(*\s*\%([*@&]\=\h\w*,\=\s*\)\%(,\s*(*\s*[*@&]\=\h\w*\s*)*\s*\)*|\)\=\s*\%(#.*\)\=$'
let s:block_continuation_regex = '^\s*[^])}\t ].*'.s:block_regex
" Regex that describes a leading operator (only a method call's dot for now)
let s:leading_operator_regex = '^\s*[.]'
" Regex that describes all indent access modifiers
let s:access_modifier_regex = '\C^\s*\%(protected\|private\)\s*\%(#.*\)\=$'
" 2. Auxiliary Functions {{{1
" ======================
" Check if the character at lnum:col is inside a string, comment, or is ascii.
function s:IsInStringOrComment(lnum, col)
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~# s:syng_strcom
endfunction
" Check if the character at lnum:col is inside a string.
function s:IsInString(lnum, col)
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~# s:syng_string
endfunction
" Check if the character at lnum:col is inside a string or documentation.
function s:IsInStringOrDocumentation(lnum, col)
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~# s:syng_stringdoc
endfunction
" Check if the character at lnum:col is inside a string delimiter
function s:IsInStringDelimiter(lnum, col)
return synIDattr(synID(a:lnum, a:col, 1), 'name') ==# 'crystalStringDelimiter'
endfunction
" Find line above 'lnum' that isn't empty, in a comment, or in a string.
function s:PrevNonBlankNonString(lnum)
let in_block = 0
let lnum = prevnonblank(a:lnum)
while lnum > 0
" Go in and out of blocks comments as necessary.
" If the line isn't empty (with opt. comment) or in a string, end search.
let line = getline(lnum)
if line =~# '^=begin'
if in_block
let in_block = 0
else
break
endif
elseif !in_block && line =~# '^=end'
let in_block = 1
elseif !in_block && line !~# '^\s*#.*$' && !(s:IsInStringOrComment(lnum, 1)
\ && s:IsInStringOrComment(lnum, strlen(line)))
break
endif
let lnum = prevnonblank(lnum - 1)
endwhile
return lnum
endfunction
" Find line above 'lnum' that started the continuation 'lnum' may be part of.
function s:GetMSL(lnum)
" Start on the line we're at and use its indent.
let msl = a:lnum
let msl_body = getline(msl)
let lnum = s:PrevNonBlankNonString(a:lnum - 1)
while lnum > 0
" If we have a continuation line, or we're in a string, use line as MSL.
" Otherwise, terminate search as we have found our MSL already.
let line = getline(lnum)
if s:Match(msl, s:leading_operator_regex)
" If the current line starts with a leading operator, keep its indent
" and keep looking for an MSL.
let msl = lnum
elseif s:Match(lnum, s:splat_regex)
" If the above line looks like the "*" of a splat, use the current one's
" indentation.
"
" Example:
" Hash[*
" method_call do
" something
"
return msl
elseif s:Match(lnum, s:non_bracket_continuation_regex) &&
\ s:Match(msl, s:non_bracket_continuation_regex)
" If the current line is a non-bracket continuation and so is the
" previous one, keep its indent and continue looking for an MSL.
"
" Example:
" method_call one,
" two,
" three
"
let msl = lnum
elseif s:Match(lnum, s:non_bracket_continuation_regex) &&
\ (s:Match(msl, s:bracket_continuation_regex) || s:Match(msl, s:block_continuation_regex))
" If the current line is a bracket continuation or a block-starter, but
" the previous is a non-bracket one, respect the previous' indentation,
" and stop here.
"
" Example:
" method_call one,
" two {
" three
"
return lnum
elseif s:Match(lnum, s:bracket_continuation_regex) &&
\ (s:Match(msl, s:bracket_continuation_regex) || s:Match(msl, s:block_continuation_regex))
" If both lines are bracket continuations (the current may also be a
" block-starter), use the current one's and stop here
"
" Example:
" method_call(
" other_method_call(
" foo
return msl
elseif s:Match(lnum, s:block_regex) &&
\ !s:Match(msl, s:continuation_regex) &&
\ !s:Match(msl, s:block_continuation_regex)
" If the previous line is a block-starter and the current one is
" mostly ordinary, use the current one as the MSL.
"
" Example:
" method_call do
" something
" something_else
return msl
else
let col = match(line, s:continuation_regex) + 1
if (col > 0 && !s:IsInStringOrComment(lnum, col))
\ || s:IsInString(lnum, strlen(line))
let msl = lnum
else
break
endif
endif
let msl_body = getline(msl)
let lnum = s:PrevNonBlankNonString(lnum - 1)
endwhile
return msl
endfunction
" Check if line 'lnum' has more opening brackets than closing ones.
function s:ExtraBrackets(lnum)
let opening = {'parentheses': [], 'braces': [], 'brackets': []}
let closing = {'parentheses': [], 'braces': [], 'brackets': []}
let line = getline(a:lnum)
let pos = match(line, '[][(){}]', 0)
" Save any encountered opening brackets, and remove them once a matching
" closing one has been found. If a closing bracket shows up that doesn't
" close anything, save it for later.
while pos != -1
if !s:IsInStringOrComment(a:lnum, pos + 1)
if line[pos] ==# '('
call add(opening.parentheses, {'type': '(', 'pos': pos})
elseif line[pos] ==# ')'
if empty(opening.parentheses)
call add(closing.parentheses, {'type': ')', 'pos': pos})
else
let opening.parentheses = opening.parentheses[0:-2]
endif
elseif line[pos] ==# '{'
call add(opening.braces, {'type': '{', 'pos': pos})
elseif line[pos] ==# '}'
if empty(opening.braces)
call add(closing.braces, {'type': '}', 'pos': pos})
else
let opening.braces = opening.braces[0:-2]
endif
elseif line[pos] ==# '['
call add(opening.brackets, {'type': '[', 'pos': pos})
elseif line[pos] ==# ']'
if empty(opening.brackets)
call add(closing.brackets, {'type': ']', 'pos': pos})
else
let opening.brackets = opening.brackets[0:-2]
endif
endif
endif
let pos = match(line, '[][(){}]', pos + 1)
endwhile
" Find the rightmost brackets, since they're the ones that are important in
" both opening and closing cases
let rightmost_opening = {'type': '(', 'pos': -1}
let rightmost_closing = {'type': ')', 'pos': -1}
for opening in opening.parentheses + opening.braces + opening.brackets
if opening.pos > rightmost_opening.pos
let rightmost_opening = opening
endif
endfor
for closing in closing.parentheses + closing.braces + closing.brackets
if closing.pos > rightmost_closing.pos
let rightmost_closing = closing
endif
endfor
return [rightmost_opening, rightmost_closing]
endfunction
function s:Match(lnum, regex)
let line = getline(a:lnum)
let offset = match(line, '\C'.a:regex)
let col = offset + 1
while offset > -1 && s:IsInStringOrComment(a:lnum, col)
let offset = match(line, '\C'.a:regex, offset + 1)
let col = offset + 1
endwhile
if offset > -1
return col
else
return 0
endif
endfunction
" Locates the containing class/module's definition line, ignoring nested classes
" along the way.
"
function! s:FindContainingClass()
let saved_position = getpos('.')
while searchpair(s:end_start_regex, s:end_middle_regex, s:end_end_regex, 'bW',
\ s:end_skip_expr) > 0
if expand('<cword>') =~# '\<class\|module\>'
let found_lnum = line('.')
call setpos('.', saved_position)
return found_lnum
endif
endwhile
call setpos('.', saved_position)
return 0
endfunction
" 3. GetCrystalIndent Function {{{1
" ========================= " =========================
function GetCrystalIndent(...) function GetCrystalIndent(...)
" 3.1. Setup {{{2 " Setup {{{2
" ---------- " -----
" The value of a single shift-width
if exists('*shiftwidth')
let sw = shiftwidth()
else
let sw = &sw
endif
" For the current line, use the first argument if given, else v:lnum " For the current line, use the first argument if given, else v:lnum
let clnum = a:0 ? a:1 : v:lnum let clnum = a:0 ? a:1 : v:lnum
" Set up variables for restoring position in file. Could use clnum here. " Set up variables for restoring position in file
let vcol = col('.') let vcol = col(clnum)
" 3.2. Work on the current line {{{2 " Work on the current line {{{2
" ----------------------------- " ------------------------
" Get the current line. " Get the current line.
let line = getline(clnum) let line = getline(clnum)
let ind = -1 let ind = -1
" If this line is an access modifier keyword, align according to the closest
" class declaration.
if g:crystal_indent_access_modifier_style ==? 'indent'
if s:Match(clnum, s:access_modifier_regex)
let class_line = s:FindContainingClass()
if class_line > 0
return indent(class_line) + sw
endif
endif
elseif g:crystal_indent_access_modifier_style ==? 'outdent'
if s:Match(clnum, s:access_modifier_regex)
let class_line = s:FindContainingClass()
if class_line > 0
return indent(class_line)
endif
endif
endif
" If we got a closing bracket on an empty line, find its match and indent " If we got a closing bracket on an empty line, find its match and indent
" according to it. For parentheses we indent to its column - 1, for the " according to it. For parentheses we indent to its column - 1, for the
" others we indent to the containing line's MSL's level. Return -1 if fail. " others we indent to the containing line's MSL's level. Return -1 if fail.
let col = matchend(line, '^\s*[]})]') let col = matchend(line, '^\s*[]})]')
if col > 0 && !s:IsInStringOrComment(clnum, col) if col > 0 && !crystal#indent#IsInStringOrComment(clnum, col)
call cursor(clnum, col) call cursor(clnum, col)
let bs = strpart('(){}[]', stridx(')}]', line[col - 1]) * 2, 2) let bs = strpart('(){}[]', stridx(')}]', line[col - 1]) * 2, 2)
if searchpair(escape(bs[0], '\['), '', bs[1], 'bW', s:skip_expr) > 0 if searchpair(escape(bs[0], '\['), '', bs[1], 'bW', g:crystal#indent#skip_expr)
if line[col-1] ==# ')' && col('.') != col('$') - 1 if line[col-1] ==# ')' && col('.') != col('$') - 1
let ind = virtcol('.') - 1 let ind = virtcol('.') - 1
else else
let ind = indent(s:GetMSL(line('.'))) let ind = indent(crystal#indent#GetMSL(line('.')))
endif endif
endif endif
return ind return ind
endif endif
" If we have a =begin or =end set indent to first column.
if match(line, '^\s*\%(=begin\|=end\)$') != -1
return 0
endif
" If we have a deindenting keyword, find its match and indent to its level. " If we have a deindenting keyword, find its match and indent to its level.
" TODO: this is messy " TODO: this is messy
if s:Match(clnum, s:crystal_deindent_keywords) if crystal#indent#Match(clnum, g:crystal#indent#crystal_deindent_keywords)
call cursor(clnum, 1) call cursor(clnum, 1)
if searchpair(s:end_start_regex, s:end_middle_regex, s:end_end_regex, 'bW', if searchpair(
\ s:end_skip_expr) > 0 \ g:crystal#indent#end_start_regex,
let msl = s:GetMSL(line('.')) \ g:crystal#indent#end_middle_regex,
\ g:crystal#indent#end_end_regex,
\ 'bW', g:crystal#indent#skip_expr)
let msl = crystal#indent#GetMSL(line('.'))
let line = getline(line('.')) let line = getline(line('.'))
if strpart(line, 0, col('.') - 1) =~# '=\s*$' && if strpart(line, 0, col('.') - 1) =~# '=\s*$' &&
@@ -449,29 +96,29 @@ function GetCrystalIndent(...)
return ind return ind
endif endif
" If we are in a multi-line string or line-comment, don't do anything to it. " If we are in a multi-line string, don't do anything to it.
if s:IsInStringOrDocumentation(clnum, matchend(line, '^\s*') + 1) if crystal#indent#IsInString(clnum, matchend(line, '^\s*') + 1)
return indent('.') return indent('.')
endif endif
" If we are at the closing delimiter of a "<<" heredoc-style string, set the " If we are at the closing delimiter of a "<<" heredoc-style string, set the
" indent to 0. " indent to 0.
if line =~# '^\k\+\s*$' if line =~# '^\k\+\s*$'
\ && s:IsInStringDelimiter(clnum, 1) \ && crystal#indent#IsInStringDelimiter(clnum, 1)
\ && search('\V<<'.line, 'nbW') > 0 \ && search('\V<<'.line, 'nbW')
return 0 return 0
endif endif
" If the current line starts with a leading operator, add a level of indent. " If the current line starts with a leading operator, add a level of indent.
if s:Match(clnum, s:leading_operator_regex) if crystal#indent#Match(clnum, g:crystal#indent#leading_operator_regex)
return indent(s:GetMSL(clnum)) + sw return indent(crystal#indent#GetMSL(clnum)) + s:sw()
endif endif
" 3.3. Work on the previous line. {{{2 " Work on the previous line. {{{2
" ------------------------------- " --------------------------
" Find a non-blank, non-multi-line string line above the current line. " Find a non-blank, non-multi-line string line above the current line.
let lnum = s:PrevNonBlankNonString(clnum - 1) let lnum = crystal#indent#PrevNonBlankNonString(clnum - 1)
" If the line is empty and inside a string, use the previous line. " If the line is empty and inside a string, use the previous line.
if line =~# '^\s*$' && lnum != prevnonblank(clnum - 1) if line =~# '^\s*$' && lnum != prevnonblank(clnum - 1)
@@ -487,33 +134,34 @@ function GetCrystalIndent(...)
let line = getline(lnum) let line = getline(lnum)
let ind = indent(lnum) let ind = indent(lnum)
if s:Match(lnum, s:continuable_regex) && s:Match(lnum, s:continuation_regex) if crystal#indent#Match(lnum, g:crystal#indent#continuable_regex) &&
return indent(s:GetMSL(lnum)) + sw + sw \ crystal#indent#Match(lnum, g:crystal#indent#continuation_regex)
return indent(crystal#indent#GetMSL(lnum)) + s:sw() * 2
endif endif
" If the previous line ended with a block opening, add a level of indent. " If the previous line ended with a block opening, add a level of indent.
if s:Match(lnum, s:block_regex) if crystal#indent#Match(lnum, g:crystal#indent#block_regex)
let msl = s:GetMSL(lnum) let msl = crystal#indent#GetMSL(lnum)
if getline(msl) =~# '=\s*\(#.*\)\=$' if getline(msl) =~# '=\s*\(#.*\)\=$'
" in the case of assignment to the msl, align to the starting line, " in the case of assignment to the msl, align to the starting line,
" not to the msl " not to the msl
let ind = indent(lnum) + sw let ind = indent(lnum) + s:sw()
else else
let ind = indent(msl) + sw let ind = indent(msl) + s:sw()
endif endif
return ind return ind
endif endif
" If the previous line started with a leading operator, use its MSL's level " If the previous line started with a leading operator, use its MSL's level
" of indent " of indent
if s:Match(lnum, s:leading_operator_regex) if crystal#indent#Match(lnum, g:crystal#indent#leading_operator_regex)
return indent(s:GetMSL(lnum)) return indent(crystal#indent#GetMSL(lnum))
endif endif
" If the previous line ended with the "*" of a splat, add a level of indent " If the previous line ended with the "*" of a splat, add a level of indent
if line =~ s:splat_regex if line =~ g:crystal#indent#splat_regex
return indent(lnum) + sw return indent(lnum) + s:sw()
endif endif
" If the previous line contained unclosed opening brackets and we are still " If the previous line contained unclosed opening brackets and we are still
@@ -523,25 +171,25 @@ function GetCrystalIndent(...)
" If it contained hanging closing brackets, find the rightmost one, find its " If it contained hanging closing brackets, find the rightmost one, find its
" match and indent according to that. " match and indent according to that.
if line =~# '[[({]' || line =~# '[])}]\s*\%(#.*\)\=$' if line =~# '[[({]' || line =~# '[])}]\s*\%(#.*\)\=$'
let [opening, closing] = s:ExtraBrackets(lnum) let [opening, closing] = crystal#indent#ExtraBrackets(lnum)
if opening.pos != -1 if opening.pos != -1
if opening.type ==# '(' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0 if opening.type ==# '(' && searchpair('(', '', ')', 'bW', g:crystal#indent#skip_expr)
if col('.') + 1 == col('$') if col('.') + 1 == col('$')
return ind + sw return ind + s:sw()
else else
return virtcol('.') return virtcol('.')
endif endif
else else
let nonspace = matchend(line, '\S', opening.pos + 1) - 1 let nonspace = matchend(line, '\S', opening.pos + 1) - 1
return nonspace > 0 ? nonspace : ind + sw return nonspace > 0 ? nonspace : ind + s:sw()
endif endif
elseif closing.pos != -1 elseif closing.pos != -1
call cursor(lnum, closing.pos + 1) call cursor(lnum, closing.pos + 1)
normal! % normal! %
if s:Match(line('.'), s:crystal_indent_keywords) if crystal#indent#Match(line('.'), g:crystal#indent#crystal_indent_keywords)
return indent('.') + sw return indent('.') + s:sw()
else else
return indent('.') return indent('.')
endif endif
@@ -552,14 +200,18 @@ function GetCrystalIndent(...)
" If the previous line ended with an "end", match that "end"s beginning's " If the previous line ended with an "end", match that "end"s beginning's
" indent. " indent.
let col = s:Match(lnum, '\%(^\|[^.:@$]\)\<end\>\s*\%(#.*\)\=$') let col = crystal#indent#Match(lnum, g:crystal#indent#end_end_regex)
if col > 0 if col
call cursor(lnum, col) call cursor(lnum, col)
if searchpair(s:end_start_regex, '', s:end_end_regex, 'bW', if searchpair(
\ s:end_skip_expr) > 0 \ g:crystal#indent#end_start_regex,
\ g:crystal#indent#end_middle_regex,
\ g:crystal#indent#end_end_regex,
\ 'bW',
\ g:crystal#indent#skip_expr)
let n = line('.') let n = line('.')
let ind = indent('.') let ind = indent('.')
let msl = s:GetMSL(n) let msl = crystal#indent#GetMSL(n)
if msl != n if msl != n
let ind = indent(msl) let ind = indent(msl)
end end
@@ -567,34 +219,35 @@ function GetCrystalIndent(...)
endif endif
end end
let col = s:Match(lnum, s:crystal_indent_keywords) let col = crystal#indent#Match(lnum, g:crystal#indent#crystal_indent_keywords)
if col > 0 if col
call cursor(lnum, col) call cursor(lnum, col)
let ind = virtcol('.') - 1 + sw let ind = virtcol('.') - 1 + s:sw()
" TODO: make this better (we need to count them) (or, if a searchpair " TODO: make this better (we need to count them) (or, if a searchpair
" fails, we know that something is lacking an end and thus we indent a " fails, we know that something is lacking an end and thus we indent a
" level " level
if s:Match(lnum, s:end_end_regex) if crystal#indent#Match(lnum, g:crystal#indent#end_end_regex)
let ind = indent('.') let ind = indent('.')
endif endif
return ind return ind
endif endif
" 3.4. Work on the MSL line. {{{2 " Work on the MSL line. {{{2
" -------------------------- " ---------------------
" Set up variables to use and search for MSL to the previous line. " Set up variables to use and search for MSL to the previous line.
let p_lnum = lnum let p_lnum = lnum
let lnum = s:GetMSL(lnum) let lnum = crystal#indent#GetMSL(lnum)
" If the previous line wasn't a MSL. " If the previous line wasn't a MSL.
if p_lnum != lnum if p_lnum != lnum
" If previous line ends bracket and begins non-bracket continuation decrease indent by 1. " If previous line ends bracket and begins non-bracket continuation decrease indent by 1.
if s:Match(p_lnum, s:bracket_switch_continuation_regex) if crystal#indent#Match(p_lnum, g:crystal#indent#bracket_switch_continuation_regex)
return ind - 1 return ind - 1
" If previous line is a continuation return its indent. " If previous line is a continuation return its indent.
" TODO: the || s:IsInString() thing worries me a bit. " TODO: the || crystal#indent#IsInString() thing worries me a bit.
elseif s:Match(p_lnum, s:non_bracket_continuation_regex) || s:IsInString(p_lnum,strlen(line)) elseif crystal#indent#Match(p_lnum, g:crystal#indent#non_bracket_continuation_regex) ||
\ crystal#indent#IsInString(p_lnum,strlen(line))
return ind return ind
endif endif
endif endif
@@ -606,19 +259,21 @@ function GetCrystalIndent(...)
" If the MSL line had an indenting keyword in it, add a level of indent. " If the MSL line had an indenting keyword in it, add a level of indent.
" TODO: this does not take into account contrived things such as " TODO: this does not take into account contrived things such as
" module Foo; class Bar; end " module Foo; class Bar; end
if s:Match(lnum, s:crystal_indent_keywords) if crystal#indent#Match(lnum, g:crystal#indent#crystal_indent_keywords)
let ind = msl_ind + sw let ind = msl_ind + s:sw()
if s:Match(lnum, s:end_end_regex) if crystal#indent#Match(lnum, g:crystal#indent#end_end_regex)
let ind = ind - sw let ind = ind - s:sw()
endif endif
return ind return ind
endif endif
" If the previous line ended with [*+/.,-=], but wasn't a block ending or a " If the previous line ended with an operator -- but wasn't a block
" closing bracket, indent one extra level. " ending, closing bracket, or type declaration -- indent one extra
if s:Match(lnum, s:non_bracket_continuation_regex) && !s:Match(lnum, '^\s*\([\])}]\|end\)') " level.
if crystal#indent#Match(lnum, g:crystal#indent#non_bracket_continuation_regex) &&
\ !crystal#indent#Match(lnum, '^\s*\([\])}]\|end\)')
if lnum == p_lnum if lnum == p_lnum
let ind = msl_ind + sw let ind = msl_ind + s:sw()
else else
let ind = msl_ind let ind = msl_ind
endif endif

View File

@@ -160,8 +160,8 @@ function! s:find_start_of_block(lnum, types, skip, multiple) abort
else else
let re_skip = '' let re_skip = ''
endif endif
let lnum = a:lnum let last_indent = indent(a:lnum) + 1
let last_indent = indent(lnum) + 1 let lnum = a:lnum - 1
while lnum > 0 && last_indent > 0 while lnum > 0 && last_indent > 0
let indent = indent(lnum) let indent = indent(lnum)
if indent < last_indent if indent < last_indent
@@ -262,7 +262,7 @@ function! s:indent_like_block(lnum)
endif endif
let [blocks, skip] = blocks_ignore let [blocks, skip] = blocks_ignore
let indents = s:find_start_of_block(a:lnum - 1, blocks, skip, multiple) let indents = s:find_start_of_block(a:lnum, blocks, skip, multiple)
if empty(indents) if empty(indents)
return -1 return -1
endif endif

View File

@@ -12,7 +12,7 @@ setlocal indentexpr=DartIndent()
let b:undo_indent = 'setl cin< cino<' let b:undo_indent = 'setl cin< cino<'
if exists("*DartIndent") if exists('*DartIndent')
finish finish
endif endif

489
indent/ecrystal.vim Normal file
View File

@@ -0,0 +1,489 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
" Setup {{{1
" =====
if exists('b:did_indent')
finish
endif
call ecrystal#SetSubtype()
if b:ecrystal_subtype !=# ''
exec 'runtime! indent/'.b:ecrystal_subtype.'.vim'
unlet! b:did_indent
endif
if &l:indentexpr ==# ''
if &l:cindent
let &l:indentexpr = 'cindent(v:lnum)'
else
let &l:indentexpr = 'indent(prevnonblank(v:lnum - 1))'
endif
endif
let b:ecrystal_subtype_indentexpr = &l:indentexpr
" Should we use folding?
if has('folding') && get(g:, 'ecrystal_fold', 0)
setlocal foldmethod=expr
setlocal foldexpr=GetEcrystalFold()
endif
" Should closing control tags be aligned with their corresponding
" opening tags?
if !exists('b:ecrystal_align_end')
if exists('g:ecrystal_align_end')
let b:ecrystal_align_end = g:ecrystal_align_end
else
let b:ecrystal_align_end = b:ecrystal_subtype !=# 'html' && b:ecrystal_subtype !=# 'xml'
endif
endif
" Should multiline tags be indented?
if !exists('b:ecrystal_indent_multiline')
let b:ecrystal_indent_multiline = get(g:, 'ecrystal_indent_multiline', 1)
endif
if b:ecrystal_indent_multiline
runtime! indent/crystal.vim
unlet! b:did_indent
setlocal indentexpr<
endif
setlocal indentexpr=GetEcrystalIndent()
setlocal indentkeys+=<>>,=end,=else,=elsif,=rescue,=ensure,=when
let b:did_indent = 1
" Only define the function once.
if exists('*GetEcrystalIndent')
finish
endif
" Helper variables and functions {{{1
" ==============================
let s:ecr_open = '<%%\@!'
let s:ecr_close = '%>'
let s:ecr_control_open = '<%%\@!-\=[=#]\@!'
let s:ecr_comment_open = '<%%\@!-\=#'
let s:ecr_indent_regex =
\ '\<\%(if\|unless\|else\|elsif\|case\|for\|when\|while\|until\|begin\|do\|rescue\|ensure\|' .
\ 'class\|module\|struct\|lib\|enum\|union\)\>'
let s:ecr_dedent_regex =
\ '\<\%(end\|else\|elsif\|when\|rescue\|ensure\)\>'
" Return the value of a single shift-width
if exists('*shiftwidth')
let s:sw = function('shiftwidth')
else
function s:sw()
return &shiftwidth
endfunction
endif
" Does the given pattern match at the cursor's position?
function s:MatchCursor(pattern)
return searchpos(a:pattern, 'cnz', line('.')) == [line('.'), col('.')]
endfunction
" Does the given pattern match at the given position?
function s:MatchAt(lnum, col, pattern)
let pos = getcurpos()
try
call cursor(a:lnum, a:col)
let result = s:MatchCursor(a:pattern)
finally
call setpos('.', pos)
endtry
return result
endfunction
" Is the cell at the given position part of a tag? If so, return the
" position of the opening delimiter.
function s:MatchECR(...)
if a:0
let lnum = a:1
let col = a:2
call cursor(lnum, col)
endif
let pos = getcurpos()
try
let flags = s:MatchCursor(s:ecr_open) ? 'bcWz' : 'bWz'
let [open_lnum, open_col] = searchpairpos(
\ s:ecr_open, '', s:ecr_close,
\ flags, g:crystal#indent#skip_expr)
finally
call setpos('.', pos)
endtry
return [open_lnum, open_col]
endfunction
" If the cell at the given position is part of a control tag, return the
" respective positions of the opening and closing delimiters for that
" tag.
function s:MatchECRControl(...)
let pos = getcurpos()
if a:0
let lnum = a:1
let col = a:2
call cursor(lnum, col)
else
let [lnum, col] = [line('.'), col('.')]
endif
let open = { 'lnum': 0, 'col': 0 }
let close = { 'lnum': 0, 'col': 0 }
let [open.lnum, open.col] = s:MatchECR(lnum, col)
if !open.lnum
call setpos('.', pos)
return [open, close]
endif
call cursor(open.lnum, open.col)
if !s:MatchCursor(s:ecr_control_open)
let open.lnum = 0
let open.col = 0
call setpos('.', pos)
return [open, close]
endif
let [close.lnum, close.col] = searchpairpos(
\ s:ecr_control_open, '', s:ecr_close,
\ 'Wz', g:crystal#indent#skip_expr)
call setpos('.', pos)
return [open, close]
endfunction
" Determine whether or not the control tag at the given position starts
" an indent.
function s:ECRIndent(...)
if a:0
if type(a:1) == 0
let [open, close] = s:MatchECRControl(a:1, a:2)
elseif type(a:1) == 4
let [open, close] = [a:1, a:2]
endif
else
let [open, close] = s:MatchECRControl()
endif
let result = 0
if !open.lnum
return result
endif
let pos = getcurpos()
call cursor(open.lnum, open.col)
" Find each Crystal keyword that starts an indent; if any of them do
" not have a corresponding ending keyword, then this tag starts an
" indent.
while search(s:ecr_indent_regex, 'z', close.lnum)
let [lnum, col] = [line('.'), col('.')]
if lnum == close.lnum && col > close.col
break
endif
if crystal#indent#IsInStringOrComment(lnum, col)
continue
endif
let [end_lnum, end_col] = searchpairpos(
\ g:crystal#indent#end_start_regex,
\ g:crystal#indent#end_middle_regex,
\ g:crystal#indent#end_end_regex,
\ 'nz',
\ g:crystal#indent#skip_expr,
\ close.lnum)
if end_lnum
if end_lnum == close.lnum && end_col > close.col
let result = 1
endif
else
let result = 1
endif
if result
break
endif
endwhile
call setpos('.', pos)
return result
endfunction
" Determine if the control tag at the given position ends an indent or
" not.
function s:ECRDedent(...)
if a:0
if type(a:1) == 0
let [open, close] = s:MatchECRControl(a:1, a:2)
elseif type(a:1) == 4
let [open, close] = [a:1, a:2]
endif
else
let [open, close] = s:MatchECRControl()
endif
let result = 0
if !open.lnum
return result
endif
let pos = getcurpos()
call cursor(open.lnum, open.col)
" Find each Crystal keyword that ends an indent; if any of them do not
" have a corresponding starting keyword, then this tag ends an indent
while search(s:ecr_dedent_regex, 'z', close.lnum)
let [lnum, col] = [line('.'), col('.')]
if lnum == close.lnum && col > close.col
break
endif
if crystal#indent#IsInStringOrComment(lnum, col)
continue
endif
let [begin_lnum, begin_col] = searchpairpos(
\ g:crystal#indent#end_start_regex,
\ g:crystal#indent#end_middle_regex,
\ g:crystal#indent#end_end_regex,
\ 'bnz',
\ g:crystal#indent#skip_expr,
\ open.lnum)
if begin_lnum
if begin_lnum == open.lnum && begin_col < open.col
let result = 1
endif
else
let result = 1
endif
if result
break
endif
endwhile
call setpos('.', pos)
return result
endfunction
" Find and match a control tag in the given line, if one exists.
function s:FindECRControl(...)
let lnum = a:0 ? a:1 : line('.')
let open = { 'lnum': 0, 'col': 0 }
let close = { 'lnum': 0, 'col': 0 }
let pos = getcurpos()
call cursor(lnum, 1)
while search(s:ecr_control_open, 'cz', lnum)
let [open, close] = s:MatchECRControl()
if open.lnum
break
endif
endwhile
call setpos('.', pos)
return [open, close]
endfunction
" Find and match the previous control tag.
"
" This takes two arguments: the first is the line to start searching
" from (exclusive); the second is the line to stop searching at
" (inclusive).
function s:FindPrevECRControl(...)
if a:0 == 0
let start = line('.')
let stop = 1
elseif a:0 == 1
let start = a:1
let stop = 1
elseif a:0 == 2
let start = a:1
let stop = a:2
endif
let open = { 'lnum': 0, 'col': 0 }
let close = { 'lnum': 0, 'col': 0 }
let pos = getcurpos()
call cursor(start, 1)
let [lnum, col] = searchpos(s:ecr_close, 'bWz', stop)
if !lnum
call setpos('.', pos)
return [open, close]
endif
let [open, close] = s:MatchECRControl()
while !open.lnum
let [lnum, col] = searchpos(s:ecr_close, 'bWz', stop)
if !lnum
break
endif
let [open, close] = s:MatchECRControl()
endwhile
call setpos('.', pos)
return [open, close]
endfunction
" GetEcrystalIndent {{{1
" =================
function GetEcrystalIndent() abort
let prev_lnum = prevnonblank(v:lnum - 1)
if b:ecrystal_indent_multiline
let [open_tag_lnum, open_tag_col] = s:MatchECR()
else
let open_tag_lnum = 0
endif
if open_tag_lnum && open_tag_lnum < v:lnum
" If we are inside a multiline eCrystal tag...
let ind = indent(open_tag_lnum)
" If this line has a closing delimiter that isn't inside a string or
" comment, then we are done with this tag
if crystal#indent#Match(v:lnum, s:ecr_close)
return ind
endif
" All tag contents will have at least one indent
let ind += s:sw()
if open_tag_lnum == prev_lnum
" If this is the first line after the opening delimiter, then one
" indent is enough
return ind
elseif s:MatchAt(open_tag_lnum, open_tag_col, s:ecr_comment_open)[0]
" eCrystal comments shouldn't be indented any further
return ind
else
" Else, fall back to Crystal indentation...
let crystal_ind = GetCrystalIndent()
" But only if it isn't less than the default indentation for this
" tag
return crystal_ind < ind ? ind : crystal_ind
endif
else
let [prev_ecr_open, prev_ecr_close] = s:FindPrevECRControl(v:lnum, prev_lnum)
let [curr_ecr_open, curr_ecr_close] = s:FindECRControl()
let prev_is_ecr = prev_ecr_open.lnum != 0
let curr_is_ecr = curr_ecr_open.lnum != 0
let shift = 0
if prev_is_ecr
if s:ECRIndent(prev_ecr_open, prev_ecr_close)
let shift = 1
endif
endif
if curr_is_ecr
if s:ECRDedent(curr_ecr_open, curr_ecr_close)
if !b:ecrystal_align_end
let shift = shift ? 0 : -1
else
" Find the nearest previous control tag that starts an indent
" and align this one with that one
let end_tags = 0
let [open, close] = s:FindPrevECRControl()
while open.lnum
if s:ECRIndent(open, close)
if end_tags
let end_tags -= 1
else
return indent(open.lnum)
endif
elseif s:ECRDedent(open, close)
let end_tags += 1
endif
let [open, close] = s:FindPrevECRControl(open.lnum)
endwhile
endif
endif
endif
if shift
return indent(prev_lnum) + s:sw() * shift
else
exec 'return ' . b:ecrystal_subtype_indentexpr
endif
endif
endfunction
" GetEcrystalFold {{{1
" ===============
function GetEcrystalFold() abort
let fold = '='
let col = crystal#indent#Match(v:lnum, s:ecr_control_open)
if col
let [open, close] = s:MatchECRControl(v:lnum, col)
let starts_indent = s:ECRIndent(open, close)
let ends_indent = s:ECRDedent(open, close)
if starts_indent && !ends_indent
let fold = 'a1'
elseif ends_indent && !starts_indent
let fold = 's1'
endif
endif
return fold
endfunction
" }}}
" vim:fdm=marker
endif

View File

@@ -1,6 +1,6 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
" Copyright (c) 2016-2019 Jon Parise <jon@indelible.org> " Copyright (c) 2016-2020 Jon Parise <jon@indelible.org>
" "
" Permission is hereby granted, free of charge, to any person obtaining a copy " Permission is hereby granted, free of charge, to any person obtaining a copy
" of this software and associated documentation files (the "Software"), to " of this software and associated documentation files (the "Software"), to

View File

@@ -316,11 +316,17 @@ function GetJuliaIndent()
" Second scenario: some multiline bracketed expression was closed in the " Second scenario: some multiline bracketed expression was closed in the
" previous line. But since we know we are still in a bracketed expression, " previous line. But since we know we are still in a bracketed expression,
" we need to find the line where the bracket was open " we need to find the line where the bracket was open
elseif last_closed_bracket != -1 " && exists("loaded_matchit") elseif last_closed_bracket != -1
" we use the % command to skip back (this is buggy without matchit, and " we use the % command to skip back (tries to ues matchit if possible,
" is potentially a disaster if % got remapped) " otherwise resorts to vim's default, which is buggy but better than
" nothing)
call cursor(lnum, last_closed_bracket) call cursor(lnum, last_closed_bracket)
normal % let percmap = maparg("%", "n")
if exists("g:loaded_matchit") && percmap =~# 'Match\%(it\|_wrapper\)'
normal %
else
normal! %
end
if line(".") == lnum if line(".") == lnum
" something wrong here, give up " something wrong here, give up
let ind = indent(lnum) let ind = indent(lnum)

View File

@@ -77,7 +77,7 @@ endfunction
function! s:getIncIndent() abort function! s:getIncIndent() abort
" Function to determine the s:incIndent pattern " Function to determine the s:incIndent pattern
return return
\ '^\s*\%(class\|object\|interface\|partition\|rectangle\|enum\|namespace\|package\)\>.*{\s*$\|' . \ '^\s*\%(class\|entity\|object\|interface\|partition\|rectangle\|enum\|namespace\|package\)\>.*{\s*$\|' .
\ '^\s*\%(loop\|alt\|opt\|group\|critical\|else\|legend\|box\|if\|while\|fork\|split\)\>\|' . \ '^\s*\%(loop\|alt\|opt\|group\|critical\|else\|legend\|box\|if\|while\|fork\|split\)\>\|' .
\ '^\s*ref\>[^:]*$\|' . \ '^\s*ref\>[^:]*$\|' .
\ '^\s*[hr]\?note\>\%(\%("[^"]*" \<as\>\)\@![^:]\)*$\|' . \ '^\s*[hr]\?note\>\%(\%("[^"]*" \<as\>\)\@![^:]\)*$\|' .

View File

@@ -160,8 +160,8 @@ function! s:find_start_of_block(lnum, types, skip, multiple) abort
else else
let re_skip = '' let re_skip = ''
endif endif
let lnum = a:lnum let last_indent = indent(a:lnum) + 1
let last_indent = indent(lnum) + 1 let lnum = a:lnum - 1
while lnum > 0 && last_indent > 0 while lnum > 0 && last_indent > 0
let indent = indent(lnum) let indent = indent(lnum)
if indent < last_indent if indent < last_indent
@@ -262,7 +262,7 @@ function! s:indent_like_block(lnum)
endif endif
let [blocks, skip] = blocks_ignore let [blocks, skip] = blocks_ignore
let indents = s:find_start_of_block(a:lnum - 1, blocks, skip, multiple) let indents = s:find_start_of_block(a:lnum, blocks, skip, multiple)
if empty(indents) if empty(indents)
return -1 return -1
endif endif

View File

@@ -21,7 +21,7 @@ syntax match typescriptFuncName contained /\K\k*/
\ skipwhite \ skipwhite
" destructuring ({ a: ee }) => " destructuring ({ a: ee }) =>
syntax match typescriptArrowFuncDef contained /({\_[^}]*}\(:\_[^)]\)\?)\s*=>/ syntax match typescriptArrowFuncDef contained /(\(\s*\({\_[^}]*}\|\k\+\)\(:\_[^)]\)\?,\?\)\+)\s*=>/
\ contains=typescriptArrowFuncArg,typescriptArrowFunc \ contains=typescriptArrowFuncArg,typescriptArrowFunc
\ nextgroup=@typescriptExpression,typescriptBlock \ nextgroup=@typescriptExpression,typescriptBlock
\ skipwhite skipempty \ skipwhite skipempty

View File

@@ -63,8 +63,9 @@ endfunction
com! -nargs=* SynFold call s:run_syntax_fold(<q-args>) com! -nargs=* SynFold call s:run_syntax_fold(<q-args>)
" Not-Top Cluster " Top and Not-Top Clusters
syn cluster crystalNotTop contains=@crystalExtendedStringSpecial,@crystalRegexpSpecial,@crystalDeclaration,crystalConditional,crystalExceptional,crystalMethodExceptional,crystalTodo,crystalLinkAttr syn cluster crystalTop contains=TOP
syn cluster crystalNotTop contains=CONTAINED
" Whitespace Errors " Whitespace Errors
if exists('g:crystal_space_errors') if exists('g:crystal_space_errors')
@@ -78,16 +79,16 @@ endif
" Operators " Operators
if exists('g:crystal_operators') if exists('g:crystal_operators')
syn match crystalOperator "[~!^&|*/%+-]\|\%(class\s*\)\@<!<<\|<=>\|<=\|\%(<\|\<class\s\+\u\w*\s*\)\@<!<[^<]\@=\|===\|==\|=\~\|>>\|>=\|=\@<!>\|\*\*\|\.\.\.\|\.\.\|::" syn match crystalOperator "[~!^&|*/%+-]\|<=>\|<=\|\%(<\|\<\%(class\|struct\)\s\+\u\w*\s*\)\@<!<[^<]\@=\|===\|==\|=\~\|>>\|>=\|=\@1<!>\|\*\*\|\.\.\.\|\.\.\|::"
syn match crystalOperator "->\|-=\|/=\|\*\*=\|\*=\|&&=\|&=\|&&\|||=\||=\|||\|%=\|+=\|!\~\|!=\|//" syn match crystalOperator "->\|-=\|/=\|\*\*=\|\*=\|&&=\|&=\|&&\|||=\||=\|||\|%=\|+=\|!\~\|!=\|//"
syn region crystalBracketOperator matchgroup=crystalOperator start="\%(\w[?!]\=\|[]})]\)\@<=\[\s*" end="\s*]" contains=ALLBUT,@crystalNotTop syn region crystalBracketOperator matchgroup=crystalOperator start="\%(\w[?!]\=\|[]})]\)\@2<=\[" end="]" contains=TOP
endif endif
" Expression Substitution and Backslash Notation " Expression Substitution and Backslash Notation
syn match crystalStringEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display syn match crystalStringEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display
syn match crystalStringEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display syn match crystalStringEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display
syn region crystalInterpolation matchgroup=crystalInterpolationDelim start="#{" end="}" contained contains=ALLBUT,@crystalNotTop syn region crystalInterpolation matchgroup=crystalInterpolationDelim start="#{" end="}" contained contains=TOP
syn match crystalInterpolation "#\%(\$\|@@\=\)\w\+" display contained contains=crystalInterpolationDelim,crystalInstanceVariable,crystalClassVariable,crystalGlobalVariable,crystalPredefinedVariable syn match crystalInterpolation "#\%(\$\|@@\=\)\w\+" display contained contains=crystalInterpolationDelim,crystalInstanceVariable,crystalClassVariable,crystalGlobalVariable,crystalPredefinedVariable
syn match crystalInterpolationDelim "#\ze\%(\$\|@@\=\)\w\+" display contained syn match crystalInterpolationDelim "#\ze\%(\$\|@@\=\)\w\+" display contained
syn match crystalInterpolation "#\$\%(-\w\|\W\)" display contained contains=crystalInterpolationDelim,crystalPredefinedVariable,crystalInvalidVariable syn match crystalInterpolation "#\$\%(-\w\|\W\)" display contained contains=crystalInterpolationDelim,crystalPredefinedVariable,crystalInvalidVariable
@@ -127,7 +128,7 @@ syn cluster crystalExtendedStringSpecial contains=@crystalStringSpecial,crystalN
syn cluster crystalRegexpSpecial contains=crystalInterpolation,crystalNoInterpolation,crystalStringEscape,crystalRegexpSpecial,crystalRegexpEscape,crystalRegexpBrackets,crystalRegexpCharClass,crystalRegexpDot,crystalRegexpQuantifier,crystalRegexpAnchor,crystalRegexpParens,crystalRegexpComment syn cluster crystalRegexpSpecial contains=crystalInterpolation,crystalNoInterpolation,crystalStringEscape,crystalRegexpSpecial,crystalRegexpEscape,crystalRegexpBrackets,crystalRegexpCharClass,crystalRegexpDot,crystalRegexpQuantifier,crystalRegexpAnchor,crystalRegexpParens,crystalRegexpComment
" Numbers and ASCII Codes " Numbers and ASCII Codes
syn match crystalASCIICode "\%(\w\|[]})\"'/]\)\@<!\%(?\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\=\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)\)" syn match crystalASCIICode "\%(\w\|[]})\"'/]\)\@1<!\%(?\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\=\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)\)"
syn match crystalInteger "\<0x[[:xdigit:]_]\+\%([ui]\%(8\|16\|32\|64\|128\)\|f\%(32\|64\)\)\=\>" display syn match crystalInteger "\<0x[[:xdigit:]_]\+\%([ui]\%(8\|16\|32\|64\|128\)\|f\%(32\|64\)\)\=\>" display
syn match crystalInteger "\<0o[0-7_]\+\%([ui]\%(8\|16\|32\|64\|128\)\)\=\>" display syn match crystalInteger "\<0o[0-7_]\+\%([ui]\%(8\|16\|32\|64\|128\)\)\=\>" display
syn match crystalInteger "\<0b[01_]\+\%([ui]\%(8\|16\|32\|64\|128\)\)\=\>" display syn match crystalInteger "\<0b[01_]\+\%([ui]\%(8\|16\|32\|64\|128\)\)\=\>" display
@@ -135,33 +136,33 @@ syn match crystalInteger "\<\d[[:digit:]_]*\%([ui]\%(8\|16\|32\|64\|128\)\|f\%
syn match crystalFloat "\<\d[[:digit:]_]*\.\d[[:digit:]_]*\%(f\%(32\|64\)\)\=\>" contains=crystalInvalidInteger display syn match crystalFloat "\<\d[[:digit:]_]*\.\d[[:digit:]_]*\%(f\%(32\|64\)\)\=\>" contains=crystalInvalidInteger display
syn match crystalFloat "\<\d[[:digit:]_]*\%(\.\d[[:digit:]_]*\)\=\%([eE][-+]\=[[:digit:]_]\+\)\%(f\%(32\|64\)\)\=\>" contains=crystalInvalidInteger display syn match crystalFloat "\<\d[[:digit:]_]*\%(\.\d[[:digit:]_]*\)\=\%([eE][-+]\=[[:digit:]_]\+\)\%(f\%(32\|64\)\)\=\>" contains=crystalInvalidInteger display
" Note: 042 is invalid but 0, 0_, 0_u8 and 0_1 are valid (#73) " Note: 042 is invalid but 0, 0_, 0_u8 and 0_1 are valid (#73)
syn match crystalInvalidInteger "\.\@<!\<0\d\+\>" contained containedin=crystalFloat,crystalInteger display syn match crystalInvalidInteger "\%(\.\|[eE][+-]\)\@2<!\<0\d\+\>" contained containedin=crystalFloat,crystalInteger display
" Identifiers " Identifiers
syn match crystalLocalVariableOrMethod "\<[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent syn match crystalLocalVariableOrMethod "\<[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent
syn match crystalBlockArgument "&[_[:lower:]][_[:alnum:]]" contains=NONE display transparent syn match crystalBlockArgument "&[_[:lower:]][_[:alnum:]]" contains=NONE display transparent
syn match crystalTypeName "\%(\%([.@$]\@<!\.\)\@<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=" contained syn match crystalTypeName "\%(\%([.@$]\@1<!\.\)\@1<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=" contained
syn match crystalClassName "\%(\%([.@$]\@<!\.\)\@<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=" contained syn match crystalClassName "\%(\%([.@$]\@1<!\.\)\@1<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=" contained
syn match crystalModuleName "\%(\%([.@$]\@<!\.\)\@<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=" contained syn match crystalModuleName "\%(\%([.@$]\@1<!\.\)\@1<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=" contained
syn match crystalStructName "\%(\%([.@$]\@<!\.\)\@<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=" contained syn match crystalStructName "\%(\%([.@$]\@1<!\.\)\@1<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=" contained
syn match crystalLibName "\%(\%([.@$]\@<!\.\)\@<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=" contained syn match crystalLibName "\%(\%([.@$]\@1<!\.\)\@1<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=" contained
syn match crystalEnumName "\%(\%([.@$]\@<!\.\)\@<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=" contained syn match crystalEnumName "\%(\%([.@$]\@1<!\.\)\@1<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=" contained
syn match crystalConstant "\%(\%([.@$]\@<!\.\)\@<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@=" syn match crystalConstant "\%(\%([.@$]\@1<!\.\)\@1<!\<\|::\)\_s*\zs\u\w*\%(\>\|::\)\@="
syn match crystalClassVariable "@@\%(\h\|%\|[^\x00-\x7F]\)\%(\w\|%\|[^\x00-\x7F]\)*" display syn match crystalClassVariable "@@\%(\h\|%\|[^\x00-\x7F]\)\%(\w\|%\|[^\x00-\x7F]\)*" display
syn match crystalInstanceVariable "@\%(\h\|%\|[^\x00-\x7F]\)\%(\w\|%\|[^\x00-\x7F]\)*" display syn match crystalInstanceVariable "@\%(\h\|%\|[^\x00-\x7F]\)\%(\w\|%\|[^\x00-\x7F]\)*" display
syn match crystalGlobalVariable "$\%(\%(\h\|%\|[^\x00-\x7F]\)\%(\w\|%\|[^\x00-\x7F]\)*\|-.\)" syn match crystalGlobalVariable "$\%(\%(\h\|%\|[^\x00-\x7F]\)\%(\w\|%\|[^\x00-\x7F]\)*\|-.\)"
syn match crystalFreshVariable "\%(\h\|[^\x00-\x7F]\)\@<!%\%(\h\|[^\x00-\x7F]\)\%(\w\|%\|[^\x00-\x7F]\)*" display syn match crystalFreshVariable "\%(\h\|[^\x00-\x7F]\)\@1<!%\%(\h\|[^\x00-\x7F]\)\%(\w\|%\|[^\x00-\x7F]\)*" display
syn match crystalSymbol "[]})\"':]\@<!:\%(\^\|\~\|<<\|<=>\|<=\|<\|===\|[=!]=\|[=!]\~\|!\|>>\|>=\|>\||\|-@\|-\|/\|\[][=?]\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)" syn match crystalSymbol "[]})\"':]\@1<!:\%(\^\|\~\|<<\|<=>\|<=\|<\|===\|[=!]=\|[=!]\~\|!\|>>\|>=\|>\||\|-@\|-\|/\|\[][=?]\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)"
syn match crystalSymbol "[]})\"':]\@<!:\$\%(-.\|[`~<=>_,;:!?/.'"@$*\&+0]\)" syn match crystalSymbol "[]})\"':]\@1<!:\$\%(-.\|[`~<=>_,;:!?/.'"@$*\&+0]\)"
syn match crystalSymbol "[]})\"':]\@<!:\%(\$\|@@\=\)\=\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" syn match crystalSymbol "[]})\"':]\@1<!:\%(\$\|@@\=\)\=\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*"
syn match crystalSymbol "[]})\"':]\@<!:\%(\h\|%\|[^\x00-\x7F]\)\%(\w\|%\|[^\x00-\x7F]\)*\%([?!=]>\@!\)\=" syn match crystalSymbol "[]})\"':]\@1<!:\%(\h\|%\|[^\x00-\x7F]\)\%(\w\|%\|[^\x00-\x7F]\)*\%([?!=]>\@!\)\="
syn match crystalSymbol "\%([{(,]\_s*\)\@<=\l\w*[!?]\=::\@!"he=e-1 syn match crystalSymbol "\%([{(,]\_s*\)\@<=\l\w*[!?]\=::\@!"he=e-1
syn match crystalSymbol "[]})\"':]\@<!\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:\s\@="he=e-1 syn match crystalSymbol "[]})\"':]\@1<!\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:\s\@="he=e-1
syn match crystalSymbol "\%([{(,]\_s*\)\@<=[[:space:],{]\l\w*[!?]\=::\@!"hs=s+1,he=e-1 syn match crystalSymbol "\%([{(,]\_s*\)\@<=[[:space:],{]\l\w*[!?]\=::\@!"hs=s+1,he=e-1
syn match crystalSymbol "[[:space:],{]\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:\s\@="hs=s+1,he=e-1 syn match crystalSymbol "[[:space:],{]\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:\s\@="hs=s+1,he=e-1
SynFold ':' syn region crystalSymbol start="[]})\"':]\@<!:\"" end="\"" skip="\\\\\|\\\"" contains=@crystalStringSpecial SynFold ':' syn region crystalSymbol start="[]})\"':]\@1<!:\"" end="\"" skip="\\\\\|\\\"" contains=@crystalStringSpecial
syn match crystalBlockParameter "\%(\h\|%\|[^\x00-\x7F]\)\%(\w\|%\|[^\x00-\x7F]\)*" contained syn match crystalBlockParameter "\%(\h\|%\|[^\x00-\x7F]\)\%(\w\|%\|[^\x00-\x7F]\)*" contained
syn region crystalBlockParameterList start="\%(\%(\<do\>\|{\)\s*\)\@<=|" end="|" oneline display contains=crystalBlockParameter syn region crystalBlockParameterList start="\%(\%(\<do\>\|{\)\s*\)\@<=|" end="|" oneline display contains=crystalBlockParameter
@@ -173,18 +174,18 @@ syn match crystalPredefinedVariable "$_\>" display
syn match crystalPredefinedVariable "$-[0FIKadilpvw]\>" display syn match crystalPredefinedVariable "$-[0FIKadilpvw]\>" display
syn match crystalPredefinedVariable "$\%(deferr\|defout\|stderr\|stdin\|stdout\)\>" display syn match crystalPredefinedVariable "$\%(deferr\|defout\|stderr\|stdin\|stdout\)\>" display
syn match crystalPredefinedVariable "$\%(DEBUG\|FILENAME\|KCODE\|LOADED_FEATURES\|LOAD_PATH\|PROGRAM_NAME\|SAFE\|VERBOSE\)\>" display syn match crystalPredefinedVariable "$\%(DEBUG\|FILENAME\|KCODE\|LOADED_FEATURES\|LOAD_PATH\|PROGRAM_NAME\|SAFE\|VERBOSE\)\>" display
syn match crystalPredefinedConstant "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(MatchingData\|ARGF\|ARGV\|ENV\)\>\%(\s*(\)\@!" syn match crystalPredefinedConstant "\%(\%(\.\@1<!\.\)\@2<!\|::\)\_s*\zs\%(MatchingData\|ARGF\|ARGV\|ENV\)\>\%(\s*(\)\@!"
syn match crystalPredefinedConstant "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(DATA\|FALSE\|NIL\)\>\%(\s*(\)\@!" syn match crystalPredefinedConstant "\%(\%(\.\@1<!\.\)\@2<!\|::\)\_s*\zs\%(DATA\|FALSE\|NIL\)\>\%(\s*(\)\@!"
syn match crystalPredefinedConstant "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(STDERR\|STDIN\|STDOUT\|TOPLEVEL_BINDING\|TRUE\)\>\%(\s*(\)\@!" syn match crystalPredefinedConstant "\%(\%(\.\@1<!\.\)\@2<!\|::\)\_s*\zs\%(STDERR\|STDIN\|STDOUT\|TOPLEVEL_BINDING\|TRUE\)\>\%(\s*(\)\@!"
syn match crystalPredefinedConstant "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(crystal_\%(VERSION\|RELEASE_DATE\|PLATFORM\|PATCHLEVEL\|REVISION\|DESCRIPTION\|COPYRIGHT\|ENGINE\)\)\>\%(\s*(\)\@!" syn match crystalPredefinedConstant "\%(\%(\.\@1<!\.\)\@2<!\|::\)\_s*\zs\%(crystal_\%(VERSION\|RELEASE_DATE\|PLATFORM\|PATCHLEVEL\|REVISION\|DESCRIPTION\|COPYRIGHT\|ENGINE\)\)\>\%(\s*(\)\@!"
" Normal Regular Expression " Normal Regular Expression
SynFold '/' syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|ifdef\|when\|not\|then\|else\)\|[;\~=!|&(,[<>?:*+-]\)\s*\)\@<=/" end="/[imx]*" skip="\\\\\|\\/" contains=@crystalRegexpSpecial SynFold '/' syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|ifdef\|when\|not\|then\|else\)\|[;\~=!|&(,[<>?:*+-]\)\s*\)\@<=/" end="/[imx]*" skip="\\\\\|\\/" contains=@crystalRegexpSpecial
SynFold '/' syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/[ \t=/]\@!" end="/[imx]*" skip="\\\\\|\\/" contains=@crystalRegexpSpecial SynFold '/' syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/[ \t=/]\@!" end="/[imx]*" skip="\\\\\|\\/" contains=@crystalRegexpSpecial
" Generalized Regular Expression " Generalized Regular Expression
SynFold '%' syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="%r{" end="}[imx]*" skip="\\\\\|\\}" contains=@crystalRegexpSpecial SynFold '%' syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="%r{" end="}[imx]*" skip="\\\\\|\\}" contains=@crystalRegexpSpecial,crystalNestedRawCurlyBraces
SynFold '%' syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="%r<" end=">[imx]*" skip="\\\\\|\\>" contains=@crystalRegexpSpecial,crystalNestedAngleBrackets,crystalDelimEscape SynFold '%' syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="%r<" end=">[imx]*" skip="\\\\\|\\>" contains=@crystalRegexpSpecial,crystalNestedRawAngleBrackets
SynFold '%' syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="%r\[" end="\][imx]*" skip="\\\\\|\\\]" contains=@crystalRegexpSpecial SynFold '%' syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="%r\[" end="\][imx]*" skip="\\\\\|\\\]" contains=@crystalRegexpSpecial
SynFold '%' syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="%r(" end=")[imx]*" skip="\\\\\|\\)" contains=@crystalRegexpSpecial SynFold '%' syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="%r(" end=")[imx]*" skip="\\\\\|\\)" contains=@crystalRegexpSpecial
SynFold '%' syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="%r|" end="|[imx]*" skip="\\\\\|\\|" contains=@crystalRegexpSpecial SynFold '%' syn region crystalRegexp matchgroup=crystalRegexpDelimiter start="%r|" end="|[imx]*" skip="\\\\\|\\|" contains=@crystalRegexpSpecial
@@ -228,10 +229,10 @@ SynFold '%' syn region crystalString matchgroup=crystalStringDelimiter start="%[
SynFold '%' syn region crystalString matchgroup=crystalStringDelimiter start="%[Qx]\=|" end="|" skip="\\\\\|\\|" contains=@crystalStringSpecial,crystalDelimEscape SynFold '%' syn region crystalString matchgroup=crystalStringDelimiter start="%[Qx]\=|" end="|" skip="\\\\\|\\|" contains=@crystalStringSpecial,crystalDelimEscape
" Here Document " Here Document
syn region crystalHeredocStart matchgroup=crystalStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs\%(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)+ end=+$+ oneline contains=ALLBUT,@crystalNotTop syn region crystalHeredocStart matchgroup=crystalStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs\%(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)+ end=+$+ oneline contains=TOP
syn region crystalHeredocStart matchgroup=crystalStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs"\%([^"]*\)"+ end=+$+ oneline contains=ALLBUT,@crystalNotTop syn region crystalHeredocStart matchgroup=crystalStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs"\%([^"]*\)"+ end=+$+ oneline contains=TOP
syn region crystalHeredocStart matchgroup=crystalStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs'\%([^']*\)'+ end=+$+ oneline contains=ALLBUT,@crystalNotTop syn region crystalHeredocStart matchgroup=crystalStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs'\%([^']*\)'+ end=+$+ oneline contains=TOP
syn region crystalHeredocStart matchgroup=crystalStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs`\%([^`]*\)`+ end=+$+ oneline contains=ALLBUT,@crystalNotTop syn region crystalHeredocStart matchgroup=crystalStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<-\=\zs`\%([^`]*\)`+ end=+$+ oneline contains=TOP
SynFold '<<' syn region crystalString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+2 matchgroup=crystalStringDelimiter end=+^\z1$+ contains=crystalHeredocStart,crystalHeredoc,@crystalStringSpecial keepend SynFold '<<' syn region crystalString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+2 matchgroup=crystalStringDelimiter end=+^\z1$+ contains=crystalHeredocStart,crystalHeredoc,@crystalStringSpecial keepend
SynFold '<<' syn region crystalString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<"\z([^"]*\)"\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+2 matchgroup=crystalStringDelimiter end=+^\z1$+ contains=crystalHeredocStart,crystalHeredoc,@crystalStringSpecial keepend SynFold '<<' syn region crystalString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<"\z([^"]*\)"\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+2 matchgroup=crystalStringDelimiter end=+^\z1$+ contains=crystalHeredocStart,crystalHeredoc,@crystalStringSpecial keepend
@@ -256,8 +257,8 @@ syn match crystalLibDeclaration "[^[:space:];#]\+" contained contains=cr
syn match crystalMacroDeclaration "[^[:space:];#(]\+" contained contains=crystalFunction syn match crystalMacroDeclaration "[^[:space:];#(]\+" contained contains=crystalFunction
syn match crystalEnumDeclaration "[^[:space:];#<\"]\+" contained contains=crystalEnumName syn match crystalEnumDeclaration "[^[:space:];#<\"]\+" contained contains=crystalEnumName
syn match crystalFunction "\<[_[:alpha:]][_[:alnum:]]*[?!=]\=[[:alnum:]_.:?!=]\@!" contained containedin=crystalMethodDeclaration,crystalFunctionDeclaration syn match crystalFunction "\<[_[:alpha:]][_[:alnum:]]*[?!=]\=[[:alnum:]_.:?!=]\@!" contained containedin=crystalMethodDeclaration,crystalFunctionDeclaration
syn match crystalFunction "\%(\s\|^\)\@<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=crystalAliasDeclaration,crystalAliasDeclaration2 syn match crystalFunction "\%(\s\|^\)\@1<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=crystalAliasDeclaration,crystalAliasDeclaration2
syn match crystalFunction "\%([[:space:].]\|^\)\@<=\%(\[\][=?]\=\|\*\*\|[+-]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|[=!]=\|[=!]\~\|!\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=crystalAliasDeclaration,crystalAliasDeclaration2,crystalMethodDeclaration,crystalFunctionDeclaration syn match crystalFunction "\%([[:space:].]\|^\)\@1<=\%(\[\][=?]\=\|\*\*\|[+-]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|[=!]=\|[=!]\~\|!\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=crystalAliasDeclaration,crystalAliasDeclaration2,crystalMethodDeclaration,crystalFunctionDeclaration
syn cluster crystalDeclaration contains=crystalAliasDeclaration,crystalAliasDeclaration2,crystalMethodDeclaration,crystalFunctionDeclaration,crystalModuleDeclaration,crystalClassDeclaration,crystalStructDeclaration,crystalLibDeclaration,crystalMacroDeclaration,crystalFunction,crystalBlockParameter,crystalTypeDeclaration,crystalEnumDeclaration syn cluster crystalDeclaration contains=crystalAliasDeclaration,crystalAliasDeclaration2,crystalMethodDeclaration,crystalFunctionDeclaration,crystalModuleDeclaration,crystalClassDeclaration,crystalStructDeclaration,crystalLibDeclaration,crystalMacroDeclaration,crystalFunction,crystalBlockParameter,crystalTypeDeclaration,crystalEnumDeclaration
@@ -285,28 +286,28 @@ if !exists('b:crystal_no_expensive') && !exists('g:crystal_no_expensive')
syn match crystalMacro "\<macro\>" nextgroup=crystalMacroDeclaration skipwhite skipnl syn match crystalMacro "\<macro\>" nextgroup=crystalMacroDeclaration skipwhite skipnl
syn match crystalEnum "\<enum\>" nextgroup=crystalEnumDeclaration skipwhite skipnl syn match crystalEnum "\<enum\>" nextgroup=crystalEnumDeclaration skipwhite skipnl
SynFold 'def' syn region crystalMethodBlock start="\<\%(def\|macro\)\>" matchgroup=crystalDefine end="\%(\<\%(def\|macro\)\_s\+\)\@<!\<end\>" contains=ALLBUT,@crystalNotTop SynFold 'def' syn region crystalMethodBlock start="\<\%(def\|macro\)\>" matchgroup=crystalDefine end="\%(\<\%(def\|macro\)\_s\+\)\@<!\<end\>" contains=TOP
SynFold 'class' syn region crystalBlock start="\<class\>" matchgroup=crystalClass end="\<end\>" contains=ALLBUT,@crystalNotTop SynFold 'class' syn region crystalBlock start="\<class\>" matchgroup=crystalClass end="\<end\>" contains=TOP
SynFold 'module' syn region crystalBlock start="\<module\>" matchgroup=crystalModule end="\<end\>" contains=ALLBUT,@crystalNotTop SynFold 'module' syn region crystalBlock start="\<module\>" matchgroup=crystalModule end="\<end\>" contains=TOP
SynFold 'struct' syn region crystalBlock start="\<struct\>" matchgroup=crystalStruct end="\<end\>" contains=ALLBUT,@crystalNotTop SynFold 'struct' syn region crystalBlock start="\<struct\>" matchgroup=crystalStruct end="\<end\>" contains=TOP
SynFold 'lib' syn region crystalBlock start="\<lib\>" matchgroup=crystalLib end="\<end\>" contains=ALLBUT,@crystalNotTop SynFold 'lib' syn region crystalBlock start="\<lib\>" matchgroup=crystalLib end="\<end\>" contains=TOP
SynFold 'enum' syn region crystalBlock start="\<enum\>" matchgroup=crystalEnum end="\<end\>" contains=ALLBUT,@crystalNotTop SynFold 'enum' syn region crystalBlock start="\<enum\>" matchgroup=crystalEnum end="\<end\>" contains=TOP
" modifiers " modifiers
syn match crystalConditionalModifier "\<\%(if\|unless\|ifdef\)\>" display syn match crystalConditionalModifier "\<\%(if\|unless\|ifdef\)\>" display
syn match crystalRepeatModifier "\<\%(while\|until\)\>" display
SynFold 'do' syn region crystalDoBlock matchgroup=crystalControl start="\<do\>" end="\<end\>" contains=ALLBUT,@crystalNotTop SynFold 'do' syn region crystalDoBlock matchgroup=crystalControl start="\<do\>" end="\<end\>" contains=TOP
" curly bracket block or hash literal " curly bracket block or hash literal
SynFold '{' syn region crystalCurlyBlock matchgroup=crystalCurlyBlockDelimiter start="{" end="}" contains=ALLBUT,@crystalNotTop SynFold '{' syn region crystalCurlyBlock matchgroup=crystalCurlyBlockDelimiter start="{" end="}" contains=TOP
SynFold '[' syn region crystalArrayLiteral matchgroup=crystalArrayDelimiter start="\%(\w\|[\]})]\)\@<!\[" end="]" contains=ALLBUT,@crystalNotTop SynFold '[' syn region crystalArrayLiteral matchgroup=crystalArrayDelimiter start="\%(\w\|[\]})]\)\@1<!\[" end="]" contains=TOP
" statements without 'do' " statements without 'do'
SynFold 'begin' syn region crystalBlockExpression matchgroup=crystalControl start="\<begin\>" end="\<end\>" contains=ALLBUT,@crystalNotTop SynFold 'begin' syn region crystalBlockExpression matchgroup=crystalControl start="\<begin\>" end="\<end\>" contains=TOP
SynFold 'case' syn region crystalCaseExpression matchgroup=crystalConditional start="\<case\>" end="\<end\>" contains=ALLBUT,@crystalNotTop SynFold 'while' syn region crystalRepeatExpression matchgroup=crystalRepeat start="\<\%(while\|until\)\>" end="\<end\>" contains=TOP
SynFold 'select' syn region crystalSelectExpression matchgroup=crystalConditional start="\<select\>" end="\<end\>" contains=ALLBUT,@crystalNotTop SynFold 'case' syn region crystalCaseExpression matchgroup=crystalConditional start="\<case\>" end="\<end\>" contains=TOP
SynFold 'if' syn region crystalConditionalExpression matchgroup=crystalConditional start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+=-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![?!]\)\s*\)\@<=\%(if\|ifdef\|unless\)\>" end="\%(\%(\%(\.\@<!\.\)\|::\)\s*\)\@<!\<end\>" contains=ALLBUT,@crystalNotTop SynFold 'select' syn region crystalSelectExpression matchgroup=crystalConditional start="\<select\>" end="\<end\>" contains=TOP
SynFold 'if' syn region crystalConditionalExpression matchgroup=crystalConditional start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+=-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![?!]\)\s*\)\@<=\%(if\|ifdef\|unless\)\>" end="\%(\%(\%(\.\@1<!\.\)\|::\)\s*\)\@<!\<end\>" contains=TOP
syn match crystalConditional "\<\%(then\|else\|when\)\>[?!]\@!" contained containedin=crystalCaseExpression syn match crystalConditional "\<\%(then\|else\|when\)\>[?!]\@!" contained containedin=crystalCaseExpression
syn match crystalConditional "\<\%(when\|else\)\>[?!]\@!" contained containedin=crystalSelectExpression syn match crystalConditional "\<\%(when\|else\)\>[?!]\@!" contained containedin=crystalSelectExpression
@@ -336,10 +337,7 @@ else
endif endif
" Link attribute " Link attribute
syn region crystalLinkAttrRegion start="@\[" nextgroup=crystalLinkAttrRegionInner end="]" contains=crystalLinkAttr,crystalLinkAttrRegionInner transparent display oneline syn region crystalLinkAttr matchgroup=crystalLinkAttrDelim start="@\[" end="]" contains=TOP display oneline
syn region crystalLinkAttrRegionInner start="\%(@\[\)\@<=" end="]\@=" contained contains=ALLBUT,@crystalNotTop transparent display oneline
syn match crystalLinkAttr "@\[" contained containedin=crystalLinkAttrRegion display
syn match crystalLinkAttr "]" contained containedin=crystalLinkAttrRegion display
" Special Methods " Special Methods
if !exists('g:crystal_no_special_methods') if !exists('g:crystal_no_special_methods')
@@ -358,42 +356,56 @@ endif
" Macro " Macro
" Note: This definition must be put after crystalNestedCurlyBraces to give higher priority " Note: This definition must be put after crystalNestedCurlyBraces to give higher priority
syn region crystalMacroRegion matchgroup=crystalMacroDelim start="\\\={%" end="%}" oneline display contains=TOP,@crystalExpensive containedin=ALL syn region crystalMacroRegion matchgroup=crystalMacroDelim start="\\\={%" end="%}" oneline display contains=@crystalMacroGroup containedin=ALL
syn region crystalMacroRegion matchgroup=crystalMacroDelim start="\\\={{" end="}}" oneline display contains=TOP,@crystalExpensive containedin=ALL syn region crystalMacroRegion matchgroup=crystalMacroDelim start="\\\={{" end="}}" oneline display contains=@crystalMacroGroup containedin=ALL
" Cluster for groups that can appear inside macro expressions
syn cluster crystalMacroGroup contains=@crystalTop
" Cluster for Expensive Mode groups that can't appear inside macro " Cluster for Expensive Mode groups that can't appear inside macro
" regions " regions
syn cluster crystalExpensive contains= syn cluster crystalExpensive contains=
\ crystalMethodBlock,crystalBlock,crystalDoBlock,crystalBlockExpression,crystalCaseExpression, \ crystalMethodBlock,crystalBlock,crystalDoBlock,crystalBlockExpression,crystalRepeatExpression,
\ crystalSelectExpression,crystalConditionalExpression \ crystalCaseExpression,crystalSelectExpression,crystalConditionalExpression
syn cluster crystalMacroGroup remove=@crystalExpensive
" Some keywords will have to be redefined for them to be highlighted " Some keywords will have to be redefined for them to be highlighted
" properly " properly
syn keyword crystalMacroKeyword contained containedin=crystalMacroRegion syn keyword crystalMacroKeyword contained
\ if else elsif end for in begin do \ if else elsif end for in begin do case when while until loop
syn cluster crystalNotTop add=crystalMacroKeyword \ rescue ensure
syn cluster crystalMacroGroup add=crystalMacroKeyword
" Comments and Documentation " Comments and Documentation
syn match crystalSharpBang "\%^#!.*" display syn match crystalSharpBang "\%^#!.*" display
syn keyword crystalTodo FIXME NOTE TODO OPTIMIZE XXX todo contained syn keyword crystalTodo FIXME NOTE TODO OPTIMIZE XXX todo contained
syn match crystalComment "#.*" contains=crystalSharpBang,crystalSpaceError,crystalTodo,@Spell
if exists('g:main_syntax') && g:main_syntax ==# 'ecrystal'
" eCrystal tags can contain Crystal comments, so we need to modify the
" pattern for comments so that it does not consume delimiters
syn match crystalComment "#.*\ze\%($\|-\=%>\)" contains=crystalSharpBang,crystalSpaceError,crystalTodo,@Spell
else
syn match crystalComment "#.*" contains=crystalSharpBang,crystalSpaceError,crystalTodo,@Spell
endif
SynFold '#' syn region crystalMultilineComment start="\%(\%(^\s*#.*\n\)\@<!\%(^\s*#.*\n\)\)\%(\(^\s*#.*\n\)\{1,}\)\@=" end="\%(^\s*#.*\n\)\@<=\%(^\s*#.*\n\)\%(^\s*#\)\@!" contains=crystalComment transparent keepend SynFold '#' syn region crystalMultilineComment start="\%(\%(^\s*#.*\n\)\@<!\%(^\s*#.*\n\)\)\%(\(^\s*#.*\n\)\{1,}\)\@=" end="\%(^\s*#.*\n\)\@<=\%(^\s*#.*\n\)\%(^\s*#\)\@!" contains=crystalComment transparent keepend
" Note: this is a hack to prevent 'keywords' being highlighted as such when called as methods with an explicit receiver " Note: this is a hack to prevent 'keywords' being highlighted as such when called as methods with an explicit receiver
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(alias\|begin\|break\|case\|class\|def\|defined\|do\|else\|select\)\>" transparent contains=NONE syn match crystalKeywordAsMethod "\%(\%(\.\@1<!\.\)\|::\)\_s*\%(alias\|begin\|break\|case\|class\|def\|defined\|do\|else\|select\)\>" transparent contains=NONE
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(elsif\|end\|ensure\|false\|for\|if\|ifdef\|in\|module\|next\|nil\)\>" transparent contains=NONE syn match crystalKeywordAsMethod "\%(\%(\.\@1<!\.\)\|::\)\_s*\%(elsif\|end\|ensure\|false\|for\|if\|ifdef\|in\|module\|next\|nil\)\>" transparent contains=NONE
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(rescue\|return\|self\|super\|previous_def\|then\|true\)\>" transparent contains=NONE syn match crystalKeywordAsMethod "\%(\%(\.\@1<!\.\)\|::\)\_s*\%(rescue\|return\|self\|super\|previous_def\|then\|true\)\>" transparent contains=NONE
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(undef\|unless\|until\|when\|while\|yield\|with\|__FILE__\|__LINE__\)\>" transparent contains=NONE syn match crystalKeywordAsMethod "\%(\%(\.\@1<!\.\)\|::\)\_s*\%(undef\|unless\|until\|when\|while\|yield\|with\|__FILE__\|__LINE__\)\>" transparent contains=NONE
syn match crystalKeywordAsMethod "\<\%(alias\|begin\|case\|class\|def\|do\|end\)[?!]" transparent contains=NONE syn match crystalKeywordAsMethod "\<\%(alias\|begin\|case\|class\|def\|do\|end\)[?!]" transparent contains=NONE
syn match crystalKeywordAsMethod "\<\%(if\|ifdef\|module\|undef\|unless\|until\|while\)[?!]" transparent contains=NONE syn match crystalKeywordAsMethod "\<\%(if\|ifdef\|module\|undef\|unless\|until\|while\)[?!]" transparent contains=NONE
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(abort\|at_exit\|caller\|exit\)\>" transparent contains=NONE syn match crystalKeywordAsMethod "\%(\%(\.\@1<!\.\)\|::\)\_s*\%(abort\|at_exit\|caller\|exit\)\>" transparent contains=NONE
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(extend\|fork\|include\|asm\)\>" transparent contains=NONE syn match crystalKeywordAsMethod "\%(\%(\.\@1<!\.\)\|::\)\_s*\%(extend\|fork\|include\|asm\)\>" transparent contains=NONE
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(loop\|private\|protected\)\>" transparent contains=NONE syn match crystalKeywordAsMethod "\%(\%(\.\@1<!\.\)\|::\)\_s*\%(loop\|private\|protected\)\>" transparent contains=NONE
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(require\|raise\)\>" transparent contains=NONE syn match crystalKeywordAsMethod "\%(\%(\.\@1<!\.\)\|::\)\_s*\%(require\|raise\)\>" transparent contains=NONE
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(typeof\|pointerof\|sizeof\|instance_sizeof\|\)\>" transparent contains=NONE syn match crystalKeywordAsMethod "\%(\%(\.\@1<!\.\)\|::\)\_s*\%(typeof\|pointerof\|sizeof\|instance_sizeof\|\)\>" transparent contains=NONE
hi def link crystalClass crystalDefine hi def link crystalClass crystalDefine
hi def link crystalModule crystalDefine hi def link crystalModule crystalDefine
@@ -407,7 +419,6 @@ hi def link crystalConditional Conditional
hi def link crystalConditionalModifier crystalConditional hi def link crystalConditionalModifier crystalConditional
hi def link crystalExceptional crystalConditional hi def link crystalExceptional crystalConditional
hi def link crystalRepeat Repeat hi def link crystalRepeat Repeat
hi def link crystalRepeatModifier crystalRepeat
hi def link crystalControl Statement hi def link crystalControl Statement
hi def link crystalInclude Include hi def link crystalInclude Include
hi def link crystalRecord Statement hi def link crystalRecord Statement
@@ -465,7 +476,7 @@ hi def link crystalRegexp crystalString
hi def link crystalMacro PreProc hi def link crystalMacro PreProc
hi def link crystalMacroDelim crystalMacro hi def link crystalMacroDelim crystalMacro
hi def link crystalMacroKeyword crystalKeyword hi def link crystalMacroKeyword crystalKeyword
hi def link crystalLinkAttr crystalMacro hi def link crystalLinkAttrDelim crystalMacro
hi def link crystalError Error hi def link crystalError Error
hi def link crystalInvalidVariable crystalError hi def link crystalInvalidVariable crystalError
hi def link crystalSpaceError crystalError hi def link crystalSpaceError crystalError

View File

@@ -5,14 +5,14 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dart') == -1
" for details. All rights reserved. Use of this source code is governed by a " for details. All rights reserved. Use of this source code is governed by a
" BSD-style license that can be found in the LICENSE file. " BSD-style license that can be found in the LICENSE file.
if !exists("g:main_syntax") if !exists('g:main_syntax')
if version < 600 if v:version < 600
syntax clear syntax clear
elseif exists("b:current_syntax") elseif exists('b:current_syntax')
finish finish
endif endif
let g:main_syntax = 'dart' let g:main_syntax = 'dart'
syntax region dartFold start="{" end="}" transparent fold syntax region dartFold start='{' end='}' transparent fold
endif endif
" Ensure long multiline strings are highlighted. " Ensure long multiline strings are highlighted.
@@ -25,7 +25,7 @@ syntax keyword dartConditional if else switch
syntax keyword dartRepeat do while for syntax keyword dartRepeat do while for
syntax keyword dartBoolean true false syntax keyword dartBoolean true false
syntax keyword dartConstant null syntax keyword dartConstant null
syntax keyword dartTypedef this super class typedef enum mixin syntax keyword dartTypedef this super class typedef enum mixin extension
syntax keyword dartOperator new is as in syntax keyword dartOperator new is as in
syntax match dartOperator "+=\=\|-=\=\|*=\=\|/=\=\|%=\=\|\~/=\=\|<<=\=\|>>=\=\|[<>]=\=\|===\=\|\!==\=\|&=\=\|\^=\=\||=\=\|||\|&&\|\[\]=\=\|=>\|!\|\~\|?\|:" syntax match dartOperator "+=\=\|-=\=\|*=\=\|/=\=\|%=\=\|\~/=\=\|<<=\=\|>>=\=\|[<>]=\=\|===\=\|\!==\=\|&=\=\|\^=\=\||=\=\|||\|&&\|\[\]=\=\|=>\|!\|\~\|?\|:"
syntax keyword dartCoreType void var dynamic syntax keyword dartCoreType void var dynamic
@@ -42,9 +42,9 @@ syntax match dartUserLabelRef "\k\+" contained
syntax region dartLabelRegion transparent matchgroup=dartLabel start="\<case\>" matchgroup=NONE end=":" syntax region dartLabelRegion transparent matchgroup=dartLabel start="\<case\>" matchgroup=NONE end=":"
syntax keyword dartLabel default syntax keyword dartLabel default
syntax match dartLibrary "^\(import\|export\)\>" nextgroup=dartUri skipwhite syntax match dartLibrary "^\(import\|export\)\>" nextgroup=dartUri skipwhite skipnl
syntax region dartUri contained start=+r\=\z(["']\)+ end=+\z1+ nextgroup=dartCombinators skipwhite syntax region dartUri contained start=+r\=\z(["']\)+ end=+\z1+ nextgroup=dartCombinators skipwhite skipnl
syntax region dartCombinators contained start="" end=";" contains=dartCombinator syntax region dartCombinators contained start="" end=";" contains=dartCombinator,dartComment,dartLineComment
syntax keyword dartCombinator contained show hide deferred as syntax keyword dartCombinator contained show hide deferred as
syntax match dartLibrary "^\(library\|part of\|part\)\>" syntax match dartLibrary "^\(library\|part of\|part\)\>"
@@ -136,8 +136,8 @@ highlight default link dartUserType dartType
highlight default link dartType Type highlight default link dartType Type
highlight default link dartFunction Function highlight default link dartFunction Function
let b:current_syntax = "dart" let b:current_syntax = 'dart'
let b:spell_options = "contained" let b:spell_options = 'contained'
if g:main_syntax is# 'dart' if g:main_syntax is# 'dart'
unlet g:main_syntax unlet g:main_syntax

37
syntax/ecrystal.vim Normal file
View File

@@ -0,0 +1,37 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
if &syntax !~# '\<ecrystal\>' || get(b:, 'current_syntax') =~# '\<ecrystal\>'
finish
endif
if !exists('main_syntax')
let main_syntax = 'ecrystal'
endif
call ecrystal#SetSubtype()
if b:ecrystal_subtype !=# ''
exec 'runtime! syntax/'.b:ecrystal_subtype.'.vim'
unlet! b:current_syntax
endif
syn include @crystalTop syntax/crystal.vim
syn cluster ecrystalRegions contains=ecrystalControl,ecrystalRender,ecrystalComment
syn region ecrystalControl matchgroup=ecrystalDelimiter start="<%%\@!-\=" end="-\=%>" display contains=@crystalTop containedin=ALLBUT,@ecrystalRegions
syn region ecrystalRender matchgroup=ecrystalDelimiter start="<%%\@!-\==" end="-\=%>" display contains=@crystalTop containedin=ALLBUT,@ecrystalRegions
syn region ecrystalComment matchgroup=ecrystalDelimiter start="<%%\@!-\=#" end="-\=%>" display contains=crystalTodo,@Spell containedin=ALLBUT,@ecrystalRegions
" Define the default highlighting.
hi def link ecrystalDelimiter PreProc
hi def link ecrystalComment crystalComment
let b:current_syntax = 'ecrystal'
if exists('main_syntax') && main_syntax ==# 'ecrystal'
unlet main_syntax
endif
endif

View File

@@ -20,6 +20,10 @@ syn keyword elixirTodo FIXME NOTE TODO OPTIMIZE XXX HACK contained
syn match elixirId '\<[_a-zA-Z]\w*[!?]\?\>' contains=elixirUnusedVariable syn match elixirId '\<[_a-zA-Z]\w*[!?]\?\>' contains=elixirUnusedVariable
syn match elixirFunctionCall '\<[a-z_]\w*[!?]\?\(\s*\.\?\s*(\|\s\+[a-zA-Z0-9@:\'\"\[]\)\@='
syn match elixirFunctionCall '\(:\w\+\s*\.\s*\|[A-Z]\w*\s*\.\s*\)\@<=[a-z_]\w*[!?]\?'
syn match elixirFunctionCall '\(>\s+\)\<[a-z_]\w*[!?]\?'
syn match elixirKeyword '\(\.\)\@<!\<\(for\|case\|when\|with\|cond\|if\|unless\|try\|receive\|after\|raise\|rescue\|catch\|else\|quote\|unquote\|super\|unquote_splicing\)\>:\@!' syn match elixirKeyword '\(\.\)\@<!\<\(for\|case\|when\|with\|cond\|if\|unless\|try\|receive\|after\|raise\|rescue\|catch\|else\|quote\|unquote\|super\|unquote_splicing\)\>:\@!'
syn keyword elixirInclude import require alias use syn keyword elixirInclude import require alias use
@@ -40,6 +44,7 @@ syn match elixirOperator '|||\|||\||>\||'
syn match elixirOperator '\.\.\|\.' syn match elixirOperator '\.\.\|\.'
syn match elixirOperator "\^\^\^\|\^" syn match elixirOperator "\^\^\^\|\^"
syn match elixirOperator '\\\\\|::\|\*\|/\|\~\~\~\|@' syn match elixirOperator '\\\\\|::\|\*\|/\|\~\~\~\|@'
syn match elixirOperator '\~>\|\~>>\|<\~\|<<\~\|<\~>'
syn match elixirAlias '\([a-z]\)\@<![A-Z]\w*\%(\.[A-Z]\w*\)*' syn match elixirAlias '\([a-z]\)\@<![A-Z]\w*\%(\.[A-Z]\w*\)*'

View File

@@ -401,7 +401,7 @@ function! s:hi()
" filetype plugin on, the highlight groups won't be defined when " filetype plugin on, the highlight groups won't be defined when
" ftplugin/go.vim is executed when the first go file is opened. " ftplugin/go.vim is executed when the first go file is opened.
" See https://github.com/fatih/vim-go/issues/2658. " See https://github.com/fatih/vim-go/issues/2658.
if exists('*prop_type_add') if has('textprop')
if empty(prop_type_get('goSameId')) if empty(prop_type_get('goSameId'))
call prop_type_add('goSameId', {'highlight': 'goSameId'}) call prop_type_add('goSameId', {'highlight': 'goSameId'})
endif endif

View File

@@ -1,6 +1,6 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
" Copyright (c) 2016-2019 Jon Parise <jon@indelible.org> " Copyright (c) 2016-2020 Jon Parise <jon@indelible.org>
" "
" Permission is hereby granted, free of charge, to any person obtaining a copy " Permission is hereby granted, free of charge, to any person obtaining a copy
" of this software and associated documentation files (the "Software"), to " of this software and associated documentation files (the "Software"), to
@@ -24,7 +24,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1
" Maintainer: Jon Parise <jon@indelible.org> " Maintainer: Jon Parise <jon@indelible.org>
if exists('b:current_syntax') if exists('b:current_syntax')
finish finish
endif endif
syn case match syn case match

View File

@@ -69,9 +69,9 @@ syn match i3ConfigModifier /\w\++\w\+\(\(+\w\+\)\+\)\?/ contained contains=i3Con
syn match i3ConfigNumber /\s\d\+/ contained syn match i3ConfigNumber /\s\d\+/ contained
syn match i3ConfigUnit /\sp\(pt\|x\)/ contained syn match i3ConfigUnit /\sp\(pt\|x\)/ contained
syn match i3ConfigUnitOr /\sor/ contained syn match i3ConfigUnitOr /\sor/ contained
syn keyword i3ConfigBindKeyword bindsym bindcode exec gaps contained syn keyword i3ConfigBindKeyword bindsym bindcode exec gaps border contained
syn match i3ConfigBindArgument /--\w\+\(\(-\w\+\)\+\)\?\s/ contained syn match i3ConfigBindArgument /--\w\+\(\(-\w\+\)\+\)\?\s/ contained
syn match i3ConfigBind /^\s*\(bindsym\|bindcode\)\s\+.*$/ contains=i3ConfigVariable,i3ConfigBindKeyword,i3ConfigVariableAndModifier,i3ConfigNumber,i3ConfigUnit,i3ConfigUnitOr,i3ConfigBindArgument,i3ConfigModifier,i3ConfigAction,i3ConfigString,i3ConfigGapStyleKeyword syn match i3ConfigBind /^\s*\(bindsym\|bindcode\)\s\+.*$/ contains=i3ConfigVariable,i3ConfigBindKeyword,i3ConfigVariableAndModifier,i3ConfigNumber,i3ConfigUnit,i3ConfigUnitOr,i3ConfigBindArgument,i3ConfigModifier,i3ConfigAction,i3ConfigString,i3ConfigGapStyleKeyword,i3ConfigBorderStyleKeyword
" Floating " Floating
syn keyword i3ConfigSizeSpecial x contained syn keyword i3ConfigSizeSpecial x contained
@@ -90,7 +90,7 @@ syn match i3ConfigLayout /^\s*workspace_layout\s\+\(default\|stacking\|tabbed\)\
" Border style " Border style
syn keyword i3ConfigBorderStyleKeyword none normal pixel contained syn keyword i3ConfigBorderStyleKeyword none normal pixel contained
syn match i3ConfigBorderStyle /^\s*\(new_window\|new_float\|default_border\|default_floating_border\)\s\+\(none\|\(normal\|pixel\)\(\s\+\d\+\)\?\)\s\?$/ contains=i3ConfigBorderStyleKeyword,i3ConfigNumber syn match i3ConfigBorderStyle /^\s*\(new_window\|new_float\|default_border\|default_floating_border\)\s\+\(none\|\(normal\|pixel\)\(\s\+\d\+\)\?\(\s\+\$\w\+\(\(-\w\+\)\+\)\?\(\s\|+\)\?\)\?\)\s\?$/ contains=i3ConfigBorderStyleKeyword,i3ConfigNumber,i3ConfigVariable
" Hide borders and edges " Hide borders and edges
syn keyword i3ConfigEdgeKeyword none vertical horizontal both smart smart_no_gaps contained syn keyword i3ConfigEdgeKeyword none vertical horizontal both smart smart_no_gaps contained

View File

@@ -186,7 +186,7 @@ syntax match jsClassNoise contained /\./
syntax match jsClassFuncName contained /\<\K\k*\ze\s*[(<]/ skipwhite skipempty nextgroup=jsFuncArgs,jsFlowClassFunctionGroup syntax match jsClassFuncName contained /\<\K\k*\ze\s*[(<]/ skipwhite skipempty nextgroup=jsFuncArgs,jsFlowClassFunctionGroup
syntax match jsClassMethodType contained /\<\%([gs]et\|static\)\ze\s\+\K\k*/ skipwhite skipempty nextgroup=jsAsyncKeyword,jsClassFuncName,jsClassProperty syntax match jsClassMethodType contained /\<\%([gs]et\|static\)\ze\s\+\K\k*/ skipwhite skipempty nextgroup=jsAsyncKeyword,jsClassFuncName,jsClassProperty
syntax region jsClassDefinition start=/\<class\>/ end=/\(\<extends\>\s\+\)\@<!{\@=/ contains=jsClassKeyword,jsExtendsKeyword,jsClassNoise,@jsExpression,jsFlowClassGroup skipwhite skipempty nextgroup=jsCommentClass,jsClassBlock,jsFlowClassGroup syntax region jsClassDefinition start=/\<class\>/ end=/\(\<extends\>\s\+\)\@<!{\@=/ contains=jsClassKeyword,jsExtendsKeyword,jsClassNoise,@jsExpression,jsFlowClassGroup skipwhite skipempty nextgroup=jsCommentClass,jsClassBlock,jsFlowClassGroup
syntax match jsClassProperty contained /\<\K\k*\ze\s*=/ skipwhite skipempty nextgroup=jsClassValue,jsFlowClassDef syntax match jsClassProperty contained /\<\K\k*\ze\s*[=;]/ skipwhite skipempty nextgroup=jsClassValue,jsFlowClassDef
syntax region jsClassValue contained start=/=/ end=/\_[;}]\@=/ contains=@jsExpression syntax region jsClassValue contained start=/=/ end=/\_[;}]\@=/ contains=@jsExpression
syntax region jsClassPropertyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsFuncArgs,jsClassValue extend syntax region jsClassPropertyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsFuncArgs,jsClassValue extend
syntax region jsClassStringKey contained start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs syntax region jsClassStringKey contained start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs

View File

@@ -35,7 +35,7 @@ set cpo&vim
" http://mesonbuild.com/Syntax.html " http://mesonbuild.com/Syntax.html
syn keyword mesonConditional elif else if endif syn keyword mesonConditional elif else if endif
syn keyword mesonRepeat foreach endforeach syn keyword mesonRepeat foreach endforeach
syn keyword mesonOperator and not or syn keyword mesonOperator and not or in
syn match mesonComment "#.*$" contains=mesonTodo,@Spell syn match mesonComment "#.*$" contains=mesonTodo,@Spell
syn keyword mesonTodo FIXME NOTE NOTES TODO XXX contained syn keyword mesonTodo FIXME NOTE NOTES TODO XXX contained

View File

@@ -39,16 +39,16 @@ syntax keyword plantumlTypeKeyword concise robust
" Since "syntax keyword" can handle only words, "top to bottom direction" is excluded. " Since "syntax keyword" can handle only words, "top to bottom direction" is excluded.
syntax keyword plantumlKeyword accross activate again allow_mixing allowmixing also alt as autonumber bottom syntax keyword plantumlKeyword accross activate again allow_mixing allowmixing also alt as autonumber bottom
syntax keyword plantumlKeyword box break caption center create critical deactivate destroy down else elseif end syntax keyword plantumlKeyword box break caption center create critical deactivate destroy down else elseif end
syntax keyword plantumlKeyword endif endwhile footbox footer fork group header hide hnote if is kill left in at are to the and syntax keyword plantumlKeyword endif endwhile footbox footer fork group header hide hnote if is kill left
syntax keyword plantumlKeyword legend link loop mainframe namespace newpage note of on opt order over package syntax keyword plantumlKeyword legend link loop mainframe namespace newpage note of on opt order over package
syntax keyword plantumlKeyword page par partition ref repeat return right rnote rotate show skin skinparam syntax keyword plantumlKeyword page par partition ref repeat return right rnote rotate show skin skinparam
syntax keyword plantumlKeyword start stop title top up while syntax keyword plantumlKeyword split start stereotype stop title top up while
"}}} "}}}
" Not in 'java - jar plantuml.jar - language' results " Not in 'java - jar plantuml.jar - language' results
syntax keyword plantumlKeyword endlegend split sprite then syntax keyword plantumlKeyword endlegend sprite then
" gantt " gantt
syntax keyword plantumlTypeKeyword project monday tuesday wednesday thursday friday saturday sunday syntax keyword plantumlTypeKeyword project monday tuesday wednesday thursday friday saturday sunday
syntax keyword plantumlKeyword starts ends start end closed day after colored lasts happens syntax keyword plantumlKeyword starts ends start end closed day after colored lasts happens in at are to the and
syntax keyword plantumlCommentTODO XXX TODO FIXME NOTE contained syntax keyword plantumlCommentTODO XXX TODO FIXME NOTE contained
@@ -278,7 +278,7 @@ syntax keyword plantumlSkinparamKeyword ParticipantStereotypeFontName Participan
syntax keyword plantumlSkinparamKeyword ParticipantStereotypeFontStyle PartitionBackgroundColor PartitionBorderColor syntax keyword plantumlSkinparamKeyword ParticipantStereotypeFontStyle PartitionBackgroundColor PartitionBorderColor
syntax keyword plantumlSkinparamKeyword PartitionBorderThickness PartitionFontColor PartitionFontName PartitionFontSize syntax keyword plantumlSkinparamKeyword PartitionBorderThickness PartitionFontColor PartitionFontName PartitionFontSize
syntax keyword plantumlSkinparamKeyword PartitionFontStyle PathHoverColor QueueBackgroundColor QueueBorderColor syntax keyword plantumlSkinparamKeyword PartitionFontStyle PathHoverColor QueueBackgroundColor QueueBorderColor
syntax keyword plantumlSkinparamKeyword QueueFontColor QueueFontName QueueFontSize QueueFontStyle syntax keyword plantumlSkinparamKeyword QueueBorderThickness QueueFontColor QueueFontName QueueFontSize QueueFontStyle
syntax keyword plantumlSkinparamKeyword QueueStereotypeFontColor QueueStereotypeFontName QueueStereotypeFontSize syntax keyword plantumlSkinparamKeyword QueueStereotypeFontColor QueueStereotypeFontName QueueStereotypeFontSize
syntax keyword plantumlSkinparamKeyword QueueStereotypeFontStyle Ranksep RectangleBackgroundColor RectangleBorderColor syntax keyword plantumlSkinparamKeyword QueueStereotypeFontStyle Ranksep RectangleBackgroundColor RectangleBorderColor
syntax keyword plantumlSkinparamKeyword RectangleBorderThickness RectangleFontColor RectangleFontName RectangleFontSize syntax keyword plantumlSkinparamKeyword RectangleBorderThickness RectangleFontColor RectangleFontName RectangleFontSize
@@ -310,9 +310,8 @@ syntax keyword plantumlSkinparamKeyword SequenceReferenceBorderThickness Sequenc
syntax keyword plantumlSkinparamKeyword SequenceReferenceFontName SequenceReferenceFontSize SequenceReferenceFontStyle syntax keyword plantumlSkinparamKeyword SequenceReferenceFontName SequenceReferenceFontSize SequenceReferenceFontStyle
syntax keyword plantumlSkinparamKeyword SequenceReferenceHeaderBackgroundColor SequenceStereotypeFontColor syntax keyword plantumlSkinparamKeyword SequenceReferenceHeaderBackgroundColor SequenceStereotypeFontColor
syntax keyword plantumlSkinparamKeyword SequenceStereotypeFontName SequenceStereotypeFontSize syntax keyword plantumlSkinparamKeyword SequenceStereotypeFontName SequenceStereotypeFontSize
syntax keyword plantumlSkinparamKeyword SequenceStereotypeFontStyle SequenceTitleFontColor SequenceTitleFontName syntax keyword plantumlSkinparamKeyword SequenceStereotypeFontStyle Shadowing StackBackgroundColor StackBorderColor
syntax keyword plantumlSkinparamKeyword SequenceTitleFontSize SequenceTitleFontStyle Shadowing StackBackgroundColor syntax keyword plantumlSkinparamKeyword StackFontColor StackFontName StackFontSize StackFontStyle
syntax keyword plantumlSkinparamKeyword StackBorderColor StackFontColor StackFontName StackFontSize StackFontStyle
syntax keyword plantumlSkinparamKeyword StackStereotypeFontColor StackStereotypeFontName StackStereotypeFontSize syntax keyword plantumlSkinparamKeyword StackStereotypeFontColor StackStereotypeFontName StackStereotypeFontSize
syntax keyword plantumlSkinparamKeyword StackStereotypeFontStyle StateAttributeFontColor StateAttributeFontName syntax keyword plantumlSkinparamKeyword StackStereotypeFontStyle StateAttributeFontColor StateAttributeFontName
syntax keyword plantumlSkinparamKeyword StateAttributeFontSize StateAttributeFontStyle StateBackgroundColor syntax keyword plantumlSkinparamKeyword StateAttributeFontSize StateAttributeFontStyle StateBackgroundColor

View File

@@ -43,11 +43,6 @@ call s:EnableByDefault('g:python_highlight_builtin_funcs_kwarg')
if s:Enabled('g:python_highlight_all') if s:Enabled('g:python_highlight_all')
call s:EnableByDefault('g:python_highlight_builtins') call s:EnableByDefault('g:python_highlight_builtins')
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')
endif
call s:EnableByDefault('g:python_highlight_exceptions') call s:EnableByDefault('g:python_highlight_exceptions')
call s:EnableByDefault('g:python_highlight_string_formatting') call s:EnableByDefault('g:python_highlight_string_formatting')
call s:EnableByDefault('g:python_highlight_string_format') call s:EnableByDefault('g:python_highlight_string_format')
@@ -61,6 +56,12 @@ if s:Enabled('g:python_highlight_all')
call s:EnableByDefault('g:python_highlight_operators') call s:EnableByDefault('g:python_highlight_operators')
endif 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')
endif
" "
" Function calls " Function calls
" "

View File

@@ -38,7 +38,8 @@ syn keyword racketSyntax define define-values define-syntax define-syntaxes
syn keyword racketSyntax define-for-syntax define-require-syntax define-provide-syntax syn keyword racketSyntax define-for-syntax define-require-syntax define-provide-syntax
syn keyword racketSyntax define-syntax-rule syn keyword racketSyntax define-syntax-rule
syn keyword racketSyntax define-record-type syn keyword racketSyntax define-record-type
syn keyword racketSyntax begin begin0 begin-for-syntax syn keyword racketSyntax begin begin0
syn keyword racketSyntax begin-for-syntax
syn keyword racketSyntax when unless syn keyword racketSyntax when unless
syn keyword racketSyntax set! set!-values syn keyword racketSyntax set! set!-values
syn keyword racketSyntax for for/list for/vector for/hash for/hasheq for/hasheqv syn keyword racketSyntax for for/list for/vector for/hash for/hasheq for/hasheqv

View File

@@ -52,5 +52,4 @@ hi def link rNamespace Type
let b:current_syntax = "razor" let b:current_syntax = "razor"
endif endif

View File

@@ -1,7 +1,7 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'tmux') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'tmux') == -1
" Language: tmux(1) configuration file " Language: tmux(1) configuration file
" Version: 3.0 (git-48cbbb87) " Version: 3.1 (git-f986539e)
" URL: https://github.com/ericpruitt/tmux.vim/ " URL: https://github.com/ericpruitt/tmux.vim/
" Maintainer: Eric Pruitt <eric.pruitt@gmail.com> " Maintainer: Eric Pruitt <eric.pruitt@gmail.com>
" License: 2-Clause BSD (http://opensource.org/licenses/BSD-2-Clause) " License: 2-Clause BSD (http://opensource.org/licenses/BSD-2-Clause)
@@ -39,7 +39,7 @@ syn region tmuxString start=+'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end='$'
" TODO: Figure out how escaping works inside of #(...) and #{...} blocks. " TODO: Figure out how escaping works inside of #(...) and #{...} blocks.
syn region tmuxFormatString start=/#[#DFhHIPSTW]/ end=// contained keepend syn region tmuxFormatString start=/#[#DFhHIPSTW]/ end=// contained keepend
syn region tmuxFormatString start=/#{/ skip=/#{.\{-}}/ end=/}/ contained keepend syn region tmuxFormatString start=/#{/ skip=/#{.\{-}}/ end=/}/ keepend
syn region tmuxFormatString start=/#(/ skip=/#(.\{-})/ end=/)/ contained keepend syn region tmuxFormatString start=/#(/ skip=/#(.\{-})/ end=/)/ contained keepend
hi def link tmuxFormatString Identifier hi def link tmuxFormatString Identifier
@@ -94,25 +94,26 @@ syn keyword tmuxCommands
\ attach attach-session bind bind-key break-pane breakp capture-pane \ attach attach-session bind bind-key break-pane breakp capture-pane
\ capturep choose-buffer choose-client choose-tree clear-history clearhist \ capturep choose-buffer choose-client choose-tree clear-history clearhist
\ clock-mode command-prompt confirm confirm-before copy-mode detach \ clock-mode command-prompt confirm confirm-before copy-mode detach
\ detach-client display display-menu display-message display-panes displayp \ detach-client display display-menu display-message display-panes
\ find-window findw if if-shell join-pane joinp kill-pane kill-server \ display-popup displayp find-window findw if if-shell join-pane joinp
\ kill-session kill-window killp has-session has killw link-window linkw \ kill-pane kill-server kill-session kill-window killp has-session has killw
\ list-buffers list-clients list-commands list-keys list-panes list-sessions \ link-window linkw list-buffers list-clients list-commands list-keys
\ list-windows load-buffer loadb lock lock-client lock-server lock-session \ list-panes list-sessions list-windows load-buffer loadb lock lock-client
\ lockc last-pane lastp locks ls last-window last lsb lsc delete-buffer \ lock-server lock-session lockc last-pane lastp locks ls last-window last
\ deleteb lscm lsk lsp lsw menu move-pane move-window movep movew new \ lsb lsc delete-buffer deleteb lscm lsk lsp lsw menu move-pane move-window
\ new-session new-window neww next next-layout next-window nextl \ movep movew new new-session new-window neww next next-layout next-window
\ paste-buffer pasteb pipe-pane pipep prev previous-layout previous-window \ nextl paste-buffer pasteb pipe-pane pipep popup prev previous-layout
\ prevl refresh refresh-client rename rename-session rename-window renamew \ previous-window prevl refresh refresh-client rename rename-session
\ resize-pane resize-window resizep resizew respawn-pane respawn-window \ rename-window renamew resize-pane resize-window resizep resizew
\ respawnp respawnw rotate-window rotatew run run-shell save-buffer saveb \ respawn-pane respawn-window respawnp respawnw rotate-window rotatew run
\ select-layout select-pane select-window selectl selectp selectw send \ run-shell save-buffer saveb select-layout select-pane select-window
\ send-keys send-prefix set set-buffer set-environment set-hook set-option \ selectl selectp selectw send send-keys send-prefix set set-buffer
\ set-window-option setb setenv setw show show-buffer show-environment \ set-environment set-hook set-option set-window-option setb setenv setw
\ show-hooks show-messages show-options show-window-options showb showenv \ show show-buffer show-environment show-hooks show-messages show-options
\ showmsgs showw source source-file split-window splitw start start-server \ show-window-options showb showenv showmsgs showw source source-file
\ suspend-client suspendc swap-pane swap-window swapp swapw switch-client \ split-window splitw start start-server suspend-client suspendc swap-pane
\ switchc unbind unbind-key unlink-window unlinkw wait wait-for \ swap-window swapp swapw switch-client switchc unbind unbind-key
\ unlink-window unlinkw wait wait-for
let &cpo = s:original_cpo let &cpo = s:original_cpo
unlet! s:original_cpo s:bg s:i unlet! s:original_cpo s:bg s:i

View File

@@ -2,7 +2,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vifm') == -1
" vifm syntax file " vifm syntax file
" Maintainer: xaizek <xaizek@posteo.net> " Maintainer: xaizek <xaizek@posteo.net>
" Last Change: July 12, 2019 " Last Change: March 7, 2020
" Inspired By: Vim syntax file by Dr. Charles E. Campbell, Jr. " Inspired By: Vim syntax file by Dr. Charles E. Campbell, Jr.
if exists('b:current_syntax') if exists('b:current_syntax')
@@ -23,8 +23,8 @@ syntax keyword vifmCommand contained
\ mes[sages] mkdir m[ove] noh[lsearch] on[ly] popd pushd pu[t] pw[d] qa[ll] \ mes[sages] mkdir m[ove] noh[lsearch] on[ly] popd pushd pu[t] pw[d] qa[ll]
\ q[uit] redr[aw] reg[isters] regular rename restart restore rlink screen \ q[uit] redr[aw] reg[isters] regular rename restart restore rlink screen
\ sh[ell] siblnext siblprev sor[t] sp[lit] s[ubstitute] tabc[lose] tabm[ove] \ sh[ell] siblnext siblprev sor[t] sp[lit] s[ubstitute] tabc[lose] tabm[ove]
\ tabname tabnew tabn[ext] tabp[revious] touch tr trashes tree sync \ tabname tabnew tabn[ext] tabo[nly] tabp[revious] touch tr trashes tree
\ undol[ist] ve[rsion] vie[w] vifm vs[plit] winc[md] w[rite] wq wqa[ll] \ sync undol[ist] ve[rsion] vie[w] vifm vs[plit] winc[md] w[rite] wq wqa[ll]
\ xa[ll] x[it] y[ank] \ xa[ll] x[it] y[ank]
\ nextgroup=vifmArgs \ nextgroup=vifmArgs
syntax keyword vifmCommandCN contained syntax keyword vifmCommandCN contained

View File

@@ -29,21 +29,20 @@ syn match zigType "\v<[iu][1-9]\d*>"
syn match zigOperator display "\%(+%\?\|-%\?\|/\|*%\?\|=\|\^\|&\|?\||\|!\|>\|<\|%\|<<%\?\|>>\)=\?" syn match zigOperator display "\%(+%\?\|-%\?\|/\|*%\?\|=\|\^\|&\|?\||\|!\|>\|<\|%\|<<%\?\|>>\)=\?"
syn match zigArrowCharacter display "->" syn match zigArrowCharacter display "->"
syn match zigBuiltinFn "\v\@(addWithOverflow|ArgType|atomicLoad|atomicStore|bitCast|breakpoint)>" syn match zigBuiltinFn "\v\@(addWithOverflow|as|atomicLoad|atomicStore|bitCast|breakpoint)>"
syn match zigBuiltinFn "\v\@(alignCast|alignOf|cDefine|cImport|cInclude)>" syn match zigBuiltinFn "\v\@(alignCast|alignOf|cDefine|cImport|cInclude)>"
syn match zigBuiltinFn "\v\@(cUndef|canImplicitCast|clz|cmpxchgWeak|cmpxchgStrong|compileError)>" syn match zigBuiltinFn "\v\@(cUndef|canImplicitCast|clz|cmpxchgWeak|cmpxchgStrong|compileError)>"
syn match zigBuiltinFn "\v\@(compileLog|ctz|popCount|divExact|divFloor|divTrunc)>" syn match zigBuiltinFn "\v\@(compileLog|ctz|popCount|divExact|divFloor|divTrunc)>"
syn match zigBuiltinFn "\v\@(embedFile|export|tagName|TagType|errorName|call)>" syn match zigBuiltinFn "\v\@(embedFile|export|tagName|TagType|errorName|call)>"
syn match zigBuiltinFn "\v\@(errorReturnTrace|fence|fieldParentPtr|field|unionInit)>" syn match zigBuiltinFn "\v\@(errorReturnTrace|fence|fieldParentPtr|field|unionInit)>"
syn match zigBuiltinFn "\v\@(frameAddress|import|newStackCall|asyncCall|intToPtr|IntType)>" syn match zigBuiltinFn "\v\@(frameAddress|import|newStackCall|asyncCall|intToPtr)>"
syn match zigBuiltinFn "\v\@(memberCount|memberName|memberType|as)>"
syn match zigBuiltinFn "\v\@(memcpy|memset|mod|mulWithOverflow|splat)>" syn match zigBuiltinFn "\v\@(memcpy|memset|mod|mulWithOverflow|splat)>"
syn match zigBuiltinFn "\v\@(bitOffsetOf|byteOffsetOf|OpaqueType|panic|ptrCast)>" syn match zigBuiltinFn "\v\@(bitOffsetOf|byteOffsetOf|OpaqueType|panic|ptrCast)>"
syn match zigBuiltinFn "\v\@(ptrToInt|rem|returnAddress|setCold|Type|shuffle)>" syn match zigBuiltinFn "\v\@(ptrToInt|rem|returnAddress|setCold|Type|shuffle)>"
syn match zigBuiltinFn "\v\@(setRuntimeSafety|setEvalBranchQuota|setFloatMode)>" syn match zigBuiltinFn "\v\@(setRuntimeSafety|setEvalBranchQuota|setFloatMode)>"
syn match zigBuiltinFn "\v\@(setGlobalLinkage|setGlobalSection|shlExact|This|hasDecl|hasField)>" syn match zigBuiltinFn "\v\@(setGlobalLinkage|setGlobalSection|shlExact|This|hasDecl|hasField)>"
syn match zigBuiltinFn "\v\@(shlWithOverflow|shrExact|sizeOf|bitSizeOf|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\@(truncate|typeInfo|typeName|TypeOf|atomicRmw|bytesToSlice|sliceToBytes)>"
syn match zigBuiltinFn "\v\@(intToError|errorToInt|intToEnum|enumToInt|setAlignStack|frame|Frame|frameSize|bitReverse|Vector)>" syn match zigBuiltinFn "\v\@(intToError|errorToInt|intToEnum|enumToInt|setAlignStack|frame|Frame|frameSize|bitReverse|Vector)>"
syn match zigBuiltinFn "\v\@(sin|cos|exp|exp2|log|log2|log10|fabs|floor|ceil|trunc|round)>" syn match zigBuiltinFn "\v\@(sin|cos|exp|exp2|log|log2|log10|fabs|floor|ceil|trunc|round)>"