diff options
Diffstat (limited to '')
| -rw-r--r-- | after/syntax/c.vim | 4 | ||||
| -rw-r--r-- | after/syntax/cpp.vim | 69 | ||||
| -rw-r--r-- | after/syntax/yaml.vim | 2 | ||||
| -rw-r--r-- | autoload/cargo.vim | 89 | ||||
| -rw-r--r-- | autoload/crystal_lang.vim | 67 | ||||
| -rw-r--r-- | autoload/elixir/indent.vim | 17 | ||||
| -rw-r--r-- | autoload/vifm/globals.vim | 31 | ||||
| -rw-r--r-- | autoload/vital/crystal.vim | 332 | ||||
| -rw-r--r-- | autoload/xml/html5.vim | 4 | ||||
| -rw-r--r-- | ftdetect/polyglot.vim | 20 | ||||
| -rw-r--r-- | ftplugin/crystal.vim | 17 | ||||
| -rw-r--r-- | ftplugin/elixir.vim | 4 | ||||
| -rw-r--r-- | ftplugin/mail_vifm.vim | 10 | ||||
| -rw-r--r-- | ftplugin/toml.vim | 2 | ||||
| -rw-r--r-- | indent/caddyfile.vim | 5 | ||||
| -rw-r--r-- | indent/haskell.vim | 11 | ||||
| -rw-r--r-- | indent/javascript.vim | 30 | ||||
| -rw-r--r-- | syntax/caddyfile.vim | 2 | ||||
| -rw-r--r-- | syntax/carp.vim | 21 | ||||
| -rw-r--r-- | syntax/elixir.vim | 4 | ||||
| -rw-r--r-- | syntax/go.vim | 14 | ||||
| -rw-r--r-- | syntax/julia.vim | 4 | ||||
| -rw-r--r-- | syntax/swift.vim | 3 | ||||
| -rw-r--r-- | syntax/terraform.vim | 2 | ||||
| -rw-r--r-- | syntax/typescript.vim | 10 | 
25 files changed, 656 insertions, 118 deletions
| diff --git a/after/syntax/c.vim b/after/syntax/c.vim index de14c4db..304a351d 100644 --- a/after/syntax/c.vim +++ b/after/syntax/c.vim @@ -21,7 +21,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'c++11') == -1  "  Highlight function names.  " -----------------------------------------------------------------------------  if !exists('g:cpp_no_function_highlight') -    syn match    cCustomParen    "(" contains=cParen contains=cCppParen +    syn match    cCustomParen    transparent "(" contains=cParen contains=cCppParen      syn match    cCustomFunc     "\w\+\s*(\@=" contains=cCustomParen      hi def link cCustomFunc  Function  endif @@ -32,7 +32,7 @@ endif  if exists('g:cpp_member_variable_highlight') && g:cpp_member_variable_highlight      syn match   cCustomDot    "\." contained      syn match   cCustomPtr    "->" contained -    syn match   cCustomMemVar "\(\.\|->\)\w\+" contains=cCustomDot,cCustomPtr +    syn match   cCustomMemVar "\(\.\|->\)\h\w*" contains=cCustomDot,cCustomPtr      hi def link cCustomMemVar Function  endif diff --git a/after/syntax/cpp.vim b/after/syntax/cpp.vim index c1c23987..1e3f0780 100644 --- a/after/syntax/cpp.vim +++ b/after/syntax/cpp.vim @@ -4,7 +4,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'c++11') == -1  " Language: C++ Additions  " Maintainer: Jon Haggblad <jon@haeggblad.com>  " URL: http://www.haeggblad.com -" Last Change: 12 Oct 2016 +" Last Change: 1 Feb 2018  " Version: 0.6  " Changelog:  "   0.1 - initial version. @@ -37,7 +37,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'c++11') == -1  " Functions  if !exists('g:cpp_no_function_highlight') -    syn match   cCustomParen    "(" contains=cParen contains=cCppParen +    syn match   cCustomParen    transparent "(" contains=cParen contains=cCppParen      syn match   cCustomFunc     "\w\+\s*(\@="      hi def link cCustomFunc  Function  endif @@ -855,6 +855,37 @@ syntax keyword cppSTLconstant WEOF  syntax keyword cppSTLconstant WCHAR_MIN  syntax keyword cppSTLconstant WCHAR_MAX +" locale +syntax keyword cppSTLtype locale +syntax keyword cppSTLtype ctype_base +syntax keyword cppSTLtype codecvt_base +syntax keyword cppSTLtype messages_base +syntax keyword cppSTLtype time_base +syntax keyword cppSTLtype money_base +syntax keyword cppSTLtype ctype +syntax keyword cppSTLtype codecvt +syntax keyword cppSTLtype collate +syntax keyword cppSTLtype messages +syntax keyword cppSTLtype time_get +syntax keyword cppSTLtype time_put +syntax keyword cppSTLtype num_get +syntax keyword cppSTLtype num_put +syntax keyword cppSTLtype numpunct +syntax keyword cppSTLtype money_get +syntax keyword cppSTLtype money_put +syntax keyword cppSTLtype moneypunct +syntax keyword cppSTLtype ctype_byname +syntax keyword cppSTLtype codecvt_byname +syntax keyword cppSTLtype messages_byname +syntax keyword cppSTLtype collate_byname +syntax keyword cppSTLtype time_get_byname +syntax keyword cppSTLtype time_put_byname +syntax keyword cppSTLtype numpunct_byname +syntax keyword cppSTLtype moneypunct_byname +syntax keyword cppSTLfunction use_facet +syntax keyword cppSTLfunction has_facet +syntax keyword cppSTLfunction isspace isblank iscntrl isupper islower isalpha +syntax keyword cppSTLfunction isdigit ispunct isxdigit isalnum isprint isgraph  if !exists("cpp_no_cpp11")      syntax keyword cppSTLconstant nullptr @@ -1766,6 +1797,9 @@ if !exists("cpp_no_cpp17")      syntax keyword cppSTLfunction do_deallocate      syntax keyword cppSTLfunction do_is_equal +    " mutex +    syntax keyword cppSTLtype scoped_lock +      " new      syntax keyword cppSTLconstant hardware_destructive_interference_size      syntax keyword cppSTLconstant hardware_constructive_interference_size @@ -1804,7 +1838,7 @@ if !exists("cpp_no_cpp17")      syntax keyword cppSTLbool is_error_code_enum_v      syntax keyword cppSTLbool is_error_condition_enum_v -    " thread +    " shared_mutex      syntax keyword cppSTLtype shared_mutex      " tuple @@ -1879,6 +1913,16 @@ if !exists("cpp_no_cpp17")      syntax keyword cppSTLbool conjunction_v      syntax keyword cppSTLbool disjunction_v      syntax keyword cppSTLbool negation_v +    syntax keyword cppSTLbool has_unique_object_representations_v +    syntax keyword cppSTLbool is_swappable_v +    syntax keyword cppSTLbool is_swappable_with_v +    syntax keyword cppSTLbool is_nothrow_swappable_v +    syntax keyword cppSTLbool is_nothrow_swappable_with_v +    syntax keyword cppSTLbool is_invocable_v +    syntax keyword cppSTLbool is_invocable_r_v +    syntax keyword cppSTLbool is_nothrow_invocable_v +    syntax keyword cppSTLbool is_nothrow_invocable_r_v +    syntax keyword cppSTLbool is_aggregate_v      syntax keyword cppSTLconstant alignment_of_v      syntax keyword cppSTLconstant rank_v      syntax keyword cppSTLconstant extent_v @@ -1888,6 +1932,19 @@ if !exists("cpp_no_cpp17")      syntax keyword cppSTLtype conjunction      syntax keyword cppSTLtype disjunction      syntax keyword cppSTLtype negation +    syntax keyword cppSTLtype void_t +    syntax keyword cppSTLtype has_unique_object_representations +    syntax keyword cppSTLtype is_swappable +    syntax keyword cppSTLtype is_swappable_with +    syntax keyword cppSTLtype is_nothrow_swappable +    syntax keyword cppSTLtype is_nothrow_swappable_with +    syntax keyword cppSTLtype is_invocable +    syntax keyword cppSTLtype is_invocable_r +    syntax keyword cppSTLtype is_nothrow_invocable +    syntax keyword cppSTLtype is_nothrow_invocable_r +    syntax keyword cppSTLtype invoke_result +    syntax keyword cppSTLtype invoke_result_t +    syntax keyword cppSTLtype is_aggregate      " unordered_map, unordered_set, unordered_multimap, unordered_multiset      syntax keyword cppSTLtype node_type @@ -1921,6 +1978,12 @@ if !exists("cpp_no_cpp17")  endif " C++17 +if !exists("cpp_no_cpp20") +    " type_traits +    syntax keyword cppSTLtype remove_cvref remove_cvref_t +endif + +  if exists('g:cpp_concepts_highlight') && g:cpp_concepts_highlight      syntax keyword cppStatement concept      syntax keyword cppStorageClass requires diff --git a/after/syntax/yaml.vim b/after/syntax/yaml.vim index b68c4b80..0a4a4af1 100644 --- a/after/syntax/yaml.vim +++ b/after/syntax/yaml.vim @@ -26,7 +26,7 @@ syn match yamlBlock "[\[\]\{\}\|\>]"  syn region yamlComment	start="\#" end="$"  syn match yamlIndicator	"#YAML:\S\+" -syn region yamlString	start="\%(^\| \)\zs'" end="'\ze\%( \|$\)" skip="\\'" +syn region yamlString	start="\(^\|\s\|\[\|\,\|\-\)'" end="'" skip="\\'"  syn region yamlString	start='"' end='"' skip='\\"' contains=yamlEscape  syn match  yamlEscape	+\\[abfnrtv'"\\]+ contained  syn match  yamlEscape	"\\\o\o\=\o\=" contained diff --git a/autoload/cargo.vim b/autoload/cargo.vim new file mode 100644 index 00000000..e92da22b --- /dev/null +++ b/autoload/cargo.vim @@ -0,0 +1,89 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1 +   +function! cargo#cmd(args) +    silent! clear +    if !a:args +        execute "!" . "cargo ". a:args +    else +        echom "Missing arguments" +    endif +endfunction + +function! cargo#build(args) +    silent! clear +    if !a:args +        execute "!" . "cargo build " . a:args +    else +        execute "!" . "cargo build" +    endif +    silent! clear +    execute "!" . "cargo build" +endfunction + +function! cargo#clean(args) +    silent! clear +    if !a:args +        execute "!" . "cargo clean " . a:args +    else +        execute "!" . "cargo clean" +    endif +    silent! clear +    execute "!" . "cargo clean" +endfunction + +function! cargo#doc(args) +    silent! clear +    if !a:args +        execute "!" . "cargo doc " . a:args +    else +        execute "!" . "cargo doc" +    endif +endfunction + +function! cargo#new(args) +    silent! clear +    if !a:args +        execute "!cargo new " . a:args +        :cd `=a:args` +    else +        echom "Missing arguments" +    endif +endfunction + +function! cargo#init(args) +    silent! clear +    if !a:args +        execute "!" . "cargo init " . a:args +    else +        execute "!" . "cargo init" +    endif +endfunction + +function! cargo#run(args) +    silent! clear +    if !a:args +        execute "!" . "cargo run " . a:args +    else +        execute "!" . "cargo run" +    endif +endfunction + +function! cargo#test(args) +    silent! clear +    if !a:args +        execute "!" . "cargo test " . a:args +    else +        execute "!" . "cargo test" +    endif +endfunction + +function! cargo#bench(args) +    silent! clear +    if !a:args +        execute "!" . "cargo bench " . a:args +    else +        execute "!" . "cargo bench" +    endif +endfunction + +endif diff --git a/autoload/crystal_lang.vim b/autoload/crystal_lang.vim index 94cc9db3..aaf626cf 100644 --- a/autoload/crystal_lang.vim +++ b/autoload/crystal_lang.vim @@ -280,59 +280,34 @@ function! crystal_lang#format_string(code, ...) abort      return output  endfunction -function! s:get_saved_states() abort -    let result = {} -    let fname = bufname('%') -    let current_winnr = winnr() -    for i in range(1, winnr('$')) -        let bufnr = winbufnr(i) -        if bufnr == -1 -            continue -        endif -        if bufname(bufnr) ==# fname -            execute i 'wincmd w' -            let result[i] = { -                \     'pos': getpos('.'), -                \     'screen': winsaveview() -                \ } -        endif -    endfor -    execute current_winnr 'wincmd w' -    return result -endfunction - -function! crystal_lang#format(option_str) abort +" crystal_lang#format(option_str [, on_save]) +function! crystal_lang#format(option_str, ...) abort      if !executable(g:crystal_compiler_command)          " Finish command silently          return      endif -    let formatted = crystal_lang#format_string(join(getline(1, '$'), "\n"), a:option_str) -    let formatted = substitute(formatted, '\n$', '', '') +    let on_save = a:0 > 0 ? a:1 : 0 -    let sel_save = &l:selection -    let ve_save = &virtualedit -    let &l:selection = 'inclusive' -    let &virtualedit = '' -    let [save_g_reg, save_g_regtype] = [getreg('g'), getregtype('g')] -    let windows_save = s:get_saved_states() +    let before = join(getline(1, '$'), "\n") +    let formatted = crystal_lang#format_string(before, a:option_str) +    if !on_save +        let after = substitute(formatted, '\n$', '', '') +        if before ==# after +            return +        endif +    endif -    try -        call setreg('g', formatted, 'v') -        silent normal! gg0vG$"gp -    finally -        call setreg('g', save_g_reg, save_g_regtype) -        let &l:selection = sel_save -        let &virtualedit = ve_save -        let winnr = winnr() -        for winnr in keys(windows_save) -            let w = windows_save[winnr] -            execute winnr 'wincmd w' -            call setpos('.', w.pos) -            call winrestview(w.screen) -        endfor -        execute winnr 'wincmd w' -    endtry +    let view_save = winsaveview() +    let pos_save = getpos('.') +    let lines = split(formatted, '\n') +    silent! undojoin +    if line('$') > len(lines) +        execute len(lines) . ',$delete' '_' +    endif +    call setline(1, lines) +    call winrestview(view_save) +    call setpos('.', pos_save)  endfunction  let &cpo = s:save_cpo diff --git a/autoload/elixir/indent.vim b/autoload/elixir/indent.vim index 4a8b5435..aca5a2fd 100644 --- a/autoload/elixir/indent.vim +++ b/autoload/elixir/indent.vim @@ -18,11 +18,15 @@ function! elixir#indent#indent(lnum)    call s:debug("==> Indenting line " . lnum)    call s:debug("text = '" . text . "'") +  let [_, curs_lnum, curs_col, _] = getpos('.') +  call cursor(lnum, 0) +    let handlers = [          \'top_of_file',          \'starts_with_end',          \'starts_with_mid_or_end_block_keyword',          \'following_trailing_do', +        \'following_trailing_rocket',          \'following_trailing_binary_operator',          \'starts_with_pipe',          \'starts_with_close_bracket', @@ -37,11 +41,13 @@ function! elixir#indent#indent(lnum)      let indent = function('elixir#indent#handle_'.handler)(lnum, text, prev_nb_lnum, prev_nb_text)      if indent != -1        call s:debug('line '.lnum.': elixir#indent#handle_'.handler.' returned '.indent) +      call cursor(curs_lnum, curs_col)        return indent      endif    endfor    call s:debug("defaulting") +  call cursor(curs_lnum, curs_col)    return 0  endfunction @@ -166,7 +172,7 @@ function! s:get_base_indent(lnum, text)    elseif s:ends_with(a:text, data_structure_close, a:lnum)      let data_structure_open = '\%(\[\|{\|(\)'      let close_match_idx = match(a:text, data_structure_close . '\s*$') -    let _move = cursor(a:lnum, close_match_idx + 1) +    call cursor(a:lnum, close_match_idx + 1)      let [open_match_lnum, open_match_col] = searchpairpos(data_structure_open, '', data_structure_close, 'bnW')      let open_match_text = getline(open_match_lnum)      return s:get_base_indent(open_match_lnum, open_match_text) @@ -175,7 +181,6 @@ function! s:get_base_indent(lnum, text)    endif  endfunction -" TODO: @jbodah 2017-03-31: remove  function! elixir#indent#handle_following_trailing_do(lnum, text, prev_nb_lnum, prev_nb_text)    if s:ends_with(a:prev_nb_text, s:keyword('do'), a:prev_nb_lnum)      if s:starts_with(a:text, s:keyword('end'), a:lnum) @@ -188,6 +193,14 @@ function! elixir#indent#handle_following_trailing_do(lnum, text, prev_nb_lnum, p    endif  endfunction +function! elixir#indent#handle_following_trailing_rocket(lnum, text, prev_nb_lnum, prev_nb_text) +  if s:ends_with(a:prev_nb_text, '->', a:prev_nb_lnum) +    return indent(a:prev_nb_lnum) + s:sw() +  else +    return -1 +  endif +endfunction +  function! elixir#indent#handle_following_trailing_binary_operator(lnum, text, prev_nb_lnum, prev_nb_text)    let binary_operator = '\%(=\|<>\|>>>\|<=\|||\|+\|\~\~\~\|-\|&&\|<<<\|/\|\^\^\^\|\*\)' diff --git a/autoload/vifm/globals.vim b/autoload/vifm/globals.vim new file mode 100644 index 00000000..f6f62022 --- /dev/null +++ b/autoload/vifm/globals.vim @@ -0,0 +1,31 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vifm') == -1 +   +" common functions for vifm plugin related to globals +" Maintainer:  xaizek <xaizek@posteo.net> +" Last Change: January 02, 2018 + +" Initializes global variables to defaults unless they are already set +function! vifm#globals#Init() +    if !exists('g:vifm_exec') +        let g:vifm_exec = 'vifm' +    endif + +    if !exists('g:vifm_exec_args') +        let g:vifm_exec_args = '' +    endif + +    if !exists('g:vifm_term') +        if has('win32') +            if filereadable('C:\Windows\system32\cmd.exe') +                let g:vifm_term = 'C:\Windows\system32\cmd.exe /C' +            else +                " If don't find use the integrate shell it work too +                let g:vifm_term = '' +            endif +        else +            let g:vifm_term = 'xterm -e' +        endif +    endif +endfunction + +endif diff --git a/autoload/vital/crystal.vim b/autoload/vital/crystal.vim new file mode 100644 index 00000000..2dca145b --- /dev/null +++ b/autoload/vital/crystal.vim @@ -0,0 +1,332 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1 +   +let s:plugin_name = expand('<sfile>:t:r') +let s:vital_base_dir = expand('<sfile>:h') +let s:project_root = expand('<sfile>:h:h:h') +let s:is_vital_vim = s:plugin_name is# 'vital' + +let s:loaded = {} +let s:cache_sid = {} + +" function() wrapper +if v:version > 703 || v:version == 703 && has('patch1170') +  function! s:_function(fstr) abort +    return function(a:fstr) +  endfunction +else +  function! s:_SID() abort +    return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$') +  endfunction +  let s:_s = '<SNR>' . s:_SID() . '_' +  function! s:_function(fstr) abort +    return function(substitute(a:fstr, 's:', s:_s, 'g')) +  endfunction +endif + +function! vital#{s:plugin_name}#new() abort +  return s:new(s:plugin_name) +endfunction + +function! vital#{s:plugin_name}#import(...) abort +  if !exists('s:V') +    let s:V = s:new(s:plugin_name) +  endif +  return call(s:V.import, a:000, s:V) +endfunction + +let s:Vital = {} + +function! s:new(plugin_name) abort +  let base = deepcopy(s:Vital) +  let base._plugin_name = a:plugin_name +  return base +endfunction + +function! s:vital_files() abort +  if !exists('s:vital_files') +    let s:vital_files = map( +    \   s:is_vital_vim ? s:_global_vital_files() : s:_self_vital_files(), +    \   'fnamemodify(v:val, ":p:gs?[\\\\/]?/?")') +  endif +  return copy(s:vital_files) +endfunction +let s:Vital.vital_files = s:_function('s:vital_files') + +function! s:import(name, ...) abort dict +  let target = {} +  let functions = [] +  for a in a:000 +    if type(a) == type({}) +      let target = a +    elseif type(a) == type([]) +      let functions = a +    endif +    unlet a +  endfor +  let module = self._import(a:name) +  if empty(functions) +    call extend(target, module, 'keep') +  else +    for f in functions +      if has_key(module, f) && !has_key(target, f) +        let target[f] = module[f] +      endif +    endfor +  endif +  return target +endfunction +let s:Vital.import = s:_function('s:import') + +function! s:load(...) abort dict +  for arg in a:000 +    let [name; as] = type(arg) == type([]) ? arg[: 1] : [arg, arg] +    let target = split(join(as, ''), '\W\+') +    let dict = self +    let dict_type = type({}) +    while !empty(target) +      let ns = remove(target, 0) +      if !has_key(dict, ns) +        let dict[ns] = {} +      endif +      if type(dict[ns]) == dict_type +        let dict = dict[ns] +      else +        unlet dict +        break +      endif +    endwhile +    if exists('dict') +      call extend(dict, self._import(name)) +    endif +    unlet arg +  endfor +  return self +endfunction +let s:Vital.load = s:_function('s:load') + +function! s:unload() abort dict +  let s:loaded = {} +  let s:cache_sid = {} +  unlet! s:vital_files +endfunction +let s:Vital.unload = s:_function('s:unload') + +function! s:exists(name) abort dict +  if a:name !~# '\v^\u\w*%(\.\u\w*)*$' +    throw 'vital: Invalid module name: ' . a:name +  endif +  return s:_module_path(a:name) isnot# '' +endfunction +let s:Vital.exists = s:_function('s:exists') + +function! s:search(pattern) abort dict +  let paths = s:_extract_files(a:pattern, self.vital_files()) +  let modules = sort(map(paths, 's:_file2module(v:val)')) +  return s:_uniq(modules) +endfunction +let s:Vital.search = s:_function('s:search') + +function! s:plugin_name() abort dict +  return self._plugin_name +endfunction +let s:Vital.plugin_name = s:_function('s:plugin_name') + +function! s:_self_vital_files() abort +  let builtin = printf('%s/__%s__/', s:vital_base_dir, s:plugin_name) +  let installed = printf('%s/_%s/', s:vital_base_dir, s:plugin_name) +  let base = builtin . ',' . installed +  return split(globpath(base, '**/*.vim', 1), "\n") +endfunction + +function! s:_global_vital_files() abort +  let pattern = 'autoload/vital/__*__/**/*.vim' +  return split(globpath(&runtimepath, pattern, 1), "\n") +endfunction + +function! s:_extract_files(pattern, files) abort +  let tr = {'.': '/', '*': '[^/]*', '**': '.*'} +  let target = substitute(a:pattern, '\.\|\*\*\?', '\=tr[submatch(0)]', 'g') +  let regexp = printf('autoload/vital/[^/]\+/%s.vim$', target) +  return filter(a:files, 'v:val =~# regexp') +endfunction + +function! s:_file2module(file) abort +  let filename = fnamemodify(a:file, ':p:gs?[\\/]?/?') +  let tail = matchstr(filename, 'autoload/vital/_\w\+/\zs.*\ze\.vim$') +  return join(split(tail, '[\\/]\+'), '.') +endfunction + +" @param {string} name e.g. Data.List +function! s:_import(name) abort dict +  if has_key(s:loaded, a:name) +    return copy(s:loaded[a:name]) +  endif +  let module = self._get_module(a:name) +  if has_key(module, '_vital_created') +    call module._vital_created(module) +  endif +  let export_module = filter(copy(module), 'v:key =~# "^\\a"') +  " Cache module before calling module.vital_loaded() to avoid cyclic +  " dependences but remove the cache if module._vital_loaded() fails. +  " let s:loaded[a:name] = export_module +  let s:loaded[a:name] = export_module +  if has_key(module, '_vital_loaded') +    try +      call module._vital_loaded(vital#{s:plugin_name}#new()) +    catch +      unlet s:loaded[a:name] +      throw 'vital: fail to call ._vital_loaded(): ' . v:exception +    endtry +  endif +  return copy(s:loaded[a:name]) +endfunction +let s:Vital._import = s:_function('s:_import') + +" s:_get_module() returns module object wihch has all script local functions. +function! s:_get_module(name) abort dict +  let funcname = s:_import_func_name(self.plugin_name(), a:name) +  try +    return call(funcname, []) +  catch /^Vim\%((\a\+)\)\?:E117/ +    return s:_get_builtin_module(a:name) +  endtry +endfunction + +function! s:_get_builtin_module(name) abort + return s:sid2sfuncs(s:_module_sid(a:name)) +endfunction + +if s:is_vital_vim +  " For vital.vim, we can use s:_get_builtin_module directly +  let s:Vital._get_module = s:_function('s:_get_builtin_module') +else +  let s:Vital._get_module = s:_function('s:_get_module') +endif + +function! s:_import_func_name(plugin_name, module_name) abort +  return printf('vital#_%s#%s#import', a:plugin_name, s:_dot_to_sharp(a:module_name)) +endfunction + +function! s:_module_sid(name) abort +  let path = s:_module_path(a:name) +  if !filereadable(path) +    throw 'vital: module not found: ' . a:name +  endif +  let vital_dir = s:is_vital_vim ? '__\w\+__' : printf('_\{1,2}%s\%%(__\)\?', s:plugin_name) +  let base = join([vital_dir, ''], '[/\\]\+') +  let p = base . substitute('' . a:name, '\.', '[/\\\\]\\+', 'g') +  let sid = s:_sid(path, p) +  if !sid +    call s:_source(path) +    let sid = s:_sid(path, p) +    if !sid +      throw printf('vital: cannot get <SID> from path: %s', path) +    endif +  endif +  return sid +endfunction + +function! s:_module_path(name) abort +  return get(s:_extract_files(a:name, s:vital_files()), 0, '') +endfunction + +function! s:_module_sid_base_dir() abort +  return s:is_vital_vim ? &rtp : s:project_root +endfunction + +function! s:_dot_to_sharp(name) abort +  return substitute(a:name, '\.', '#', 'g') +endfunction + +function! s:_source(path) abort +  execute 'source' fnameescape(a:path) +endfunction + +" @vimlint(EVL102, 1, l:_) +" @vimlint(EVL102, 1, l:__) +function! s:_sid(path, filter_pattern) abort +  let unified_path = s:_unify_path(a:path) +  if has_key(s:cache_sid, unified_path) +    return s:cache_sid[unified_path] +  endif +  for line in filter(split(s:_execute(':scriptnames'), "\n"), 'v:val =~# a:filter_pattern') +    let [_, sid, path; __] = matchlist(line, '^\s*\(\d\+\):\s\+\(.\+\)\s*$') +    if s:_unify_path(path) is# unified_path +      let s:cache_sid[unified_path] = sid +      return s:cache_sid[unified_path] +    endif +  endfor +  return 0 +endfunction + +" We want to use a execute() builtin function instead of s:_execute(), +" however there is a bug in execute(). +" execute() returns empty string when it is called in +" completion function of user defined ex command. +" https://github.com/vim-jp/issues/issues/1129 +function! s:_execute(cmd) abort +  let [save_verbose, save_verbosefile] = [&verbose, &verbosefile] +  set verbose=0 verbosefile= +  redir => res +    silent! execute a:cmd +  redir END +  let [&verbose, &verbosefile] = [save_verbose, save_verbosefile] +  return res +endfunction + +if filereadable(expand('<sfile>:r') . '.VIM') " is case-insensitive or not +  let s:_unify_path_cache = {} +  " resolve() is slow, so we cache results. +  " Note: On windows, vim can't expand path names from 8.3 formats. +  " So if getting full path via <sfile> and $HOME was set as 8.3 format, +  " vital load duplicated scripts. Below's :~ avoid this issue. +  function! s:_unify_path(path) abort +    if has_key(s:_unify_path_cache, a:path) +      return s:_unify_path_cache[a:path] +    endif +    let value = tolower(fnamemodify(resolve(fnamemodify( +    \                   a:path, ':p')), ':~:gs?[\\/]?/?')) +    let s:_unify_path_cache[a:path] = value +    return value +  endfunction +else +  function! s:_unify_path(path) abort +    return resolve(fnamemodify(a:path, ':p:gs?[\\/]?/?')) +  endfunction +endif + +" copied and modified from Vim.ScriptLocal +let s:SNR = join(map(range(len("\<SNR>")), '"[\\x" . printf("%0x", char2nr("\<SNR>"[v:val])) . "]"'), '') +function! s:sid2sfuncs(sid) abort +  let fs = split(s:_execute(printf(':function /^%s%s_', s:SNR, a:sid)), "\n") +  let r = {} +  let pattern = printf('\m^function\s<SNR>%d_\zs\w\{-}\ze(', a:sid) +  for fname in map(fs, 'matchstr(v:val, pattern)') +    let r[fname] = function(s:_sfuncname(a:sid, fname)) +  endfor +  return r +endfunction + +"" Return funcname of script local functions with SID +function! s:_sfuncname(sid, funcname) abort +  return printf('<SNR>%s_%s', a:sid, a:funcname) +endfunction + +if exists('*uniq') +  function! s:_uniq(list) abort +    return uniq(a:list) +  endfunction +else +  function! s:_uniq(list) abort +    let i = len(a:list) - 1 +    while 0 < i +      if a:list[i] ==# a:list[i - 1] +        call remove(a:list, i) +      endif +      let i -= 1 +    endwhile +    return a:list +  endfunction +endif + +endif diff --git a/autoload/xml/html5.vim b/autoload/xml/html5.vim index 20353bd5..404dd567 100644 --- a/autoload/xml/html5.vim +++ b/autoload/xml/html5.vim @@ -62,7 +62,7 @@ let charset = [      \ 'windows-1256', 'windows-1257', 'windows-1258', 'TIS-620', ]  " }}} -let autofill_tokens = ['on', 'off', 'name', 'honorific-prefix', 'given-name', 'additional-name', 'family-name', 'honorific-suffix', 'nickname', 'username', 'new-password', 'current-password', 'organization-title', 'organization', 'street-address', 'address-line1', 'address-line2', 'address-line3', 'address-level4', 'address-level3', 'address-level2', 'address-level1', 'country', 'country-name', 'postal-code', 'cc-name', 'cc-given-name', 'cc-additional-name', 'cc-family-name', 'cc-number', 'cc-exp', 'cc-exp-month', 'cc-exp-year', 'cc-csc', 'cc-type', 'transaction-currency', 'transaction-amount', 'language', 'bday', 'bday-day', 'bday-month', 'bday-year', 'sex', 'url', 'photo'] +let autofill_tokens = ['on', 'off', 'name', 'honorific-prefix', 'given-name', 'additional-name', 'family-name', 'honorific-suffix', 'nickname', 'organization-title', 'username', 'new-password', 'current-password', 'organization', 'street-address', 'address-line1', 'address-line2', 'address-line3', 'address-level4', 'address-level3', 'address-level2', 'address-level1', 'country', 'country-name', 'postal-code', 'cc-name', 'cc-given-name', 'cc-additional-name', 'cc-family-name', 'cc-number', 'cc-exp', 'cc-exp-month', 'cc-exp-year', 'cc-csc', 'cc-type', 'transaction-currency', 'transaction-amount', 'language', 'bday', 'bday-day', 'bday-month', 'bday-year', 'sex', 'url', 'photo', 'tel', 'tel-country-code', 'tel-national', 'tel-area-code', 'tel-local', 'tel-local-prefix', 'tel-local-suffix', 'tel-extension', 'email', 'impp']  " Attributes_and_Settings: {{{  let core_attributes = {'accesskey': [], 'class': [], 'contenteditable': ['true', 'false', ''], 'contextmenu': [], 'dir': ['ltr', 'rtl'], 'draggable': ['true', 'false'], 'hidden': ['hidden', ''], 'id': [], 'is': [], 'lang': lang_tag, 'spellcheck': ['true', 'false', ''], 'style': [], 'tabindex': [], 'title': []} @@ -616,7 +616,7 @@ let g:xmldata_html5 = {  \ ],  \ 'link': [      \ [], -    \ extend(copy(global_attributes), {'href': [], 'rel': linkreltypes, 'hreflang': lang_tag, 'media': [], 'type': [], 'sizes': ['any'], 'referrerpolicy': ['no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'unsafe-url'], 'crossorigin': crossorigin, 'preload': ['preload', ''], 'prefetch': ['prefetch', '']}) +    \ extend(copy(global_attributes), {'href': [], 'rel': linkreltypes, 'hreflang': lang_tag, 'media': [], 'type': [], 'sizes': ['any'], 'referrerpolicy': ['no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'unsafe-url'], 'crossorigin': crossorigin, 'preload': ['preload', ''], 'prefetch': ['prefetch', ''], 'as': ['report', 'document', 'document', 'object', 'embed', 'audio', 'font', 'image', 'audioworklet', 'paintworklet', 'script', 'serviceworker', 'sharedworker', 'worker', 'style', 'track', 'video', 'image', 'manifest', 'xslt', 'fetch', '']})  \ ],  \ 'main': [      \ flow_elements + ['style'], diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index 4d34aa1a..6bf83344 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -280,6 +280,8 @@ augroup END  augroup filetypedetect  " go:fatih/vim-go:_BASIC +" vint: -ProhibitAutocmdWithNoGroup +  " We take care to preserve the user's fileencodings and fileformats,  " because those settings are global (not buffer local), yet we want  " to override them for loading Go files, which are defined to be UTF-8. @@ -300,18 +302,16 @@ function! s:gofiletype_post()    let &g:fileencodings = s:current_fileencodings  endfunction -augroup vim-go-filetype -  autocmd! -  au BufNewFile *.go setfiletype go | setlocal fileencoding=utf-8 fileformat=unix -  au BufRead *.go call s:gofiletype_pre("go") -  au BufReadPost *.go call s:gofiletype_post() +" Note: should not use augroup in ftdetect (see :help ftdetect) +au BufNewFile *.go setfiletype go | setlocal fileencoding=utf-8 fileformat=unix +au BufRead *.go call s:gofiletype_pre("go") +au BufReadPost *.go call s:gofiletype_post() -  au BufNewFile *.s setfiletype asm | setlocal fileencoding=utf-8 fileformat=unix -  au BufRead *.s call s:gofiletype_pre("asm") -  au BufReadPost *.s call s:gofiletype_post() +au BufNewFile *.s setfiletype asm | setlocal fileencoding=utf-8 fileformat=unix +au BufRead *.s call s:gofiletype_pre("asm") +au BufReadPost *.s call s:gofiletype_post() -  au BufRead,BufNewFile *.tmpl set filetype=gohtmltmpl -augroup end +au BufRead,BufNewFile *.tmpl set filetype=gohtmltmpl  " vim: sw=2 ts=2 et  augroup END diff --git a/ftplugin/crystal.vim b/ftplugin/crystal.vim index 57ceb97d..6ef907be 100644 --- a/ftplugin/crystal.vim +++ b/ftplugin/crystal.vim @@ -50,18 +50,17 @@ command! -buffer -nargs=* CrystalHierarchy echo crystal_lang#type_hierarchy(expa  command! -buffer -nargs=? CrystalSpecSwitch call crystal_lang#switch_spec_file(<f-args>)  command! -buffer -nargs=? CrystalSpecRunAll call crystal_lang#run_all_spec(<f-args>)  command! -buffer -nargs=? CrystalSpecRunCurrent call crystal_lang#run_current_spec(<f-args>) -command! -buffer -nargs=* -bar CrystalFormat call crystal_lang#format(<q-args>) +command! -buffer -nargs=* -bar CrystalFormat call crystal_lang#format(<q-args>, 0) -nnoremap <Plug>(crystal-jump-to-definition) :<C-u>CrystalDef<CR> -nnoremap <Plug>(crystal-show-context) :<C-u>CrystalContext<CR> -nnoremap <Plug>(crystal-spec-switch) :<C-u>CrystalSpecSwitch<CR> -nnoremap <Plug>(crystal-spec-run-all) :<C-u>CrystalSpecRunAll<CR> -nnoremap <Plug>(crystal-spec-run-current) :<C-u>CrystalSpecRunCurrent<CR> -nnoremap <Plug>(crystal-format) :<C-u>CrystalFormat<CR> +nnoremap <buffer><Plug>(crystal-jump-to-definition) :<C-u>CrystalDef<CR> +nnoremap <buffer><Plug>(crystal-show-context) :<C-u>CrystalContext<CR> +nnoremap <buffer><Plug>(crystal-spec-switch) :<C-u>CrystalSpecSwitch<CR> +nnoremap <buffer><Plug>(crystal-spec-run-all) :<C-u>CrystalSpecRunAll<CR> +nnoremap <buffer><Plug>(crystal-spec-run-current) :<C-u>CrystalSpecRunCurrent<CR> +nnoremap <buffer><Plug>(crystal-format) :<C-u>CrystalFormat<CR>  augroup plugin-ft-crystal -    autocmd! -    autocmd BufWritePre <buffer> if g:crystal_auto_format | CrystalFormat | endif +    autocmd BufWritePre <buffer> if g:crystal_auto_format | call crystal_lang#format('', 1) | endif  augroup END  if get(g:, 'crystal_define_mappings', 1) diff --git a/ftplugin/elixir.vim b/ftplugin/elixir.vim index 7219cb95..c02bff35 100644 --- a/ftplugin/elixir.vim +++ b/ftplugin/elixir.vim @@ -32,6 +32,10 @@ let &l:path =  setlocal includeexpr=elixir#util#get_filename(v:fname)  setlocal suffixesadd=.ex,.exs,.eex,.erl,.yrl,.hrl +if empty(&formatprg) +    setlocal formatprg=mix\ format\ - +endif +  let &l:define = 'def\(macro|guard|delegate\)p'  silent! setlocal formatoptions-=t formatoptions+=croqlj diff --git a/ftplugin/mail_vifm.vim b/ftplugin/mail_vifm.vim index 9d6ffb68..9348b19a 100644 --- a/ftplugin/mail_vifm.vim +++ b/ftplugin/mail_vifm.vim @@ -2,11 +2,13 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vifm') == -1  " Mail file type extension to pick files for attachments via vifm  " Maintainer:  xaizek <xaizek@posteo.net> -" Last Change: January 01, 2018 +" Last Change: January 02, 2018  " Insert attachment picked via vifm after 'Subject' header -function! s:AddMailAttacments() -	" TODO: reduce duplication between this file and plugins/vifm.vim +function! s:AddMailAttachments() +	call vifm#globals#Init() + +	" XXX: similar code is in plugins/vifm.vim, but it's different in details  	let l:listf = tempname()  	if !has('nvim') @@ -59,7 +61,7 @@ function! s:HandleRunResults(exitcode, listf)  	call delete(a:listf)  endfunction -nnoremap <buffer> <silent> <localleader>a :call <sid>AddMailAttacments()<cr> +nnoremap <buffer> <silent> <localleader>a :call <sid>AddMailAttachments()<cr>  " vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : diff --git a/ftplugin/toml.vim b/ftplugin/toml.vim index 1d11c9d8..baa19ba1 100644 --- a/ftplugin/toml.vim +++ b/ftplugin/toml.vim @@ -31,8 +31,6 @@ else  endif  unlet s:delims -let b:undo_ftplugin = "" -  let &cpo = s:save_cpo  unlet s:save_cpo diff --git a/indent/caddyfile.vim b/indent/caddyfile.vim index 2f38c0db..3a4ff73d 100644 --- a/indent/caddyfile.vim +++ b/indent/caddyfile.vim @@ -9,14 +9,13 @@ setlocal nolisp  setlocal autoindent  setlocal indentexpr=GetCaddyfileIndent(v:lnum)  setlocal indentkeys+=<:>,0=},0=) -" setlocal cindent  if exists('*shiftwidth') -	func s:sw() +	function! s:sw()  		return shiftwidth()  	endfunc  else -	func s:sw() +	function! s:sw()  		return &sw  	endfunc  endif diff --git a/indent/haskell.vim b/indent/haskell.vim index 5c33e550..5a337144 100644 --- a/indent/haskell.vim +++ b/indent/haskell.vim @@ -296,9 +296,20 @@ function! GetHaskellIndent()    "" where foo    "" >>>>>>bar +  "" +  "" where foo :: Int +  "" >>>>>>>>>>-> Int +  "" +  "" where foo x +  "" >>>>>>>>|    if l:prevline =~ '\C\<where\>\s\+\S\+.*$'      if  l:line =~ '^\s*[=-]>\s' && l:prevline =~ ' :: '        return match(l:prevline, ':: ') +    elseif  l:line =~ '^\s*|\s' +      let l:s = match(l:prevline, '\C\<where\>') +      if s:isSYN('haskellWhere', v:lnum - 1, l:s + 1) +        return l:s + g:haskell_indent_where + g:haskell_indent_guard +      endif      else        let l:s = match(l:prevline, '\C\<where\>')        if s:isSYN('haskellWhere', v:lnum - 1, l:s + 1) diff --git a/indent/javascript.vim b/indent/javascript.vim index 93d348eb..a31268d2 100644 --- a/indent/javascript.vim +++ b/indent/javascript.vim @@ -250,7 +250,7 @@ function s:Balanced(lnum,line)    let pos = match(a:line, '[][(){}]')    while pos != -1      if s:SynAt(a:lnum,pos + 1) !~? b:syng_strcom -      let l:open += match(' ' . a:line[pos],'[[({]') +      let l:open += matchend(a:line[pos],'[[({]')        if l:open < 0          return        endif @@ -271,10 +271,7 @@ function s:OneScope()      return s:Pure('s:PreviousToken') != '.'    elseif strpart(getline('.'),col('.')-2,2) == '=>'      call cursor(0,col('.')-1) -    if s:PreviousToken() == ')' -      return s:GetPair('(', ')', 'bW', s:skip_expr) -    endif -    return 1 +    return s:PreviousToken() != ')' || s:GetPair('(', ')', 'bW', s:skip_expr)    endif  endfunction @@ -299,9 +296,9 @@ endfunction  " encloses the entire context, 'cont' if whether a:firstline is a continued  " expression, which could have started in a braceless context  function s:IsContOne(cont) -  let [l:num, b_l] = [b:js_cache[1] + !b:js_cache[1], 0] -  let pind = b:js_cache[1] ? indent(b:js_cache[1]) + s:sw() : 0 -  let ind = indent('.') + !a:cont +  let [l:num, pind] = b:js_cache[1] ? +        \ [b:js_cache[1], indent(b:js_cache[1]) + s:sw()] : [1,0] +  let [ind, b_l] = [indent('.') + !a:cont, 0]    while line('.') > l:num && ind > pind || line('.') == l:num      if indent('.') < ind && s:OneScope()        let b_l += 1 @@ -319,8 +316,8 @@ function s:IsContOne(cont)  endfunction  function s:IsSwitch() -  call call('cursor',b:js_cache[1:]) -  return search('\m\C\%#.\_s*\%(\%(\/\/.*\_$\|\/\*\_.\{-}\*\/\)\@>\_s*\)*\%(case\|default\)\>','nWc'.s:z) +  return search('\m\C\%'.join(b:js_cache[1:],'l\%'). +        \ 'c{\_s*\%(\%(\/\/.*\_$\|\/\*\_.\{-}\*\/\)\@>\_s*\)*\%(case\|default\)\>','nW'.s:z)  endfunction  " https://github.com/sweet-js/sweet.js/wiki/design#give-lookbehind-to-the-reader @@ -376,7 +373,7 @@ function GetJavascriptIndent()    if s:PreviousToken() is ''      return    endif -  let [l:lnum, pline] = [line('.'), getline('.')[:col('.')-1]] +  let [l:lnum, lcol, pline] = getpos('.')[1:2] + [getline('.')[:col('.')-1]]    let l:line = substitute(l:line,'^\s*','','')    let l:line_raw = l:line @@ -429,7 +426,7 @@ function GetJavascriptIndent()        endif      endif      if idx == -1 && pline[-1:] !~ '[{;]' -      call cursor(l:lnum, len(pline)) +      call cursor(l:lnum, lcol)        let sol = matchstr(l:line,s:opfirst)        if sol is '' || sol == '/' && s:SynAt(v:lnum,              \ 1 + len(getline(v:lnum)) - len(l:line)) =~? 'regex' @@ -445,10 +442,11 @@ function GetJavascriptIndent()        else          let is_op = s:sw()        endif -      call cursor(l:lnum, len(pline)) +      call cursor(l:lnum, lcol)        let b_l = s:Nat(s:IsContOne(is_op) - (!is_op && l:line =~ '^{')) * s:sw()      endif -  elseif idx.s:LookingAt().&cino =~ '^-1(.*(' && (search('\m\S','nbW',num) || s:ParseCino('U')) +  elseif idx == -1 && s:LookingAt() == '(' && &cino =~ '(' && +        \ (search('\m\S','nbW',num) || s:ParseCino('U'))      let pval = s:ParseCino('(')      if !pval        let [Wval, vcol] = [s:ParseCino('W'), virtcol('.')] @@ -473,6 +471,10 @@ function GetJavascriptIndent()    elseif num      return s:Nat(num_ind + get(l:,'case_offset',s:sw()) + l:switch_offset + b_l + is_op)    endif +  let nest = get(get(b:,'hi_indent',{}),'blocklnr') +  if nest +    return indent(nest) + s:sw() + b_l + is_op +  endif    return b_l + is_op  endfunction diff --git a/syntax/caddyfile.vim b/syntax/caddyfile.vim index 17d95658..4c22b017 100644 --- a/syntax/caddyfile.vim +++ b/syntax/caddyfile.vim @@ -7,7 +7,7 @@ if exists("b:current_syntax")  	finish  endif -syn match caddyDirective "^\s*\([a-z]\+\)" nextgroup=caddyDirectiveArgs skipwhite +syn match caddyDirective "^\s*\([a-zA-Z0-9_]\+\)" nextgroup=caddyDirectiveArgs skipwhite  syn region caddyDirectiveArgs start="" end="\({\|#\|$\)"me=s-1 oneline contained contains=caddyPlaceholder,caddyString nextgroup=caddyDirectiveBlock skipwhite  syn region caddyDirectiveBlock start="{" skip="\\}" end="}" contained contains=caddySubdirective,caddyComment diff --git a/syntax/carp.vim b/syntax/carp.vim index 13d96cd9..176c4d55 100644 --- a/syntax/carp.vim +++ b/syntax/carp.vim @@ -19,18 +19,33 @@ else  endif  syn keyword carpSyntax def defn let do if while ref address set! the -syn keyword carpSyntax defmacro defdynamic quote car cdr cons list array +syn keyword carpSyntax defmacro defdynamic quote cons list array  syn keyword carpSyntax expand deftype register system-include register-type  syn keyword carpSyntax defmodule copy use module defalias definterface eval  syn keyword carpSyntax expand instantiate type info help quit env build run  syn keyword carpSyntax cat use project-set! local-include system-include -syn keyword carpSyntax add-cflag add-lib project load reload +syn keyword carpSyntax add-cflag add-lib project load reload let-do ignore +syn keyword carpSyntax fmt mac-only linux-only windows-only use-all when +syn keyword carpSyntax unless defn-do comment forever-do case and* or* +syn keyword carpSyntax str* println* +syn match carpSyntax "\vc(a|d){1,4}r" -syn keyword carpFunc Int Float Double Bool String Char Array Fn Ref Long +syn keyword carpFunc Int Float Double Bool String Char Array Fn Ref Long λ  syn keyword carpFunc not or and + - * / = /= >= <= > < inc dec  syn keyword carpFunc println print get-line from-string mod seed random  syn keyword carpFunc random-between str mask delete append count duplicate  syn keyword carpFunc cstr chars from-chars to-int from-int sin cos sqrt acos +syn keyword carpFunc atan2 exit time srand for cond floor abs sort-with +syn keyword carpFunc subarray prefix-array suffix-array reverse sum min max +syn keyword carpFunc first last reduce format zero read-file bit-shift-left +syn keyword carpFunc bit-shift-right bit-and bit-or bit-xor bit-not safe-add +syn keyword carpFunc safe-sub safe-mul even? odd? cmp allocate repeat-indexed +syn keyword carpFunc sanitize-addresses memory-balance reset-memory-balance! +syn keyword carpFunc log-memory-balance! memory-logged assert-balanced trace +syn keyword carpFunc pi e swaop! update! char-at tail head split-by words lines +syn keyword carpFunc pad-left pad-right count-char empty? random-sized substring +syn keyword carpFunc prefix-string suffix-string starts-with? ends-with? +syn keyword carpFunc string-join free sleep-seconds sleep-micros  syn keyword carpFunc atan2 exit time srand for cond floor abs neg to-float  syn keyword carpFunc from-float tan asin atan cosh sinh tanh exp frexp ldexp  syn keyword carpFunc log log10 modf pow ceil clamp approx refstr foreach diff --git a/syntax/elixir.vim b/syntax/elixir.vim index fa452609..f8faf487 100644 --- a/syntax/elixir.vim +++ b/syntax/elixir.vim @@ -143,6 +143,8 @@ syn region elixirDocString matchgroup=elixirSigilDelimiter  start=+\%(@\w*doc\s\  " Defines  syn match elixirDefine              '\<def\>\(:\)\@!'             nextgroup=elixirFunctionDeclaration    skipwhite skipnl  syn match elixirPrivateDefine       '\<defp\>\(:\)\@!'            nextgroup=elixirFunctionDeclaration    skipwhite skipnl +syn match elixirGuard               '\<defguard\>\(:\)\@!'        nextgroup=elixirFunctionDeclaration    skipwhite skipnl +syn match elixirPrivateGuard        '\<defguardp\>\(:\)\@!'       nextgroup=elixirFunctionDeclaration    skipwhite skipnl  syn match elixirModuleDefine        '\<defmodule\>\(:\)\@!'       nextgroup=elixirModuleDeclaration      skipwhite skipnl  syn match elixirProtocolDefine      '\<defprotocol\>\(:\)\@!'     nextgroup=elixirProtocolDeclaration    skipwhite skipnl  syn match elixirImplDefine          '\<defimpl\>\(:\)\@!'         nextgroup=elixirImplDeclaration        skipwhite skipnl @@ -177,6 +179,8 @@ syn match  elixirExUnitAssert "\(^\s*\)\@<=\<\(catch_exit\|catch_throw\|flunk\|r  hi def link elixirBlockDefinition        Keyword  hi def link elixirDefine                 Define  hi def link elixirPrivateDefine          Define +hi def link elixirGuard                  Define +hi def link elixirPrivateGuard           Define  hi def link elixirModuleDefine           Define  hi def link elixirProtocolDefine         Define  hi def link elixirImplDefine             Define diff --git a/syntax/go.vim b/syntax/go.vim index 4d5819ec..0705c3ee 100644 --- a/syntax/go.vim +++ b/syntax/go.vim @@ -44,8 +44,8 @@ if !exists("g:go_highlight_function_arguments")    let g:go_highlight_function_arguments = 0  endif -if !exists("g:go_highlight_methods") -  let g:go_highlight_methods = 0 +if !exists("g:go_highlight_function_calls") +  let g:go_highlight_function_calls = 0  endif  if !exists("g:go_highlight_fields") @@ -362,7 +362,6 @@ hi def link     goOperator          Operator  " Functions;  if g:go_highlight_functions isnot 0 || g:go_highlight_function_arguments isnot 0 -  syn match goFunctionCall      /\w\+\ze(/ contains=goBuiltins,goDeclaration    syn match goDeclaration       /\<func\>/ nextgroup=goReceiver,goFunction,goSimpleArguments skipwhite skipnl    syn match goReceiverVar       /\w\+\ze\s\+\(\w\|\*\)/ nextgroup=goPointerOperator,goReceiverType skipwhite skipnl contained    syn match goPointerOperator   /\*/ nextgroup=goReceiverType contained skipwhite skipnl @@ -381,13 +380,12 @@ else    syn keyword goDeclaration func  endif  hi def link     goFunction          Function -hi def link     goFunctionCall      Type -" Methods; -if g:go_highlight_methods != 0 -  syn match goMethodCall            /\.\w\+\ze(/hs=s+1 +" Function calls; +if g:go_highlight_function_calls != 0 +  syn match goFunctionCall      /\w\+\ze(/ contains=goBuiltins,goDeclaration  endif -hi def link     goMethodCall        Type +hi def link     goFunctionCall      Type  " Fields;  if g:go_highlight_fields != 0 diff --git a/syntax/julia.vim b/syntax/julia.vim index 3af7ecb2..e7bf145c 100644 --- a/syntax/julia.vim +++ b/syntax/julia.vim @@ -228,7 +228,7 @@ syntax match   juliaBaseTypeSet		display "\<Set\>"  syntax match   juliaBaseTypeSet0506	display "\<IntSet\>"  syntax match   juliaBaseTypeSet0607	display "\<AbstractSet\>"  syntax match   juliaBaseTypeSet07	display "\<\%(\%(Bit\|Key\)Set\|AbstractDict\)\>" -syntax match   juliaBaseTypeIO		display "\<\%(IO\%(Stream\|Buffer\|Context\)\?\|RawFD\|StatStruct\|DevNull\|FileMonitor\|PollingFileWatcher\|Timer\|Base64\%(Decode\|Encode\)Pipe\|\%(UDP\|TCP\)Socket\|\%(Abstract\)\?Channel\|BufferStream\|ReentrantLock\)\>" +syntax match   juliaBaseTypeIO		display "\<\%(IO\%(Stream\|Buffer\|Context\)\?\|RawFD\|StatStruct\|FileMonitor\|PollingFileWatcher\|Timer\|Base64\%(Decode\|Encode\)Pipe\|\%(UDP\|TCP\)Socket\|\%(Abstract\)\?Channel\|BufferStream\|ReentrantLock\)\>"  syntax match   juliaBaseTypeIO07	display "\<GenericIOBuffer\>"  syntax match   juliaBaseTypeProcess	display "\<\%(ProcessGroup\|Pipe\|Cmd\)\>"  syntax match   juliaBaseTypeProcess0607	display "\<PipeBuffer\>" @@ -260,7 +260,7 @@ syntax match   juliaPossibleEuler	"ℯ" contains=juliaEuler  exec 'syntax match   juliaEuler	        contained "\%(\%(^\|[' . s:nonidS_chars . ']\|' . s:operators . '\)\%([.0-9eEf_]*\d\)\?\)\@'.s:d(80).'<=ℯ\ze\%($\|[' . s:nonidS_chars . ']\|' . s:operators . '\)"'  syntax match   juliaConstBool		display "\<\%(true\|false\)\>"  syntax match   juliaConstEnv		display "\<\%(ARGS\|ENV\|CPU_CORES\|OS_NAME\|ENDIAN_BOM\|LOAD_PATH\|VERSION\|JULIA_HOME\|PROGRAM_FILE\)\>" -syntax match   juliaConstIO		display "\<\%(STD\%(OUT\|IN\|ERR\)\)\>" +syntax match   juliaConstIO		display "\<\%(STD\%(OUT\|IN\|ERR\)\|DevNull\)\>"  syntax match   juliaConstC		display "\<\%(WORD_SIZE\|C_NULL\)\>"  syntax match   juliaConstGeneric	display "\<\%(nothing\|Main\)\>"  syntax match   juliaConstGeneric07	display "\<missing\>" diff --git a/syntax/swift.vim b/syntax/swift.vim index be8c7b47..ef592ce4 100644 --- a/syntax/swift.vim +++ b/syntax/swift.vim @@ -3,7 +3,6 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'swift') == -1  " File: swift.vim  " Author: Keith Smiley  " Description: Runtime files for Swift -" Last Modified: June 15, 2014  if exists("b:current_syntax")    finish @@ -242,6 +241,8 @@ syntax keyword swiftPreprocessor        \ #else        \ #endif        \ #selector +      \ #warning +      \ #error  " Comment patterns diff --git a/syntax/terraform.vim b/syntax/terraform.vim index ba463913..5e25207f 100644 --- a/syntax/terraform.vim +++ b/syntax/terraform.vim @@ -9,7 +9,7 @@ endif  syn case match -syn keyword terraSection connection output provider variable data terraform +syn keyword terraSection connection output provider variable data terraform locals  syn keyword terraValueBool true false on off yes no  """ data diff --git a/syntax/typescript.vim b/syntax/typescript.vim index 9e5d08be..144b72d4 100644 --- a/syntax/typescript.vim +++ b/syntax/typescript.vim @@ -47,8 +47,8 @@ if !exists("typescript_ignore_typescriptdoc")  "unlet b:current_syntax    syntax region typescriptDocComment start="/\*\*\s*$" end="\*/" contains=typescriptDocTags,typescriptCommentTodo,typescriptCvsTag,@typescriptHtml,@Spell fold extend -  syntax match typescriptDocTags contained "@\(param\|argument\|requires\|exception\|throws\|type\|class\|extends\|see\|link\|member\|module\|method\|title\|namespace\|optional\|default\|base\|file\)\>" nextgroup=typescriptDocParam,typescriptDocSeeTag skipwhite -  syntax match typescriptDocTags contained "@\(beta\|deprecated\|description\|fileoverview\|author\|license\|version\|returns\=\|constructor\|private\|protected\|final\|ignore\|addon\|exec\)\>" +  syntax match typescriptDocTags contained "@\(param\|argument\|requires\|exception\|throws\|type\|class\|extends\|see\|link\|member\|module\|method\|title\|namespace\|optional\|default\|base\|file\|returns\=\)\>" nextgroup=typescriptDocParam,typescriptDocSeeTag skipwhite +  syntax match typescriptDocTags contained "@\(beta\|deprecated\|description\|fileoverview\|author\|license\|version\|constructor\|private\|protected\|final\|ignore\|addon\|exec\)\>"    syntax match typescriptDocParam contained "\%(#\|\w\|\.\|:\|\/\)\+"    syntax region typescriptDocSeeTag contained matchgroup=typescriptDocSeeTag start="{" end="}" contains=typescriptDocTags @@ -67,14 +67,16 @@ syn region typescriptInterpolation matchgroup=typescriptInterpolationDelimiter        \ start=/${/ end=/}/ contained        \ contains=@typescriptExpression -syn match typescriptNumber "-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>" +syn match typescriptNumber "-\=\<0[xX][0-9a-fA-F][0-9a-fA-F_]*\>" display +syn match typescriptNumber "-\=\<0[bB][01][01_]*\>" display +syn match typescriptNumber "-\=\<0[oO]\o[0-7_]*\>" display  syn region typescriptRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gi]\{0,2\}\s*$+ end=+/[gi]\{0,2\}\s*[;.,)\]}]+me=e-1 contains=@htmlPreproc oneline  " syntax match typescriptSpecial "\\\d\d\d\|\\x\x\{2\}\|\\u\x\{4\}\|\\."  " syntax region typescriptStringD start=+"+ skip=+\\\\\|\\$"+ end=+"+ contains=typescriptSpecial,@htmlPreproc  " syntax region typescriptStringS start=+'+ skip=+\\\\\|\\$'+ end=+'+ contains=typescriptSpecial,@htmlPreproc  " syntax region typescriptRegexpString start=+/\(\*\|/\)\@!+ skip=+\\\\\|\\/+ end=+/[gim]\{,3}+ contains=typescriptSpecial,@htmlPreproc oneline  " syntax match typescriptNumber /\<-\=\d\+L\=\>\|\<0[xX]\x\+\>/ -syntax match typescriptFloat /\<-\=\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%([eE][+-]\=\d\+\)\=\>/ +syntax match typescriptFloat /\<-\=\%(\d[0-9_]*\.\d[0-9_]*\|\d[0-9_]*\.\|\.\d[0-9]*\)\%([eE][+-]\=\d[0-9_]*\)\=\>/  " syntax match typescriptLabel /\(?\s*\)\@<!\<\w\+\(\s*:\)\@=/  syn match typescriptDecorators /@\([_$a-zA-Z][_$a-zA-Z0-9]*\.\)*[_$a-zA-Z][_$a-zA-Z0-9]*\>/ | 
