Compare commits

..

5 Commits

Author SHA1 Message Date
Adam Stankiewicz
96c5c20e41 Include indentation setting for markdown, fixes #270 2018-02-06 11:16:48 +08:00
Adam Stankiewicz
18efda3933 Update 2018-02-06 11:15:01 +08:00
Adam Stankiewicz
bfc6ed9fba Fix filetype detection by extension, #262 2018-01-10 23:54:03 +01:00
Adam Stankiewicz
58709c49f6 Update 2018-01-10 23:50:02 +01:00
Adam Stankiewicz
3d5b784fa5 Add example how to install this plugin, closes #260 2018-01-07 23:08:39 +01:00
41 changed files with 1294 additions and 980 deletions

View File

@@ -21,6 +21,12 @@ A collection of language packs for Vim.
1. Install [Pathogen](https://github.com/tpope/vim-pathogen), [Vundle](https://github.com/VundleVim/Vundle.vim), [NeoBundle](https://github.com/Shougo/neobundle.vim), or [Plug](https://github.com/junegunn/vim-plug) package manager for Vim. 1. Install [Pathogen](https://github.com/tpope/vim-pathogen), [Vundle](https://github.com/VundleVim/Vundle.vim), [NeoBundle](https://github.com/Shougo/neobundle.vim), or [Plug](https://github.com/junegunn/vim-plug) package manager for Vim.
2. Use this repository as submodule or package. 2. Use this repository as submodule or package.
For example when using [Plug](https://github.com/junegunn/vim-plug):
```
Plug 'sheerun/vim-polyglot'
```
Optionally download one of the [releases](https://github.com/sheerun/vim-polyglot/releases) and unpack it directly under `~/.vim` directory. Optionally download one of the [releases](https://github.com/sheerun/vim-polyglot/releases) and unpack it directly under `~/.vim` directory.
You can also use Vim 8 built-in package manager: You can also use Vim 8 built-in package manager:
@@ -91,7 +97,7 @@ If you need full functionality of any plugin, please use it directly with your p
- [livescript](https://github.com/gkz/vim-ls) (syntax, indent, compiler, ftplugin) - [livescript](https://github.com/gkz/vim-ls) (syntax, indent, compiler, ftplugin)
- [lua](https://github.com/tbastos/vim-lua) (syntax, indent) - [lua](https://github.com/tbastos/vim-lua) (syntax, indent)
- [mako](https://github.com/sophacles/vim-bundle-mako) (syntax, indent, ftplugin) - [mako](https://github.com/sophacles/vim-bundle-mako) (syntax, indent, ftplugin)
- [markdown](https://github.com/plasticboy/vim-markdown) (syntax) - [markdown](https://github.com/plasticboy/vim-markdown) (syntax, indent)
- [mathematica](https://github.com/rsmenon/vim-mathematica) (syntax, ftplugin) - [mathematica](https://github.com/rsmenon/vim-mathematica) (syntax, ftplugin)
- [nginx](https://github.com/chr4/nginx.vim) (syntax, indent, ftplugin) - [nginx](https://github.com/chr4/nginx.vim) (syntax, indent, ftplugin)
- [nim](https://github.com/zah/nim.vim) (syntax, compiler, indent) - [nim](https://github.com/zah/nim.vim) (syntax, compiler, indent)

View File

@@ -21,7 +21,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'c++11') == -1
" Highlight function names. " Highlight function names.
" ----------------------------------------------------------------------------- " -----------------------------------------------------------------------------
if !exists('g:cpp_no_function_highlight') 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 syn match cCustomFunc "\w\+\s*(\@=" contains=cCustomParen
hi def link cCustomFunc Function hi def link cCustomFunc Function
endif endif
@@ -32,7 +32,7 @@ endif
if exists('g:cpp_member_variable_highlight') && g:cpp_member_variable_highlight if exists('g:cpp_member_variable_highlight') && g:cpp_member_variable_highlight
syn match cCustomDot "\." contained syn match cCustomDot "\." contained
syn match cCustomPtr "->" 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 hi def link cCustomMemVar Function
endif endif

View File

@@ -4,7 +4,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'c++11') == -1
" Language: C++ Additions " Language: C++ Additions
" Maintainer: Jon Haggblad <jon@haeggblad.com> " Maintainer: Jon Haggblad <jon@haeggblad.com>
" URL: http://www.haeggblad.com " URL: http://www.haeggblad.com
" Last Change: 12 Oct 2016 " Last Change: 1 Feb 2018
" Version: 0.6 " Version: 0.6
" Changelog: " Changelog:
" 0.1 - initial version. " 0.1 - initial version.
@@ -37,7 +37,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'c++11') == -1
" Functions " Functions
if !exists('g:cpp_no_function_highlight') 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*(\@=" syn match cCustomFunc "\w\+\s*(\@="
hi def link cCustomFunc Function hi def link cCustomFunc Function
endif endif
@@ -855,6 +855,37 @@ syntax keyword cppSTLconstant WEOF
syntax keyword cppSTLconstant WCHAR_MIN syntax keyword cppSTLconstant WCHAR_MIN
syntax keyword cppSTLconstant WCHAR_MAX 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") if !exists("cpp_no_cpp11")
syntax keyword cppSTLconstant nullptr syntax keyword cppSTLconstant nullptr
@@ -1766,6 +1797,9 @@ if !exists("cpp_no_cpp17")
syntax keyword cppSTLfunction do_deallocate syntax keyword cppSTLfunction do_deallocate
syntax keyword cppSTLfunction do_is_equal syntax keyword cppSTLfunction do_is_equal
" mutex
syntax keyword cppSTLtype scoped_lock
" new " new
syntax keyword cppSTLconstant hardware_destructive_interference_size syntax keyword cppSTLconstant hardware_destructive_interference_size
syntax keyword cppSTLconstant hardware_constructive_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_code_enum_v
syntax keyword cppSTLbool is_error_condition_enum_v syntax keyword cppSTLbool is_error_condition_enum_v
" thread " shared_mutex
syntax keyword cppSTLtype shared_mutex syntax keyword cppSTLtype shared_mutex
" tuple " tuple
@@ -1879,6 +1913,16 @@ if !exists("cpp_no_cpp17")
syntax keyword cppSTLbool conjunction_v syntax keyword cppSTLbool conjunction_v
syntax keyword cppSTLbool disjunction_v syntax keyword cppSTLbool disjunction_v
syntax keyword cppSTLbool negation_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 alignment_of_v
syntax keyword cppSTLconstant rank_v syntax keyword cppSTLconstant rank_v
syntax keyword cppSTLconstant extent_v syntax keyword cppSTLconstant extent_v
@@ -1888,6 +1932,19 @@ if !exists("cpp_no_cpp17")
syntax keyword cppSTLtype conjunction syntax keyword cppSTLtype conjunction
syntax keyword cppSTLtype disjunction syntax keyword cppSTLtype disjunction
syntax keyword cppSTLtype negation 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 " unordered_map, unordered_set, unordered_multimap, unordered_multiset
syntax keyword cppSTLtype node_type syntax keyword cppSTLtype node_type
@@ -1921,6 +1978,12 @@ if !exists("cpp_no_cpp17")
endif " C++17 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 if exists('g:cpp_concepts_highlight') && g:cpp_concepts_highlight
syntax keyword cppStatement concept syntax keyword cppStatement concept
syntax keyword cppStorageClass requires syntax keyword cppStorageClass requires

View File

@@ -26,7 +26,7 @@ syn match yamlBlock "[\[\]\{\}\|\>]"
syn region yamlComment start="\#" end="$" syn region yamlComment start="\#" end="$"
syn match yamlIndicator "#YAML:\S\+" 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 region yamlString start='"' end='"' skip='\\"' contains=yamlEscape
syn match yamlEscape +\\[abfnrtv'"\\]+ contained syn match yamlEscape +\\[abfnrtv'"\\]+ contained
syn match yamlEscape "\\\o\o\=\o\=" contained syn match yamlEscape "\\\o\o\=\o\=" contained

89
autoload/cargo.vim Normal file
View File

@@ -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

View File

@@ -3,11 +3,21 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
let s:save_cpo = &cpo let s:save_cpo = &cpo
set cpo&vim set cpo&vim
let s:V = vital#of('crystal') let s:V = vital#crystal#new()
let s:P = s:V.import('Process') let s:P = s:V.import('Process')
let s:J = s:V.import('Web.JSON')
let s:C = s:V.import('ColorEcho') let s:C = s:V.import('ColorEcho')
if exists('*json_decode')
function! s:decode_json(text) abort
return json_decode(a:text)
endfunction
else
let s:J = s:V.import('Web.JSON')
function! s:decode_json(text) abort
return s:J.decode(a:text)
endfunction
endif
function! s:echo_error(msg, ...) abort function! s:echo_error(msg, ...) abort
echohl ErrorMsg echohl ErrorMsg
if a:0 == 0 if a:0 == 0
@@ -102,7 +112,7 @@ function! crystal_lang#jump_to_definition(file, pos) abort
return s:echo_error(cmd_result.output) return s:echo_error(cmd_result.output)
endif endif
let impl = s:J.decode(cmd_result.output) let impl = s:decode_json(cmd_result.output)
if impl.status !=# 'ok' if impl.status !=# 'ok'
return s:echo_error(impl.message) return s:echo_error(impl.message)
endif endif
@@ -149,7 +159,6 @@ endfunction
function! crystal_lang#complete(findstart, base) abort function! crystal_lang#complete(findstart, base) abort
if a:findstart if a:findstart
echom 'find start'
return s:find_completion_start() return s:find_completion_start()
endif endif
@@ -158,7 +167,7 @@ function! crystal_lang#complete(findstart, base) abort
return return
endif endif
let contexts = s:J.decode(cmd_result.output) let contexts = s:decode_json(cmd_result.output)
if contexts.status !=# 'ok' if contexts.status !=# 'ok'
return return
endif endif
@@ -271,59 +280,34 @@ function! crystal_lang#format_string(code, ...) abort
return output return output
endfunction endfunction
function! s:get_saved_states() abort " crystal_lang#format(option_str [, on_save])
let result = {} function! crystal_lang#format(option_str, ...) abort
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
if !executable(g:crystal_compiler_command) if !executable(g:crystal_compiler_command)
" Finish command silently " Finish command silently
return return
endif endif
let formatted = crystal_lang#format_string(join(getline(1, '$'), "\n"), a:option_str) let on_save = a:0 > 0 ? a:1 : 0
let formatted = substitute(formatted, '\n$', '', '')
let sel_save = &l:selection let before = join(getline(1, '$'), "\n")
let ve_save = &virtualedit let formatted = crystal_lang#format_string(before, a:option_str)
let &l:selection = 'inclusive' if !on_save
let &virtualedit = '' let after = substitute(formatted, '\n$', '', '')
let [save_g_reg, save_g_regtype] = [getreg('g'), getregtype('g')] if before ==# after
let windows_save = s:get_saved_states() return
endif
endif
try let view_save = winsaveview()
call setreg('g', formatted, 'v') let pos_save = getpos('.')
silent normal! gg0vG$"gp let lines = split(formatted, '\n')
finally silent! undojoin
call setreg('g', save_g_reg, save_g_regtype) if line('$') > len(lines)
let &l:selection = sel_save execute len(lines) . ',$delete' '_'
let &virtualedit = ve_save endif
let winnr = winnr() call setline(1, lines)
for winnr in keys(windows_save) call winrestview(view_save)
let w = windows_save[winnr] call setpos('.', pos_save)
execute winnr 'wincmd w'
call setpos('.', w.pos)
call winrestview(w.screen)
endfor
execute winnr 'wincmd w'
endtry
endfunction endfunction
let &cpo = s:save_cpo let &cpo = s:save_cpo

View File

@@ -18,11 +18,15 @@ function! elixir#indent#indent(lnum)
call s:debug("==> Indenting line " . lnum) call s:debug("==> Indenting line " . lnum)
call s:debug("text = '" . text . "'") call s:debug("text = '" . text . "'")
let [_, curs_lnum, curs_col, _] = getpos('.')
call cursor(lnum, 0)
let handlers = [ let handlers = [
\'top_of_file', \'top_of_file',
\'starts_with_end', \'starts_with_end',
\'starts_with_mid_or_end_block_keyword', \'starts_with_mid_or_end_block_keyword',
\'following_trailing_do', \'following_trailing_do',
\'following_trailing_rocket',
\'following_trailing_binary_operator', \'following_trailing_binary_operator',
\'starts_with_pipe', \'starts_with_pipe',
\'starts_with_close_bracket', \'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) let indent = function('elixir#indent#handle_'.handler)(lnum, text, prev_nb_lnum, prev_nb_text)
if indent != -1 if indent != -1
call s:debug('line '.lnum.': elixir#indent#handle_'.handler.' returned '.indent) call s:debug('line '.lnum.': elixir#indent#handle_'.handler.' returned '.indent)
call cursor(curs_lnum, curs_col)
return indent return indent
endif endif
endfor endfor
call s:debug("defaulting") call s:debug("defaulting")
call cursor(curs_lnum, curs_col)
return 0 return 0
endfunction endfunction
@@ -166,7 +172,7 @@ function! s:get_base_indent(lnum, text)
elseif s:ends_with(a:text, data_structure_close, a:lnum) elseif s:ends_with(a:text, data_structure_close, a:lnum)
let data_structure_open = '\%(\[\|{\|(\)' let data_structure_open = '\%(\[\|{\|(\)'
let close_match_idx = match(a:text, data_structure_close . '\s*$') 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_lnum, open_match_col] = searchpairpos(data_structure_open, '', data_structure_close, 'bnW')
let open_match_text = getline(open_match_lnum) let open_match_text = getline(open_match_lnum)
return s:get_base_indent(open_match_lnum, open_match_text) return s:get_base_indent(open_match_lnum, open_match_text)
@@ -175,7 +181,6 @@ function! s:get_base_indent(lnum, text)
endif endif
endfunction endfunction
" TODO: @jbodah 2017-03-31: remove
function! elixir#indent#handle_following_trailing_do(lnum, text, prev_nb_lnum, prev_nb_text) 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:ends_with(a:prev_nb_text, s:keyword('do'), a:prev_nb_lnum)
if s:starts_with(a:text, s:keyword('end'), a: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 endif
endfunction 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) function! elixir#indent#handle_following_trailing_binary_operator(lnum, text, prev_nb_lnum, prev_nb_text)
let binary_operator = '\%(=\|<>\|>>>\|<=\|||\|+\|\~\~\~\|-\|&&\|<<<\|/\|\^\^\^\|\*\)' let binary_operator = '\%(=\|<>\|>>>\|<=\|||\|+\|\~\~\~\|-\|&&\|<<<\|/\|\^\^\^\|\*\)'

31
autoload/vifm/globals.vim Normal file
View File

@@ -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

View File

@@ -1,16 +0,0 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
function! vital#of(name) abort
let files = globpath(&runtimepath, 'autoload/vital/' . a:name . '.vital')
let file = split(files, "\n")
if empty(file)
throw 'vital: version file not found: ' . a:name
endif
let ver = readfile(file[0], 'b')
if empty(ver)
throw 'vital: invalid version file: ' . a:name
endif
return vital#_{substitute(ver[0], '\W', '', 'g')}#new()
endfunction
endif

View File

@@ -1,313 +1,13 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
let s:self_version = expand('<sfile>:t:r') let s:_plugin_name = expand('<sfile>:t:r')
let s:self_file = expand('<sfile>')
" Note: The extra argument to globpath() was added in Patch 7.2.051. function! vital#{s:_plugin_name}#new() abort
let s:globpath_third_arg = v:version > 702 || v:version == 702 && has('patch51') return vital#{s:_plugin_name[1:]}#new()
let s:loaded = {}
let s:cache_module_path = {}
let s:cache_sid = {}
let s:_vital_files_cache_runtimepath = ''
let s:_vital_files_cache = []
let s:_unify_path_cache = {}
function! s:import(name, ...) abort
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 = s:_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 endfunction
function! s:load(...) dict abort function! vital#{s:_plugin_name}#function(funcname) abort
for arg in a:000 silent! return function(a:funcname)
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, s:_import(name))
endif
unlet arg
endfor
return self
endfunction
function! s:unload() abort
let s:loaded = {}
let s:cache_sid = {}
let s:cache_module_path = {}
endfunction
function! s:exists(name) abort
return s:_get_module_path(a:name) !=# ''
endfunction
function! s:search(pattern) abort
let paths = s:_vital_files(a:pattern)
let modules = sort(map(paths, 's:_file2module(v:val)'))
return s:_uniq(modules)
endfunction
function! s:expand_modules(entry, all) abort
if type(a:entry) == type([])
let candidates = s:_concat(map(copy(a:entry), 's:search(v:val)'))
if empty(candidates)
throw printf('vital: Any of module %s is not found', string(a:entry))
endif
if eval(join(map(copy(candidates), 'has_key(a:all, v:val)'), '+'))
let modules = []
else
let modules = [candidates[0]]
endif
else
let modules = s:search(a:entry)
if empty(modules)
throw printf('vital: Module %s is not found', a:entry)
endif
endif
call filter(modules, '!has_key(a:all, v:val)')
for module in modules
let a:all[module] = 1
endfor
return modules
endfunction
function! s:_import(name) abort
if type(a:name) == type(0)
return s:_build_module(a:name)
endif
let path = s:_get_module_path(a:name)
if path ==# ''
throw 'vital: module not found: ' . a:name
endif
let sid = s:_get_sid_by_script(path)
if !sid
try
execute 'source' fnameescape(path)
catch /^Vim\%((\a\+)\)\?:E484/
throw 'vital: module not found: ' . a:name
catch /^Vim\%((\a\+)\)\?:E127/
" Ignore.
endtry
let sid = s:_get_sid_by_script(path)
endif
return s:_build_module(sid)
endfunction
function! s:_get_module_path(name) abort
let key = a:name . '_'
if has_key(s:cache_module_path, key)
return s:cache_module_path[key]
endif
if s:_is_absolute_path(a:name) && filereadable(a:name)
return a:name
endif
if a:name ==# ''
let paths = [s:self_file]
elseif a:name =~# '\v^\u\w*%(\.\u\w*)*$'
let paths = s:_vital_files(a:name)
else
throw 'vital: Invalid module name: ' . a:name
endif
call filter(paths, 'filereadable(expand(v:val, 1))')
let path = get(paths, 0, '')
let s:cache_module_path[key] = path
return path
endfunction
function! s:_get_sid_by_script(path) abort
if has_key(s:cache_sid, a:path)
return s:cache_sid[a:path]
endif
let path = s:_unify_path(a:path)
for line in filter(split(s:_redir('scriptnames'), "\n"),
\ 'stridx(v:val, s:self_version) > 0')
let list = matchlist(line, '^\s*\(\d\+\):\s\+\(.\+\)\s*$')
if !empty(list) && s:_unify_path(list[2]) ==# path
let s:cache_sid[a:path] = list[1] - 0
return s:cache_sid[a:path]
endif
endfor
return 0
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
if filereadable(expand('<sfile>:r') . '.VIM')
" 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
if s:globpath_third_arg
function! s:_runtime_files(path) abort
return split(globpath(&runtimepath, a:path, 1), "\n")
endfunction
else
function! s:_runtime_files(path) abort
return split(globpath(&runtimepath, a:path), "\n")
endfunction
endif
function! s:_vital_files(pattern) abort
if s:_vital_files_cache_runtimepath !=# &runtimepath
let path = printf('autoload/vital/%s/**/*.vim', s:self_version)
let s:_vital_files_cache = s:_runtime_files(path)
let mod = ':p:gs?[\\/]\+?/?'
call map(s:_vital_files_cache, 'fnamemodify(v:val, mod)')
let s:_vital_files_cache_runtimepath = &runtimepath
endif
let target = substitute(a:pattern, '\.', '/', 'g')
let target = substitute(target, '\*', '[^/]*', 'g')
let regexp = printf('autoload/vital/%s/%s.vim', s:self_version, target)
return filter(copy(s:_vital_files_cache), 'v:val =~# regexp')
endfunction
" Copy from System.Filepath
if has('win16') || has('win32') || has('win64')
function! s:_is_absolute_path(path) abort
return a:path =~? '^[a-z]:[/\\]'
endfunction
else
function! s:_is_absolute_path(path) abort
return a:path[0] ==# '/'
endfunction
endif
function! s:_build_module(sid) abort
if has_key(s:loaded, a:sid)
return copy(s:loaded[a:sid])
endif
let functions = s:_get_functions(a:sid)
let prefix = '<SNR>' . a:sid . '_'
let module = {}
for func in functions
let module[func] = function(prefix . func)
endfor
if has_key(module, '_vital_created')
call module._vital_created(module)
endif
let export_module = filter(copy(module), 'v:key =~# "^\\a"')
let s:loaded[a:sid] = get(g:, 'vital_debug', 0) ? module : export_module
if has_key(module, '_vital_loaded')
let V = vital#{s:self_version}#new()
call module._vital_loaded(V)
endif
return copy(s:loaded[a:sid])
endfunction
if exists('+regexpengine')
function! s:_get_functions(sid) abort
let funcs = s:_redir(printf("function /\\%%#=2^\<SNR>%d_", a:sid))
let map_pat = '<SNR>' . a:sid . '_\zs\w\+'
return map(split(funcs, "\n"), 'matchstr(v:val, map_pat)')
endfunction
else
function! s:_get_functions(sid) abort
let prefix = '<SNR>' . a:sid . '_'
let funcs = s:_redir('function')
let filter_pat = '^\s*function ' . prefix
let map_pat = prefix . '\zs\w\+'
return map(filter(split(funcs, "\n"),
\ 'stridx(v:val, prefix) > 0 && v:val =~# filter_pat'),
\ 'matchstr(v:val, map_pat)')
endfunction
endif
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)
let i -= 2
else
let i -= 1
endif
endwhile
return a:list
endfunction
endif
function! s:_concat(lists) abort
let result_list = []
for list in a:lists
let result_list += list
endfor
return result_list
endfunction
function! s:_redir(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
function! vital#{s:self_version}#new() abort
return s:_import('')
endfunction endfunction
endif endif

View File

@@ -1,5 +1,14 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
" ___vital___
" NOTE: lines between '" ___vital___' is generated by :Vitalize.
" Do not mofidify the code nor insert new lines before '" ___vital___'
function! s:_SID() abort
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$')
endfunction
execute join(['function! vital#_crystal#ColorEcho#import() abort', printf("return map({'get_echorizer': '', 'echo': '', 'is_available': ''}, \"vital#_crystal#function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n")
delfunction s:_SID
" ___vital___
scriptencoding utf-8 scriptencoding utf-8
let s:save_cpo = &cpo let s:save_cpo = &cpo
set cpo&vim set cpo&vim

View File

@@ -1,5 +1,14 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
" ___vital___
" NOTE: lines between '" ___vital___' is generated by :Vitalize.
" Do not mofidify the code nor insert new lines before '" ___vital___'
function! s:_SID() abort
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$')
endfunction
execute join(['function! vital#_crystal#Data#List#import() abort', printf("return map({'combinations': '', 'and': '', 'sort_by': '', 'foldr1': '', 'sort': '', 'flatten': '', 'has_index': '', 'find_indices': '', 'any': '', 'unshift': '', 'span': '', 'pop': '', 'binary_search': '', 'uniq_by': '', 'or': '', 'all': '', 'zip': '', 'find_last_index': '', 'find': '', 'partition': '', 'shift': '', 'permutations': '', 'break': '', 'max_by': '', 'foldl': '', 'foldr': '', 'find_index': '', 'drop_while': '', 'group_by': '', 'take_while': '', 'conj': '', 'push': '', 'char_range': '', 'cons': '', 'foldl1': '', 'intersect': '', 'concat': '', 'map_accum': '', 'clear': '', 'has_common_items': '', 'product': '', 'zip_fill': '', 'uniq': '', 'has': '', 'min_by': '', 'with_index': ''}, \"vital#_crystal#function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n")
delfunction s:_SID
" ___vital___
" Utilities for list. " Utilities for list.
let s:save_cpo = &cpo let s:save_cpo = &cpo
@@ -175,6 +184,11 @@ function! s:take_while(f, xs) abort
return s:span(a:f, a:xs)[0] return s:span(a:f, a:xs)[0]
endfunction endfunction
" similar to Haskell's Data.List.dropWhile
function! s:drop_while(f, xs) abort
return s:span(a:f, a:xs)[1]
endfunction
" similar to Haskell's Data.List.partition " similar to Haskell's Data.List.partition
function! s:partition(f, xs) abort function! s:partition(f, xs) abort
return [filter(copy(a:xs), a:f), filter(copy(a:xs), '!(' . a:f . ')')] return [filter(copy(a:xs), a:f), filter(copy(a:xs), '!(' . a:f . ')')]
@@ -271,14 +285,22 @@ endfunction
" similar to Ruby's detect or Haskell's find. " similar to Ruby's detect or Haskell's find.
function! s:find(list, default, f) abort function! s:find(list, default, f) abort
let l:Call = type(a:f) is type(function('function'))
\ ? function('call')
\ : function('s:_call_string_expr')
for x in a:list for x in a:list
if eval(substitute(a:f, 'v:val', string(x), 'g')) if l:Call(a:f, [x])
return x return x
endif endif
endfor endfor
return a:default return a:default
endfunction endfunction
function! s:_call_string_expr(expr, args) abort
return map([a:args[0]], a:expr)[0]
endfunction
" Returns the index of the first element which satisfies the given expr. " Returns the index of the first element which satisfies the given expr.
function! s:find_index(xs, f, ...) abort function! s:find_index(xs, f, ...) abort
let len = len(a:xs) let len = len(a:xs)
@@ -426,7 +448,7 @@ function! s:combinations(list, r) abort
if a:r > len(a:list) if a:r > len(a:list)
return [] return []
elseif a:r < 0 elseif a:r < 0
throw 'vital: Data:List: {r} must be non-negative integer' throw 'vital: Data.List: {r} must be non-negative integer'
endif endif
let n = len(a:list) let n = len(a:list)
let result = [] let result = []

View File

@@ -1,5 +1,14 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
" ___vital___
" NOTE: lines between '" ___vital___' is generated by :Vitalize.
" Do not mofidify the code nor insert new lines before '" ___vital___'
function! s:_SID() abort
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$')
endfunction
execute join(['function! vital#_crystal#Data#String#import() abort', printf("return map({'starts_with': '', 'split3': '', 'replace_first': '', 'chop': '', 'unescape': '', 'split_posix_text': '', 'replace': '', 'scan': '', 'strwidthpart': '', 'common_head': '', 'reverse': '', 'escape_pattern': '', 'trim_end': '', '_vital_depends': '', 'wrap': '', 'join_posix_lines': '', 'contains_multibyte': '', 'truncate_skipping': '', 'split_leftright': '', 'ends_with': '', 'nsplit': '', 'strwidthpart_reverse': '', 'unescape_pattern': '', 'levenshtein_distance': '', 'trim_start': '', 'justify_equal_spacing': '', 'nr2hex': '', 'iconv': '', 'pad_left': '', 'nr2enc_char': '', 'lines': '', 'repair_posix_text': '', 'nr2byte': '', 'trim': '', 'diffidx': '', 'truncate': '', 'split_by_displaywidth': '', '_vital_created': '', 'padding_by_displaywidth': '', 'hash': '', 'chomp': '', 'pad_between_letters': '', 'dstring': '', 'pad_both_sides': '', 'substitute_last': '', 'pad_right': '', 'remove_ansi_sequences': '', '_vital_loaded': ''}, \"vital#_crystal#function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n")
delfunction s:_SID
" ___vital___
" Utilities for string. " Utilities for string.
let s:save_cpo = &cpo let s:save_cpo = &cpo
@@ -7,12 +16,21 @@ set cpo&vim
function! s:_vital_loaded(V) abort function! s:_vital_loaded(V) abort
let s:V = a:V let s:V = a:V
let s:P = s:V.import('Prelude')
let s:L = s:V.import('Data.List') let s:L = s:V.import('Data.List')
endfunction endfunction
function! s:_vital_depends() abort function! s:_vital_depends() abort
return ['Prelude', 'Data.List'] return ['Data.List']
endfunction
function! s:_vital_created(module) abort
" Expose script-local funcref
if exists('s:strchars')
let a:module.strchars = s:strchars
endif
if exists('s:wcswidth')
let a:module.wcswidth = s:wcswidth
endif
endfunction endfunction
" Substitute a:from => a:to by string. " Substitute a:from => a:to by string.
@@ -61,7 +79,7 @@ function! s:common_head(strs) abort
endif endif
let strs = len == 2 ? a:strs : sort(copy(a:strs)) let strs = len == 2 ? a:strs : sort(copy(a:strs))
let pat = substitute(strs[0], '.', '\="[" . escape(submatch(0), "^\\") . "]"', 'g') let pat = substitute(strs[0], '.', '\="[" . escape(submatch(0), "^\\") . "]"', 'g')
return pat == '' ? '' : matchstr(strs[-1], '\C^\%[' . pat . ']') return pat ==# '' ? '' : matchstr(strs[-1], '\C^\%[' . pat . ']')
endfunction endfunction
" Split to two elements of List. ([left, right]) " Split to two elements of List. ([left, right])
@@ -130,9 +148,7 @@ endfunction
" even if a:str contains multibyte character(s). " even if a:str contains multibyte character(s).
" s:strchars(str) {{{ " s:strchars(str) {{{
if exists('*strchars') if exists('*strchars')
function! s:strchars(str) abort let s:strchars = function('strchars')
return strchars(a:str)
endfunction
else else
function! s:strchars(str) abort function! s:strchars(str) abort
return strlen(substitute(copy(a:str), '.', 'x', 'g')) return strlen(substitute(copy(a:str), '.', 'x', 'g'))
@@ -210,7 +226,7 @@ function! s:nr2byte(nr) abort
endfunction endfunction
function! s:nr2enc_char(charcode) abort function! s:nr2enc_char(charcode) abort
if &encoding == 'utf-8' if &encoding ==# 'utf-8'
return nr2char(a:charcode) return nr2char(a:charcode)
endif endif
let char = s:nr2byte(a:charcode) let char = s:nr2byte(a:charcode)
@@ -222,7 +238,7 @@ endfunction
function! s:nr2hex(nr) abort function! s:nr2hex(nr) abort
let n = a:nr let n = a:nr
let r = "" let r = ''
while n while n
let r = '0123456789ABCDEF'[n % 16] . r let r = '0123456789ABCDEF'[n % 16] . r
let n = n / 16 let n = n / 16
@@ -318,7 +334,7 @@ function! s:levenshtein_distance(str1, str2) abort
let letters2 = split(a:str2, '\zs') let letters2 = split(a:str2, '\zs')
let length1 = len(letters1) let length1 = len(letters1)
let length2 = len(letters2) let length2 = len(letters2)
let distances = map(range(1, length1 + 1), 'map(range(1, length2 + 1), "0")') let distances = map(range(1, length1 + 1), 'map(range(1, length2 + 1), ''0'')')
for i1 in range(0, length1) for i1 in range(0, length1)
let distances[i1][0] = i1 let distances[i1][0] = i1
@@ -373,7 +389,7 @@ function! s:split_by_displaywidth(expr, width, float, is_wrap) abort
let text = '' let text = ''
while cs_index < len(cs) while cs_index < len(cs)
if cs[cs_index] is "\n" if cs[cs_index] is# "\n"
let text = s:padding_by_displaywidth(text, a:width, a:float) let text = s:padding_by_displaywidth(text, a:width, a:float)
let lines += [text] let lines += [text]
let text = '' let text = ''
@@ -394,7 +410,7 @@ function! s:split_by_displaywidth(expr, width, float, is_wrap) abort
if a:is_wrap if a:is_wrap
if a:width < w if a:width < w
if a:width < strdisplaywidth(cs[cs_index]) if a:width < strdisplaywidth(cs[cs_index])
while get(cs, cs_index, "\n") isnot "\n" while get(cs, cs_index, "\n") isnot# "\n"
let cs_index += 1 let cs_index += 1
endwhile endwhile
continue continue
@@ -403,7 +419,7 @@ function! s:split_by_displaywidth(expr, width, float, is_wrap) abort
endif endif
endif endif
else else
while get(cs, cs_index, "\n") isnot "\n" while get(cs, cs_index, "\n") isnot# "\n"
let cs_index += 1 let cs_index += 1
endwhile endwhile
continue continue
@@ -440,8 +456,9 @@ function! s:truncate(str, width) abort
" http://github.com/mattn/googlereader-vim/tree/master " http://github.com/mattn/googlereader-vim/tree/master
if a:str =~# '^[\x00-\x7f]*$' if a:str =~# '^[\x00-\x7f]*$'
return len(a:str) < a:width ? return len(a:str) < a:width
\ printf('%-'.a:width.'s', a:str) : strpart(a:str, 0, a:width) \ ? printf('%-' . a:width . 's', a:str)
\ : strpart(a:str, 0, a:width)
endif endif
let ret = a:str let ret = a:str
@@ -471,57 +488,20 @@ function! s:truncate_skipping(str, max, footer_width, separator) abort
endfunction endfunction
function! s:strwidthpart(str, width) abort function! s:strwidthpart(str, width) abort
if a:width <= 0 let str = tr(a:str, "\t", ' ')
return '' let vcol = a:width + 2
endif return matchstr(str, '.*\%<' . (vcol < 0 ? 0 : vcol) . 'v')
let strarr = split(a:str, '\zs')
let width = s:wcswidth(a:str)
let index = len(strarr)
let diff = (index + 1) / 2
let rightindex = index - 1
while width > a:width
let index = max([rightindex - diff + 1, 0])
let partwidth = s:wcswidth(join(strarr[(index):(rightindex)], ''))
if width - partwidth >= a:width || diff <= 1
let width -= partwidth
let rightindex = index - 1
endif
if diff > 1
let diff = diff / 2
endif
endwhile
return index ? join(strarr[:index - 1], '') : ''
endfunction endfunction
function! s:strwidthpart_reverse(str, width) abort function! s:strwidthpart_reverse(str, width) abort
if a:width <= 0 let str = tr(a:str, "\t", ' ')
return '' let vcol = s:wcswidth(str) - a:width
endif return matchstr(str, '\%>' . (vcol < 0 ? 0 : vcol) . 'v.*')
let strarr = split(a:str, '\zs')
let width = s:wcswidth(a:str)
let strlen = len(strarr)
let diff = (strlen + 1) / 2
let leftindex = 0
let index = -1
while width > a:width
let index = min([leftindex + diff, strlen]) - 1
let partwidth = s:wcswidth(join(strarr[(leftindex):(index)], ''))
if width - partwidth >= a:width || diff <= 1
let width -= partwidth
let leftindex = index + 1
endif
if diff > 1
let diff = diff / 2
endif
endwhile
return index < strlen ? join(strarr[(index + 1):], '') : ''
endfunction endfunction
if v:version >= 703 if v:version >= 703
" Use builtin function. " Use builtin function.
function! s:wcswidth(str) abort let s:wcswidth = function('strwidth')
return strwidth(a:str)
endfunction
else else
function! s:wcswidth(str) abort function! s:wcswidth(str) abort
if a:str =~# '^[\x00-\x7f]*$' if a:str =~# '^[\x00-\x7f]*$'
@@ -564,9 +544,88 @@ else
endfunction endfunction
endif endif
function! s:remove_ansi_sequences(text) abort
return substitute(a:text, '\e\[\%(\%(\d\+;\)*\d\+\)\?[mK]', '', 'g')
endfunction
function! s:escape_pattern(str) abort
" escape characters for no-magic
return escape(a:str, '^$~.*[]\')
endfunction
function! s:unescape_pattern(str) abort
" unescape characters for no-magic
return s:unescape(a:str, '^$~.*[]\')
endfunction
function! s:unescape(str, chars) abort
let chars = map(split(a:chars, '\zs'), 'escape(v:val, ''^$~.*[]\'')')
return substitute(a:str, '\\\(' . join(chars, '\|') . '\)', '\1', 'g')
endfunction
function! s:iconv(expr, from, to) abort
if a:from ==# '' || a:to ==# '' || a:from ==? a:to
return a:expr
endif
let result = iconv(a:expr, a:from, a:to)
return empty(result) ? a:expr : result
endfunction
" NOTE:
" A definition of a TEXT file is "A file that contains characters organized
" into one or more lines."
" A definition of a LINE is "A sequence of zero or more non- <newline>s
" plus a terminating <newline>"
" That's why {stdin} always ends with <newline> ideally. However, there are
" some programs which does not follow the POSIX rule and a Vim's way to join
" List into TEXT; join({text}, "\n"); does not add <newline> to the end of
" the last line.
" That's why add a trailing <newline> if it does not exist.
" REF:
" http://pubs.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap03.html#tag_03_392
" http://pubs.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap03.html#tag_03_205
" :help split()
" NOTE:
" it does nothing if the text is a correct POSIX text
function! s:repair_posix_text(text, ...) abort
let newline = get(a:000, 0, "\n")
return a:text =~# '\n$' ? a:text : a:text . newline
endfunction
" NOTE:
" A definition of a TEXT file is "A file that contains characters organized
" into one or more lines."
" A definition of a LINE is "A sequence of zero or more non- <newline>s
" plus a terminating <newline>"
" REF:
" http://pubs.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap03.html#tag_03_392
" http://pubs.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap03.html#tag_03_205
function! s:join_posix_lines(lines, ...) abort
let newline = get(a:000, 0, "\n")
return join(a:lines, newline) . newline
endfunction
" NOTE:
" A definition of a TEXT file is "A file that contains characters organized
" into one or more lines."
" A definition of a LINE is "A sequence of zero or more non- <newline>s
" plus a terminating <newline>"
" TEXT into List; split({text}, '\r\?\n', 1); add an extra empty line at the
" end of List because the end of TEXT ends with <newline> and keepempty=1 is
" specified. (btw. keepempty=0 cannot be used because it will remove
" emptylines in the head and the tail).
" That's why removing a trailing <newline> before proceeding to 'split' is required
" REF:
" http://pubs.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap03.html#tag_03_392
" http://pubs.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap03.html#tag_03_205
function! s:split_posix_text(text, ...) abort
let newline = get(a:000, 0, '\r\?\n')
let text = substitute(a:text, newline . '$', '', '')
return split(text, newline, 1)
endfunction
let &cpo = s:save_cpo let &cpo = s:save_cpo
unlet s:save_cpo unlet s:save_cpo
" vim:set et ts=2 sts=2 sw=2 tw=0: " vim:set et ts=2 sts=2 sw=2 tw=0:
endif endif

View File

@@ -1,389 +0,0 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
let s:save_cpo = &cpo
set cpo&vim
if v:version ># 703 ||
\ (v:version is 703 && has('patch465'))
function! s:glob(expr) abort
return glob(a:expr, 1, 1)
endfunction
else
function! s:glob(expr) abort
let R = glob(a:expr, 1)
return split(R, '\n')
endfunction
endif
function! s:globpath(path, expr) abort
let R = globpath(a:path, a:expr, 1)
return split(R, '\n')
endfunction
" Wrapper functions for type().
let [
\ s:__TYPE_NUMBER,
\ s:__TYPE_STRING,
\ s:__TYPE_FUNCREF,
\ s:__TYPE_LIST,
\ s:__TYPE_DICT,
\ s:__TYPE_FLOAT] = [
\ type(3),
\ type(""),
\ type(function('tr')),
\ type([]),
\ type({}),
\ has('float') ? type(str2float('0')) : -1]
" __TYPE_FLOAT = -1 when -float
" This doesn't match to anything.
" Number or Float
function! s:is_numeric(Value) abort
let _ = type(a:Value)
return _ ==# s:__TYPE_NUMBER
\ || _ ==# s:__TYPE_FLOAT
endfunction
" Number
function! s:is_number(Value) abort
return type(a:Value) ==# s:__TYPE_NUMBER
endfunction
" Float
function! s:is_float(Value) abort
return type(a:Value) ==# s:__TYPE_FLOAT
endfunction
" String
function! s:is_string(Value) abort
return type(a:Value) ==# s:__TYPE_STRING
endfunction
" Funcref
function! s:is_funcref(Value) abort
return type(a:Value) ==# s:__TYPE_FUNCREF
endfunction
" List
function! s:is_list(Value) abort
return type(a:Value) ==# s:__TYPE_LIST
endfunction
" Dictionary
function! s:is_dict(Value) abort
return type(a:Value) ==# s:__TYPE_DICT
endfunction
function! s:truncate_skipping(str, max, footer_width, separator) abort
call s:_warn_deprecated("truncate_skipping", "Data.String.truncate_skipping")
let width = s:wcswidth(a:str)
if width <= a:max
let ret = a:str
else
let header_width = a:max - s:wcswidth(a:separator) - a:footer_width
let ret = s:strwidthpart(a:str, header_width) . a:separator
\ . s:strwidthpart_reverse(a:str, a:footer_width)
endif
return s:truncate(ret, a:max)
endfunction
function! s:truncate(str, width) abort
" Original function is from mattn.
" http://github.com/mattn/googlereader-vim/tree/master
call s:_warn_deprecated("truncate", "Data.String.truncate")
if a:str =~# '^[\x00-\x7f]*$'
return len(a:str) < a:width ?
\ printf('%-'.a:width.'s', a:str) : strpart(a:str, 0, a:width)
endif
let ret = a:str
let width = s:wcswidth(a:str)
if width > a:width
let ret = s:strwidthpart(ret, a:width)
let width = s:wcswidth(ret)
endif
if width < a:width
let ret .= repeat(' ', a:width - width)
endif
return ret
endfunction
function! s:strwidthpart(str, width) abort
call s:_warn_deprecated("strwidthpart", "Data.String.strwidthpart")
if a:width <= 0
return ''
endif
let ret = a:str
let width = s:wcswidth(a:str)
while width > a:width
let char = matchstr(ret, '.$')
let ret = ret[: -1 - len(char)]
let width -= s:wcswidth(char)
endwhile
return ret
endfunction
function! s:strwidthpart_reverse(str, width) abort
call s:_warn_deprecated("strwidthpart_reverse", "Data.String.strwidthpart_reverse")
if a:width <= 0
return ''
endif
let ret = a:str
let width = s:wcswidth(a:str)
while width > a:width
let char = matchstr(ret, '^.')
let ret = ret[len(char) :]
let width -= s:wcswidth(char)
endwhile
return ret
endfunction
if v:version >= 703
" Use builtin function.
function! s:wcswidth(str) abort
call s:_warn_deprecated("wcswidth", "Data.String.wcswidth")
return strwidth(a:str)
endfunction
else
function! s:wcswidth(str) abort
call s:_warn_deprecated("wcswidth", "Data.String.wcswidth")
if a:str =~# '^[\x00-\x7f]*$'
return strlen(a:str)
end
let mx_first = '^\(.\)'
let str = a:str
let width = 0
while 1
let ucs = char2nr(substitute(str, mx_first, '\1', ''))
if ucs == 0
break
endif
let width += s:_wcwidth(ucs)
let str = substitute(str, mx_first, '', '')
endwhile
return width
endfunction
" UTF-8 only.
function! s:_wcwidth(ucs) abort
let ucs = a:ucs
if (ucs >= 0x1100
\ && (ucs <= 0x115f
\ || ucs == 0x2329
\ || ucs == 0x232a
\ || (ucs >= 0x2e80 && ucs <= 0xa4cf
\ && ucs != 0x303f)
\ || (ucs >= 0xac00 && ucs <= 0xd7a3)
\ || (ucs >= 0xf900 && ucs <= 0xfaff)
\ || (ucs >= 0xfe30 && ucs <= 0xfe6f)
\ || (ucs >= 0xff00 && ucs <= 0xff60)
\ || (ucs >= 0xffe0 && ucs <= 0xffe6)
\ || (ucs >= 0x20000 && ucs <= 0x2fffd)
\ || (ucs >= 0x30000 && ucs <= 0x3fffd)
\ ))
return 2
endif
return 1
endfunction
endif
let s:is_windows = has('win16') || has('win32') || has('win64') || has('win95')
let s:is_cygwin = has('win32unix')
let s:is_mac = !s:is_windows && !s:is_cygwin
\ && (has('mac') || has('macunix') || has('gui_macvim') ||
\ (!isdirectory('/proc') && executable('sw_vers')))
let s:is_unix = has('unix')
function! s:is_windows() abort
return s:is_windows
endfunction
function! s:is_cygwin() abort
return s:is_cygwin
endfunction
function! s:is_mac() abort
return s:is_mac
endfunction
function! s:is_unix() abort
return s:is_unix
endfunction
function! s:_warn_deprecated(name, alternative) abort
try
echohl Error
echomsg "Prelude." . a:name . " is deprecated! Please use " . a:alternative . " instead."
finally
echohl None
endtry
endfunction
function! s:smart_execute_command(action, word) abort
execute a:action . ' ' . (a:word == '' ? '' : '`=a:word`')
endfunction
function! s:escape_file_searching(buffer_name) abort
return escape(a:buffer_name, '*[]?{}, ')
endfunction
function! s:escape_pattern(str) abort
return escape(a:str, '~"\.^$[]*')
endfunction
function! s:getchar(...) abort
let c = call('getchar', a:000)
return type(c) == type(0) ? nr2char(c) : c
endfunction
function! s:getchar_safe(...) abort
let c = s:input_helper('getchar', a:000)
return type(c) == type("") ? c : nr2char(c)
endfunction
function! s:input_safe(...) abort
return s:input_helper('input', a:000)
endfunction
function! s:input_helper(funcname, args) abort
let success = 0
if inputsave() !=# success
throw 'vital: Prelude: inputsave() failed'
endif
try
return call(a:funcname, a:args)
finally
if inputrestore() !=# success
throw 'vital: Prelude: inputrestore() failed'
endif
endtry
endfunction
function! s:set_default(var, val) abort
if !exists(a:var) || type({a:var}) != type(a:val)
let {a:var} = a:val
endif
endfunction
function! s:substitute_path_separator(path) abort
return s:is_windows ? substitute(a:path, '\\', '/', 'g') : a:path
endfunction
function! s:path2directory(path) abort
return s:substitute_path_separator(isdirectory(a:path) ? a:path : fnamemodify(a:path, ':p:h'))
endfunction
function! s:_path2project_directory_git(path) abort
let parent = a:path
while 1
let path = parent . '/.git'
if isdirectory(path) || filereadable(path)
return parent
endif
let next = fnamemodify(parent, ':h')
if next == parent
return ''
endif
let parent = next
endwhile
endfunction
function! s:_path2project_directory_svn(path) abort
let search_directory = a:path
let directory = ''
let find_directory = s:escape_file_searching(search_directory)
let d = finddir('.svn', find_directory . ';')
if d == ''
return ''
endif
let directory = fnamemodify(d, ':p:h:h')
" Search parent directories.
let parent_directory = s:path2directory(
\ fnamemodify(directory, ':h'))
if parent_directory != ''
let d = finddir('.svn', parent_directory . ';')
if d != ''
let directory = s:_path2project_directory_svn(parent_directory)
endif
endif
return directory
endfunction
function! s:_path2project_directory_others(vcs, path) abort
let vcs = a:vcs
let search_directory = a:path
let find_directory = s:escape_file_searching(search_directory)
let d = finddir(vcs, find_directory . ';')
if d == ''
return ''
endif
return fnamemodify(d, ':p:h:h')
endfunction
function! s:path2project_directory(path, ...) abort
let is_allow_empty = get(a:000, 0, 0)
let search_directory = s:path2directory(a:path)
let directory = ''
" Search VCS directory.
for vcs in ['.git', '.bzr', '.hg', '.svn']
if vcs ==# '.git'
let directory = s:_path2project_directory_git(search_directory)
elseif vcs ==# '.svn'
let directory = s:_path2project_directory_svn(search_directory)
else
let directory = s:_path2project_directory_others(vcs, search_directory)
endif
if directory != ''
break
endif
endfor
" Search project file.
if directory == ''
for d in ['build.xml', 'prj.el', '.project', 'pom.xml', 'package.json',
\ 'Makefile', 'configure', 'Rakefile', 'NAnt.build',
\ 'P4CONFIG', 'tags', 'gtags']
let d = findfile(d, s:escape_file_searching(search_directory) . ';')
if d != ''
let directory = fnamemodify(d, ':p:h')
break
endif
endfor
endif
if directory == ''
" Search /src/ directory.
let base = s:substitute_path_separator(search_directory)
if base =~# '/src/'
let directory = base[: strridx(base, '/src/') + 3]
endif
endif
if directory == '' && !is_allow_empty
" Use original path.
let directory = search_directory
endif
return s:substitute_path_separator(directory)
endfunction
let &cpo = s:save_cpo
unlet s:save_cpo
" vim:set et ts=2 sts=2 sw=2 tw=0:
endif

View File

@@ -1,5 +1,14 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
" ___vital___
" NOTE: lines between '" ___vital___' is generated by :Vitalize.
" Do not mofidify the code nor insert new lines before '" ___vital___'
function! s:_SID() abort
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$')
endfunction
execute join(['function! vital#_crystal#Process#import() abort', printf("return map({'shellescape': '', 'has_vimproc': '', 'system': '', 'iconv': '', 'spawn': '', 'get_last_status': ''}, \"vital#_crystal#function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n")
delfunction s:_SID
" ___vital___
" TODO: move all comments to doc file. " TODO: move all comments to doc file.
" "
" "
@@ -21,62 +30,36 @@ let s:need_trans = v:version < 704 || (v:version == 704 && !has('patch122'))
let s:TYPE_DICT = type({}) let s:TYPE_DICT = type({})
let s:TYPE_LIST = type([]) let s:TYPE_LIST = type([])
let s:TYPE_STRING = type("") let s:TYPE_STRING = type('')
" Execute program in the background from Vim.
" Return an empty string always.
"
" If a:expr is a List, shellescape() each argument.
" If a:expr is a String, the arguments are passed as-is.
"
" Windows:
" Using :!start , execute program without via cmd.exe.
" Spawning 'expr' with 'noshellslash'
" keep special characters from unwanted expansion.
" (see :help shellescape())
"
" Unix:
" using :! , execute program in the background by shell.
function! s:spawn(expr, ...) abort function! s:spawn(expr, ...) abort
let shellslash = 0 if type(a:expr) is s:TYPE_LIST
if s:is_windows let special = 1
let shellslash = &l:shellslash let cmdline = join(map(a:expr, 's:shellescape(v:val, special)'), ' ')
setlocal noshellslash elseif type(a:expr) is s:TYPE_STRING
let cmdline = a:expr
if a:0 && a:1
" for :! command
let cmdline = substitute(cmdline, '\([!%#]\|<[^<>]\+>\)', '\\\1', 'g')
endif
else
throw 'vital: Process: invalid argument (value type:' . type(a:expr) . ')'
endif
if s:is_windows
silent execute '!start' cmdline
else
silent execute '!' cmdline '&'
endif endif
try
if type(a:expr) is s:TYPE_LIST
let special = 1
let cmdline = join(map(a:expr, 'shellescape(v:val, special)'), ' ')
elseif type(a:expr) is s:TYPE_STRING
let cmdline = a:expr
if a:0 && a:1
" for :! command
let cmdline = substitute(cmdline, '\([!%#]\|<[^<>]\+>\)', '\\\1', 'g')
endif
else
throw 'Process.spawn(): invalid argument (value type:'.type(a:expr).')'
endif
if s:is_windows
silent execute '!start' cmdline
else
silent execute '!' cmdline '&'
endif
finally
if s:is_windows
let &l:shellslash = shellslash
endif
endtry
return '' return ''
endfunction endfunction
" iconv() wrapper for safety. " iconv() wrapper for safety.
function! s:iconv(expr, from, to) abort function! s:iconv(expr, from, to) abort
if a:from == '' || a:to == '' || a:from ==? a:to if a:from ==# '' || a:to ==# '' || a:from ==? a:to
return a:expr return a:expr
endif endif
let result = iconv(a:expr, a:from, a:to) let result = iconv(a:expr, a:from, a:to)
return result != '' ? result : a:expr return result !=# '' ? result : a:expr
endfunction endfunction
" Check vimproc. " Check vimproc.
@@ -128,7 +111,7 @@ function! s:system(str, ...) abort
elseif type(a:1) is s:TYPE_STRING elseif type(a:1) is s:TYPE_STRING
let args += [s:iconv(a:1, &encoding, 'char')] let args += [s:iconv(a:1, &encoding, 'char')]
else else
throw 'Process.system(): invalid argument (value type:'.type(a:1).')' throw 'vital: Process: invalid argument (value type:' . type(a:1) . ')'
endif endif
elseif a:0 >= 2 elseif a:0 >= 2
" {command} [, {input} [, {timeout}]] " {command} [, {input} [, {timeout}]]
@@ -145,13 +128,16 @@ function! s:system(str, ...) abort
elseif type(a:str) is s:TYPE_STRING elseif type(a:str) is s:TYPE_STRING
let command = a:str let command = a:str
else else
throw 'Process.system(): invalid argument (value type:'.type(a:str).')' throw 'vital: Process: invalid argument (value type:' . type(a:str) . ')'
endif endif
if s:need_trans if s:need_trans
let command = s:iconv(command, &encoding, 'char') let command = s:iconv(command, &encoding, 'char')
endif endif
let args = [command] + args let args = [command] + args
if background && (use_vimproc || !s:is_windows) if background && (use_vimproc || !s:is_windows)
if has('nvim')
throw "vital: Process: neovim's system() doesn't support background(&) process (cmdline:" . string(a:str) . ')'
endif
let args[0] = args[0] . ' &' let args[0] = args[0] . ' &'
endif endif
@@ -167,8 +153,14 @@ function! s:get_last_status() abort
endfunction endfunction
if s:is_windows if s:is_windows
function! s:shellescape(command) abort function! s:shellescape(...) abort
return substitute(a:command, '[&()[\]{}^=;!''+,`~]', '^\0', 'g') try
let shellslash = &shellslash
set noshellslash
return call('shellescape', a:000)
finally
let &shellslash = shellslash
endtry
endfunction endfunction
else else
function! s:shellescape(...) abort function! s:shellescape(...) abort

View File

@@ -1,5 +1,14 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
" ___vital___
" NOTE: lines between '" ___vital___' is generated by :Vitalize.
" Do not mofidify the code nor insert new lines before '" ___vital___'
function! s:_SID() abort
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$')
endfunction
execute join(['function! vital#_crystal#Web#JSON#import() abort', printf("return map({'decode': '', '_vital_depends': '', '_vital_created': '', 'encode': '', '_vital_loaded': ''}, \"vital#_crystal#function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n")
delfunction s:_SID
" ___vital___
let s:save_cpo = &cpo let s:save_cpo = &cpo
set cpo&vim set cpo&vim
@@ -15,11 +24,6 @@ function! s:_null() abort
return 0 return 0
endfunction endfunction
let s:const = {}
let s:const.true = function('s:_true')
let s:const.false = function('s:_false')
let s:const.null = function('s:_null')
function! s:_resolve(val, prefix) abort function! s:_resolve(val, prefix) abort
let t = type(a:val) let t = type(a:val)
if t == type('') if t == type('')
@@ -36,6 +40,13 @@ endfunction
function! s:_vital_created(module) abort function! s:_vital_created(module) abort
" define constant variables " define constant variables
if !exists('s:const')
let s:const = {}
let s:const.true = function('s:_true')
let s:const.false = function('s:_false')
let s:const.null = function('s:_null')
lockvar s:const
endif
call extend(a:module, s:const) call extend(a:module, s:const)
endfunction endfunction
@@ -55,7 +66,7 @@ function! s:decode(json, ...) abort
let settings = extend({ let settings = extend({
\ 'use_token': 0, \ 'use_token': 0,
\}, get(a:000, 0, {})) \}, get(a:000, 0, {}))
let json = iconv(a:json, "utf-8", &encoding) let json = iconv(a:json, 'utf-8', &encoding)
let json = join(split(json, "\n"), '') let json = join(split(json, "\n"), '')
let json = substitute(json, '\\u34;', '\\"', 'g') let json = substitute(json, '\\u34;', '\\"', 'g')
let json = substitute(json, '\\u\(\x\x\x\x\)', '\=s:string.nr2enc_char("0x".submatch(1))', 'g') let json = substitute(json, '\\u\(\x\x\x\x\)', '\=s:string.nr2enc_char("0x".submatch(1))', 'g')
@@ -75,7 +86,11 @@ endfunction
" @vimlint(EVL102, 0, l:true) " @vimlint(EVL102, 0, l:true)
" @vimlint(EVL102, 0, l:false) " @vimlint(EVL102, 0, l:false)
function! s:encode(val) abort function! s:encode(val, ...) abort
let settings = extend({
\ 'indent': 0,
\}, get(a:000, 0, {})
\)
if type(a:val) == 0 if type(a:val) == 0
return a:val return a:val
elseif type(a:val) == 1 elseif type(a:val) == 1
@@ -83,7 +98,7 @@ function! s:encode(val) abort
let json = substitute(json, "\r", '\\r', 'g') let json = substitute(json, "\r", '\\r', 'g')
let json = substitute(json, "\n", '\\n', 'g') let json = substitute(json, "\n", '\\n', 'g')
let json = substitute(json, "\t", '\\t', 'g') let json = substitute(json, "\t", '\\t', 'g')
return iconv(json, &encoding, "utf-8") return iconv(json, &encoding, 'utf-8')
elseif type(a:val) == 2 elseif type(a:val) == 2
if s:const.true == a:val if s:const.true == a:val
return 'true' return 'true'
@@ -96,14 +111,69 @@ function! s:encode(val) abort
return string(a:val) return string(a:val)
endif endif
elseif type(a:val) == 3 elseif type(a:val) == 3
return '[' . join(map(copy(a:val), 's:encode(v:val)'), ',') . ']' return s:_encode_list(a:val, settings)
elseif type(a:val) == 4 elseif type(a:val) == 4
return '{' . join(map(keys(a:val), 's:encode(v:val).":".s:encode(a:val[v:val])'), ',') . '}' return s:_encode_dict(a:val, settings)
else else
return string(a:val) return string(a:val)
endif endif
endfunction endfunction
" @vimlint(EVL102, 1, l:ns)
function! s:_encode_list(val, settings) abort
if empty(a:val)
return '[]'
elseif !a:settings.indent
let encoded_candidates = map(copy(a:val), 's:encode(v:val, a:settings)')
return printf('[%s]', join(encoded_candidates, ','))
else
let previous_indent = get(a:settings, '_previous_indent')
let indent = previous_indent + a:settings.indent
let ns = extend(copy(a:settings), {
\ '_previous_indent': indent,
\})
let encoded_candidates = map(
\ copy(a:val),
\ printf('''%s'' . s:encode(v:val, ns)', repeat(' ', indent)),
\)
return printf(
\ "[\n%s\n%s]",
\ join(encoded_candidates, ",\n"),
\ repeat(' ', previous_indent)
\)
endif
endfunction
" @vimlint(EVL102, 0, l:ns)
" @vimlint(EVL102, 1, l:ns)
function! s:_encode_dict(val, settings) abort
if empty(a:val)
return '{}'
elseif !a:settings.indent
let encoded_candidates = map(keys(a:val),
\ 's:encode(v:val, a:settings) . '':'' . s:encode(a:val[v:val], a:settings)'
\)
return printf('{%s}', join(encoded_candidates, ','))
else
let previous_indent = get(a:settings, '_previous_indent')
let indent = previous_indent + a:settings.indent
let ns = extend(copy(a:settings), {
\ '_previous_indent': indent,
\})
let encoded_candidates = map(keys(a:val),
\ printf(
\ '''%s'' . s:encode(v:val, ns) . '': '' . s:encode(a:val[v:val], ns)',
\ repeat(' ', indent),
\ ),
\)
return printf("{\n%s\n%s}",
\ join(encoded_candidates, ",\n"),
\ repeat(' ', previous_indent),
\)
endif
endfunction
" @vimlint(EVL102, 0, l:ns)
let &cpo = s:save_cpo let &cpo = s:save_cpo
unlet s:save_cpo unlet s:save_cpo

332
autoload/vital/crystal.vim Normal file
View File

@@ -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

View File

@@ -1,7 +1,7 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1
crystal crystal
a977489 bee84ae23effb0510137ad177e98c94d8b3657a6
Process Process
Web.JSON Web.JSON

View File

@@ -62,7 +62,7 @@ let charset = [
\ 'windows-1256', 'windows-1257', 'windows-1258', 'TIS-620', ] \ '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: {{{ " 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': []} 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': []}
@@ -82,6 +82,7 @@ let attributes_value = {
\ 'action': ['URL', ''], \ 'action': ['URL', ''],
\ 'allowfullscreen': ['Bool', ''], \ 'allowfullscreen': ['Bool', ''],
\ 'allowpaymentrequest': ['Bool', ''], \ 'allowpaymentrequest': ['Bool', ''],
\ 'allowpresentation': ['Bool', ''],
\ 'allowusermedia': ['Bool', ''], \ 'allowusermedia': ['Bool', ''],
\ 'alt': ['Text', ''], \ 'alt': ['Text', ''],
\ 'async': ['Bool', ''], \ 'async': ['Bool', ''],
@@ -579,7 +580,7 @@ let g:xmldata_html5 = {
\ ], \ ],
\ 'iframe': [ \ 'iframe': [
\ [], \ [],
\ extend(copy(global_attributes), {'src': [], 'srcdoc': [], 'name': [], 'width': [], 'height': [], 'sandbox': ['allow-same-origin', 'allow-forms', 'allow-scripts'], 'seamless': ['seamless', ''], 'referrerpolicy': ['no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'unsafe-url'], 'allowfullscreen': [], 'allowpaymentrequest': [], 'allowusermedia': []}) \ extend(copy(global_attributes), {'src': [], 'srcdoc': [], 'name': [], 'width': [], 'height': [], 'sandbox': ['allow-same-origin', 'allow-forms', 'allow-scripts'], 'seamless': ['seamless', ''], 'referrerpolicy': ['no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'unsafe-url'], 'allowfullscreen': [], 'allowpaymentrequest': [], 'allowpresentation': [], 'allowusermedia': []})
\ ], \ ],
\ 'img': [ \ 'img': [
\ [], \ [],
@@ -615,7 +616,7 @@ let g:xmldata_html5 = {
\ ], \ ],
\ 'link': [ \ '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': [ \ 'main': [
\ flow_elements + ['style'], \ flow_elements + ['style'],

2
build
View File

@@ -5,7 +5,7 @@ set -E
DIRS="syntax indent compiler autoload ftplugin after/syntax after/indent after/ftplugin" DIRS="syntax indent compiler autoload ftplugin after/syntax after/indent after/ftplugin"
DIRS_BASIC="syntax compiler indent after/syntax after/indent" DIRS_BASIC="syntax compiler indent after/syntax after/indent"
DIRS_ALL="syntax indent compiler autoload ftplugin after" DIRS_ALL="syntax indent compiler autoload ftplugin after"
DIRS_SYNTAX="syntax after/syntax" DIRS_SYNTAX="syntax indent after/syntax after/indent"
DIRS_JAVASCRIPT="${DIRS} extras" DIRS_JAVASCRIPT="${DIRS} extras"
DIRS_RM="$DIRS_JAVASCRIPT" DIRS_RM="$DIRS_JAVASCRIPT"

View File

@@ -25,4 +25,47 @@ augroup filetypedetect
endif endif
autocmd BufRead,BufNewFile *.jl set filetype=julia autocmd BufRead,BufNewFile *.jl set filetype=julia
" coffeescript
autocmd BufNewFile,BufRead *.coffee set filetype=coffee
autocmd BufNewFile,BufRead *Cakefile set filetype=coffee
autocmd BufNewFile,BufRead *.coffeekup,*.ck set filetype=coffee
autocmd BufNewFile,BufRead *._coffee set filetype=coffee
autocmd BufNewFile,BufRead *.litcoffee set filetype=litcoffee
autocmd BufNewFile,BufRead *.coffee.md set filetype=litcoffee
" elixir
au BufRead,BufNewFile *.ex,*.exs call s:setf('elixir')
au BufRead,BufNewFile *.eex call s:setf('eelixir')
" fish
autocmd BufRead,BufNewFile *.fish setfiletype fish
autocmd BufRead fish_funced_*_*.fish call search('^$')
autocmd BufRead,BufNewFile ~/.config/fish/fish_{read_,}history setfiletype yaml
autocmd BufRead,BufNewFile ~/.config/fish/fishd.* setlocal readonly
autocmd BufNewFile ~/.config/fish/functions/*.fish
\ call append(0, ['function '.expand('%:t:r'),
\'',
\'end']) |
\ 2
" git
autocmd BufNewFile,BufRead *.git/{,modules/**/,worktrees/*/}{COMMIT_EDIT,TAG_EDIT,MERGE_,}MSG set ft=gitcommit
autocmd BufNewFile,BufRead *.git/config,.gitconfig,gitconfig,.gitmodules set ft=gitconfig
autocmd BufNewFile,BufRead */.config/git/config set ft=gitconfig
autocmd BufNewFile,BufRead *.git/modules/**/config set ft=gitconfig
autocmd BufNewFile,BufRead git-rebase-todo set ft=gitrebase
autocmd BufNewFile,BufRead .gitsendemail.* set ft=gitsendemail
" plantuml
autocmd BufRead,BufNewFile *.pu,*.uml,*.plantuml setfiletype plantuml | set filetype=plantuml
" scala
au BufRead,BufNewFile *.scala,*.sc set filetype=scala
au BufRead,BufNewFile *.sbt setfiletype sbt.scala
" swift
autocmd BufNewFile,BufRead *.swift set filetype=swift
augroup END augroup END

View File

@@ -25,7 +25,50 @@ augroup filetypedetect
endif endif
autocmd BufRead,BufNewFile *.jl set filetype=julia autocmd BufRead,BufNewFile *.jl set filetype=julia
" coffeescript
autocmd BufNewFile,BufRead *.coffee set filetype=coffee
autocmd BufNewFile,BufRead *Cakefile set filetype=coffee
autocmd BufNewFile,BufRead *.coffeekup,*.ck set filetype=coffee
autocmd BufNewFile,BufRead *._coffee set filetype=coffee
autocmd BufNewFile,BufRead *.litcoffee set filetype=litcoffee
autocmd BufNewFile,BufRead *.coffee.md set filetype=litcoffee
" elixir
au BufRead,BufNewFile *.ex,*.exs call s:setf('elixir')
au BufRead,BufNewFile *.eex call s:setf('eelixir')
" fish
autocmd BufRead,BufNewFile *.fish setfiletype fish
autocmd BufRead fish_funced_*_*.fish call search('^$')
autocmd BufRead,BufNewFile ~/.config/fish/fish_{read_,}history setfiletype yaml
autocmd BufRead,BufNewFile ~/.config/fish/fishd.* setlocal readonly
autocmd BufNewFile ~/.config/fish/functions/*.fish
\ call append(0, ['function '.expand('%:t:r'),
\'',
\'end']) |
\ 2
" git
autocmd BufNewFile,BufRead *.git/{,modules/**/,worktrees/*/}{COMMIT_EDIT,TAG_EDIT,MERGE_,}MSG set ft=gitcommit
autocmd BufNewFile,BufRead *.git/config,.gitconfig,gitconfig,.gitmodules set ft=gitconfig
autocmd BufNewFile,BufRead */.config/git/config set ft=gitconfig
autocmd BufNewFile,BufRead *.git/modules/**/config set ft=gitconfig
autocmd BufNewFile,BufRead git-rebase-todo set ft=gitrebase
autocmd BufNewFile,BufRead .gitsendemail.* set ft=gitsendemail
" plantuml
autocmd BufRead,BufNewFile *.pu,*.uml,*.plantuml setfiletype plantuml | set filetype=plantuml
" scala
au BufRead,BufNewFile *.scala,*.sc set filetype=scala
au BufRead,BufNewFile *.sbt setfiletype sbt.scala
" swift
autocmd BufNewFile,BufRead *.swift set filetype=swift
augroup END augroup END
augroup filetypedetect augroup filetypedetect
" apiblueprint:sheerun/apiblueprint.vim " apiblueprint:sheerun/apiblueprint.vim
autocmd BufReadPost,BufNewFile *.apib set filetype=apiblueprint autocmd BufReadPost,BufNewFile *.apib set filetype=apiblueprint
@@ -237,6 +280,8 @@ augroup END
augroup filetypedetect augroup filetypedetect
" go:fatih/vim-go:_BASIC " go:fatih/vim-go:_BASIC
" vint: -ProhibitAutocmdWithNoGroup
" We take care to preserve the user's fileencodings and fileformats, " We take care to preserve the user's fileencodings and fileformats,
" because those settings are global (not buffer local), yet we want " 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. " to override them for loading Go files, which are defined to be UTF-8.
@@ -257,18 +302,16 @@ function! s:gofiletype_post()
let &g:fileencodings = s:current_fileencodings let &g:fileencodings = s:current_fileencodings
endfunction endfunction
augroup vim-go-filetype " Note: should not use augroup in ftdetect (see :help ftdetect)
autocmd! au BufNewFile *.go setfiletype go | setlocal fileencoding=utf-8 fileformat=unix
au BufNewFile *.go setfiletype go | setlocal fileencoding=utf-8 fileformat=unix au BufRead *.go call s:gofiletype_pre("go")
au BufRead *.go call s:gofiletype_pre("go") au BufReadPost *.go call s:gofiletype_post()
au BufReadPost *.go call s:gofiletype_post()
au BufNewFile *.s setfiletype asm | setlocal fileencoding=utf-8 fileformat=unix au BufNewFile *.s setfiletype asm | setlocal fileencoding=utf-8 fileformat=unix
au BufRead *.s call s:gofiletype_pre("asm") au BufRead *.s call s:gofiletype_pre("asm")
au BufReadPost *.s call s:gofiletype_post() au BufReadPost *.s call s:gofiletype_post()
au BufRead,BufNewFile *.tmpl set filetype=gohtmltmpl au BufRead,BufNewFile *.tmpl set filetype=gohtmltmpl
augroup end
" vim: sw=2 ts=2 et " vim: sw=2 ts=2 et
augroup END augroup END
@@ -353,6 +396,7 @@ augroup END
augroup filetypedetect augroup filetypedetect
" json:elzr/vim-json " json:elzr/vim-json
autocmd BufNewFile,BufRead *.json setlocal filetype=json autocmd BufNewFile,BufRead *.json setlocal filetype=json
autocmd BufNewFile,BufRead *.jsonl setlocal filetype=json
autocmd BufNewFile,BufRead *.jsonp setlocal filetype=json autocmd BufNewFile,BufRead *.jsonp setlocal filetype=json
autocmd BufNewFile,BufRead *.geojson setlocal filetype=json autocmd BufNewFile,BufRead *.geojson setlocal filetype=json
autocmd BufNewFile,BufRead *.template setlocal filetype=json autocmd BufNewFile,BufRead *.template setlocal filetype=json

View File

@@ -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=? CrystalSpecSwitch call crystal_lang#switch_spec_file(<f-args>)
command! -buffer -nargs=? CrystalSpecRunAll call crystal_lang#run_all_spec(<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=? 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 <buffer><Plug>(crystal-jump-to-definition) :<C-u>CrystalDef<CR>
nnoremap <Plug>(crystal-show-context) :<C-u>CrystalContext<CR> nnoremap <buffer><Plug>(crystal-show-context) :<C-u>CrystalContext<CR>
nnoremap <Plug>(crystal-spec-switch) :<C-u>CrystalSpecSwitch<CR> nnoremap <buffer><Plug>(crystal-spec-switch) :<C-u>CrystalSpecSwitch<CR>
nnoremap <Plug>(crystal-spec-run-all) :<C-u>CrystalSpecRunAll<CR> nnoremap <buffer><Plug>(crystal-spec-run-all) :<C-u>CrystalSpecRunAll<CR>
nnoremap <Plug>(crystal-spec-run-current) :<C-u>CrystalSpecRunCurrent<CR> nnoremap <buffer><Plug>(crystal-spec-run-current) :<C-u>CrystalSpecRunCurrent<CR>
nnoremap <Plug>(crystal-format) :<C-u>CrystalFormat<CR> nnoremap <buffer><Plug>(crystal-format) :<C-u>CrystalFormat<CR>
augroup plugin-ft-crystal augroup plugin-ft-crystal
autocmd! autocmd BufWritePre <buffer> if g:crystal_auto_format | call crystal_lang#format('', 1) | endif
autocmd BufWritePre <buffer> if g:crystal_auto_format | CrystalFormat | endif
augroup END augroup END
if get(g:, 'crystal_define_mappings', 1) if get(g:, 'crystal_define_mappings', 1)

View File

@@ -1,12 +1,12 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
if (exists("b:did_ftplugin")) if exists('b:did_ftplugin')
finish finish
endif endif
let b:did_ftplugin = 1 let b:did_ftplugin = 1
" Matchit support " Matchit support
if exists("loaded_matchit") && !exists("b:match_words") if exists('loaded_matchit') && !exists('b:match_words')
let b:match_ignorecase = 0 let b:match_ignorecase = 0
let b:match_words = '\:\@<!\<\%(do\|fn\)\:\@!\>' . let b:match_words = '\:\@<!\<\%(do\|fn\)\:\@!\>' .
@@ -32,9 +32,30 @@ let &l:path =
setlocal includeexpr=elixir#util#get_filename(v:fname) setlocal includeexpr=elixir#util#get_filename(v:fname)
setlocal suffixesadd=.ex,.exs,.eex,.erl,.yrl,.hrl 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 silent! setlocal formatoptions-=t formatoptions+=croqlj
let b:undo_ftplugin = 'setlocal sw< sts< et< isk< com< cms< path< inex< sua< '. let b:block_begin = '\<\(do$\|fn\>\)'
\ '| unlet! b:match_ignorecase b:match_words' let b:block_end = '\<end\>'
nnoremap <buffer> <silent> <expr> ]] ':silent keeppatterns /'.b:block_begin.'<CR>'
nnoremap <buffer> <silent> <expr> [[ ':silent keeppatterns ?'.b:block_begin.'<CR>'
nnoremap <buffer> <silent> <expr> ][ ':silent keeppatterns /'.b:block_end .'<CR>'
nnoremap <buffer> <silent> <expr> [] ':silent keeppatterns ?'.b:block_end .'<CR>'
onoremap <buffer> <silent> <expr> ]] ':silent keeppatterns /'.b:block_begin.'<CR>'
onoremap <buffer> <silent> <expr> [[ ':silent keeppatterns ?'.b:block_begin.'<CR>'
onoremap <buffer> <silent> <expr> ][ ':silent keeppatterns /'.b:block_end .'<CR>'
onoremap <buffer> <silent> <expr> [] ':silent keeppatterns ?'.b:block_end .'<CR>'
silent! setlocal formatoptions-=t formatoptions+=croqlj
let b:undo_ftplugin = 'setlocal sw< sts< et< isk< com< cms< path< inex< sua< def<'.
\ '| unlet! b:match_ignorecase b:match_words b:block_begin b:block_end'
endif endif

View File

@@ -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 " Mail file type extension to pick files for attachments via vifm
" Maintainer: xaizek <xaizek@posteo.net> " Maintainer: xaizek <xaizek@posteo.net>
" Last Change: January 23, 2016 " Last Change: January 02, 2018
" Insert attachment picked via vifm after 'Subject' header " Insert attachment picked via vifm after 'Subject' header
function! s:AddMailAttacments() function! s:AddMailAttachments()
" TODO: reduce duplication between this file and plugins/vifm.vim call vifm#globals#Init()
" XXX: similar code is in plugins/vifm.vim, but it's different in details
let l:listf = tempname() let l:listf = tempname()
if !has('nvim') if !has('nvim')
@@ -26,7 +28,7 @@ function! s:AddMailAttacments()
else else
" Work around handicapped neovim... " Work around handicapped neovim...
let callback = { 'listf': l:listf } let callback = { 'listf': l:listf }
function! callback.on_exit(id, code) function! callback.on_exit(id, code, event)
buffer # buffer #
silent! bdelete! # silent! bdelete! #
call s:HandleRunResults(a:code, self.listf) call s:HandleRunResults(a:code, self.listf)
@@ -59,7 +61,7 @@ function! s:HandleRunResults(exitcode, listf)
call delete(a:listf) call delete(a:listf)
endfunction 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 : " vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 :

View File

@@ -31,8 +31,6 @@ else
endif endif
unlet s:delims unlet s:delims
let b:undo_ftplugin = ""
let &cpo = s:save_cpo let &cpo = s:save_cpo
unlet s:save_cpo unlet s:save_cpo

View File

@@ -9,14 +9,13 @@ setlocal nolisp
setlocal autoindent setlocal autoindent
setlocal indentexpr=GetCaddyfileIndent(v:lnum) setlocal indentexpr=GetCaddyfileIndent(v:lnum)
setlocal indentkeys+=<:>,0=},0=) setlocal indentkeys+=<:>,0=},0=)
" setlocal cindent
if exists('*shiftwidth') if exists('*shiftwidth')
func s:sw() function! s:sw()
return shiftwidth() return shiftwidth()
endfunc endfunc
else else
func s:sw() function! s:sw()
return &sw return &sw
endfunc endfunc
endif endif

View File

@@ -296,9 +296,20 @@ function! GetHaskellIndent()
"" where foo "" where foo
"" >>>>>>bar "" >>>>>>bar
""
"" where foo :: Int
"" >>>>>>>>>>-> Int
""
"" where foo x
"" >>>>>>>>|
if l:prevline =~ '\C\<where\>\s\+\S\+.*$' if l:prevline =~ '\C\<where\>\s\+\S\+.*$'
if l:line =~ '^\s*[=-]>\s' && l:prevline =~ ' :: ' if l:line =~ '^\s*[=-]>\s' && l:prevline =~ ' :: '
return match(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 else
let l:s = match(l:prevline, '\C\<where\>') let l:s = match(l:prevline, '\C\<where\>')
if s:isSYN('haskellWhere', v:lnum - 1, l:s + 1) if s:isSYN('haskellWhere', v:lnum - 1, l:s + 1)

View File

@@ -250,7 +250,7 @@ function s:Balanced(lnum,line)
let pos = match(a:line, '[][(){}]') let pos = match(a:line, '[][(){}]')
while pos != -1 while pos != -1
if s:SynAt(a:lnum,pos + 1) !~? b:syng_strcom 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 if l:open < 0
return return
endif endif
@@ -271,10 +271,7 @@ function s:OneScope()
return s:Pure('s:PreviousToken') != '.' return s:Pure('s:PreviousToken') != '.'
elseif strpart(getline('.'),col('.')-2,2) == '=>' elseif strpart(getline('.'),col('.')-2,2) == '=>'
call cursor(0,col('.')-1) call cursor(0,col('.')-1)
if s:PreviousToken() == ')' return s:PreviousToken() != ')' || s:GetPair('(', ')', 'bW', s:skip_expr)
return s:GetPair('(', ')', 'bW', s:skip_expr)
endif
return 1
endif endif
endfunction endfunction
@@ -299,9 +296,9 @@ endfunction
" encloses the entire context, 'cont' if whether a:firstline is a continued " encloses the entire context, 'cont' if whether a:firstline is a continued
" expression, which could have started in a braceless context " expression, which could have started in a braceless context
function s:IsContOne(cont) function s:IsContOne(cont)
let [l:num, b_l] = [b:js_cache[1] + !b:js_cache[1], 0] let [l:num, pind] = b:js_cache[1] ?
let pind = b:js_cache[1] ? indent(b:js_cache[1]) + s:sw() : 0 \ [b:js_cache[1], indent(b:js_cache[1]) + s:sw()] : [1,0]
let ind = indent('.') + !a:cont let [ind, b_l] = [indent('.') + !a:cont, 0]
while line('.') > l:num && ind > pind || line('.') == l:num while line('.') > l:num && ind > pind || line('.') == l:num
if indent('.') < ind && s:OneScope() if indent('.') < ind && s:OneScope()
let b_l += 1 let b_l += 1
@@ -319,8 +316,8 @@ function s:IsContOne(cont)
endfunction endfunction
function s:IsSwitch() function s:IsSwitch()
call call('cursor',b:js_cache[1:]) return search('\m\C\%'.join(b:js_cache[1:],'l\%').
return search('\m\C\%#.\_s*\%(\%(\/\/.*\_$\|\/\*\_.\{-}\*\/\)\@>\_s*\)*\%(case\|default\)\>','nWc'.s:z) \ 'c{\_s*\%(\%(\/\/.*\_$\|\/\*\_.\{-}\*\/\)\@>\_s*\)*\%(case\|default\)\>','nW'.s:z)
endfunction endfunction
" https://github.com/sweet-js/sweet.js/wiki/design#give-lookbehind-to-the-reader " https://github.com/sweet-js/sweet.js/wiki/design#give-lookbehind-to-the-reader
@@ -376,7 +373,7 @@ function GetJavascriptIndent()
if s:PreviousToken() is '' if s:PreviousToken() is ''
return return
endif 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 = substitute(l:line,'^\s*','','')
let l:line_raw = l:line let l:line_raw = l:line
@@ -429,7 +426,7 @@ function GetJavascriptIndent()
endif endif
endif endif
if idx == -1 && pline[-1:] !~ '[{;]' if idx == -1 && pline[-1:] !~ '[{;]'
call cursor(l:lnum, len(pline)) call cursor(l:lnum, lcol)
let sol = matchstr(l:line,s:opfirst) let sol = matchstr(l:line,s:opfirst)
if sol is '' || sol == '/' && s:SynAt(v:lnum, if sol is '' || sol == '/' && s:SynAt(v:lnum,
\ 1 + len(getline(v:lnum)) - len(l:line)) =~? 'regex' \ 1 + len(getline(v:lnum)) - len(l:line)) =~? 'regex'
@@ -445,10 +442,11 @@ function GetJavascriptIndent()
else else
let is_op = s:sw() let is_op = s:sw()
endif 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() let b_l = s:Nat(s:IsContOne(is_op) - (!is_op && l:line =~ '^{')) * s:sw()
endif 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('(') let pval = s:ParseCino('(')
if !pval if !pval
let [Wval, vcol] = [s:ParseCino('W'), virtcol('.')] let [Wval, vcol] = [s:ParseCino('W'), virtcol('.')]
@@ -473,6 +471,10 @@ function GetJavascriptIndent()
elseif num elseif num
return s:Nat(num_ind + get(l:,'case_offset',s:sw()) + l:switch_offset + b_l + is_op) return s:Nat(num_ind + get(l:,'case_offset',s:sw()) + l:switch_offset + b_l + is_op)
endif 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 return b_l + is_op
endfunction endfunction

79
indent/markdown.vim Normal file
View File

@@ -0,0 +1,79 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'markdown') == -1
if exists("b:did_indent") | finish | endif
let b:did_indent = 1
setlocal indentexpr=GetMarkdownIndent()
setlocal nolisp
setlocal autoindent
" Automatically insert bullets
setlocal formatoptions+=r
" Do not automatically insert bullets when auto-wrapping with text-width
setlocal formatoptions-=c
" Accept various markers as bullets
setlocal comments=b:*,b:+,b:-
" Automatically continue blockquote on line break
setlocal comments+=b:>
" Only define the function once
if exists("*GetMarkdownIndent") | finish | endif
function! s:IsMkdCode(lnum)
let name = synIDattr(synID(a:lnum, 1, 0), 'name')
return (name =~ '^mkd\%(Code$\|Snippet\)' || name != '' && name !~ '^\%(mkd\|html\)')
endfunction
function! s:IsLiStart(line)
return a:line !~ '^ *\([*-]\)\%( *\1\)\{2}\%( \|\1\)*$' &&
\ a:line =~ '^\s*[*+-] \+'
endfunction
function! s:IsHeaderLine(line)
return a:line =~ '^\s*#'
endfunction
function! s:IsBlankLine(line)
return a:line =~ '^$'
endfunction
function! s:PrevNonBlank(lnum)
let i = a:lnum
while i > 1 && s:IsBlankLine(getline(i))
let i -= 1
endwhile
return i
endfunction
function GetMarkdownIndent()
if v:lnum > 2 && s:IsBlankLine(getline(v:lnum - 1)) && s:IsBlankLine(getline(v:lnum - 2))
return 0
endif
let list_ind = get(g:, "vim_markdown_new_list_item_indent", 4)
" Find a non-blank line above the current line.
let lnum = s:PrevNonBlank(v:lnum - 1)
" At the start of the file use zero indent.
if lnum == 0 | return 0 | endif
let ind = indent(lnum)
let line = getline(lnum) " Last line
let cline = getline(v:lnum) " Current line
if s:IsLiStart(cline)
" Current line is the first line of a list item, do not change indent
return indent(v:lnum)
elseif s:IsHeaderLine(cline) && !s:IsMkdCode(v:lnum)
" Current line is the header, do not indent
return 0
elseif s:IsLiStart(line)
if s:IsMkdCode(lnum)
return ind
else
" Last line is the first line of a list item, increase indent
return ind + list_ind
end
else
return ind
endif
endfunction
endif

View File

@@ -7,7 +7,7 @@ if exists("b:current_syntax")
finish finish
endif 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 caddyDirectiveArgs start="" end="\({\|#\|$\)"me=s-1 oneline contained contains=caddyPlaceholder,caddyString nextgroup=caddyDirectiveBlock skipwhite
syn region caddyDirectiveBlock start="{" skip="\\}" end="}" contained contains=caddySubdirective,caddyComment syn region caddyDirectiveBlock start="{" skip="\\}" end="}" contained contains=caddySubdirective,caddyComment

View File

@@ -19,18 +19,33 @@ else
endif endif
syn keyword carpSyntax def defn let do if while ref address set! the 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 expand deftype register system-include register-type
syn keyword carpSyntax defmodule copy use module defalias definterface eval 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 expand instantiate type info help quit env build run
syn keyword carpSyntax cat use project-set! local-include system-include 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 not or and + - * / = /= >= <= > < inc dec
syn keyword carpFunc println print get-line from-string mod seed random 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 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 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 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 from-float tan asin atan cosh sinh tanh exp frexp ldexp
syn keyword carpFunc log log10 modf pow ceil clamp approx refstr foreach syn keyword carpFunc log log10 modf pow ceil clamp approx refstr foreach

View File

@@ -143,6 +143,8 @@ syn region elixirDocString matchgroup=elixirSigilDelimiter start=+\%(@\w*doc\s\
" Defines " Defines
syn match elixirDefine '\<def\>\(:\)\@!' nextgroup=elixirFunctionDeclaration skipwhite skipnl syn match elixirDefine '\<def\>\(:\)\@!' nextgroup=elixirFunctionDeclaration skipwhite skipnl
syn match elixirPrivateDefine '\<defp\>\(:\)\@!' 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 elixirModuleDefine '\<defmodule\>\(:\)\@!' nextgroup=elixirModuleDeclaration skipwhite skipnl
syn match elixirProtocolDefine '\<defprotocol\>\(:\)\@!' nextgroup=elixirProtocolDeclaration skipwhite skipnl syn match elixirProtocolDefine '\<defprotocol\>\(:\)\@!' nextgroup=elixirProtocolDeclaration skipwhite skipnl
syn match elixirImplDefine '\<defimpl\>\(:\)\@!' nextgroup=elixirImplDeclaration 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 elixirBlockDefinition Keyword
hi def link elixirDefine Define hi def link elixirDefine Define
hi def link elixirPrivateDefine Define hi def link elixirPrivateDefine Define
hi def link elixirGuard Define
hi def link elixirPrivateGuard Define
hi def link elixirModuleDefine Define hi def link elixirModuleDefine Define
hi def link elixirProtocolDefine Define hi def link elixirProtocolDefine Define
hi def link elixirImplDefine Define hi def link elixirImplDefine Define

View File

@@ -44,8 +44,8 @@ if !exists("g:go_highlight_function_arguments")
let g:go_highlight_function_arguments = 0 let g:go_highlight_function_arguments = 0
endif endif
if !exists("g:go_highlight_methods") if !exists("g:go_highlight_function_calls")
let g:go_highlight_methods = 0 let g:go_highlight_function_calls = 0
endif endif
if !exists("g:go_highlight_fields") if !exists("g:go_highlight_fields")
@@ -204,7 +204,19 @@ else
endif endif
if g:go_highlight_format_strings != 0 if g:go_highlight_format_strings != 0
syn match goFormatSpecifier /\([^%]\(%%\)*\)\@<=%[-#0 +]*\%(\*\|\d\+\)\=\%(\.\%(\*\|\d\+\)\)*[vTtbcdoqxXUeEfgGsp]/ contained containedin=goString " [n] notation is valid for specifying explicit argument indexes
" 1. Match a literal % not preceded by a %.
" 2. Match any number of -, #, 0, space, or +
" 3. Match * or [n]* or any number or nothing before a .
" 4. Match * or [n]* or any number or nothing after a .
" 5. Match [n] or nothing before a verb
" 6. Match a formatting verb
syn match goFormatSpecifier /\
\([^%]\(%%\)*\)\
\@<=%[-#0 +]*\
\%(\%(\%(\[\d\+\]\)\=\*\)\|\d\+\)\=\
\%(\.\%(\%(\%(\[\d\+\]\)\=\*\)\|\d\+\)\=\)\=\
\%(\[\d\+\]\)\=[vTtbcdoqxXUeEfFgGsp]/ contained containedin=goString,goRawString
hi def link goFormatSpecifier goSpecialString hi def link goFormatSpecifier goSpecialString
endif endif
@@ -350,7 +362,6 @@ hi def link goOperator Operator
" Functions; " Functions;
if g:go_highlight_functions isnot 0 || g:go_highlight_function_arguments isnot 0 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 goDeclaration /\<func\>/ nextgroup=goReceiver,goFunction,goSimpleArguments skipwhite skipnl
syn match goReceiverVar /\w\+\ze\s\+\(\w\|\*\)/ nextgroup=goPointerOperator,goReceiverType skipwhite skipnl contained syn match goReceiverVar /\w\+\ze\s\+\(\w\|\*\)/ nextgroup=goPointerOperator,goReceiverType skipwhite skipnl contained
syn match goPointerOperator /\*/ nextgroup=goReceiverType contained skipwhite skipnl syn match goPointerOperator /\*/ nextgroup=goReceiverType contained skipwhite skipnl
@@ -369,13 +380,12 @@ else
syn keyword goDeclaration func syn keyword goDeclaration func
endif endif
hi def link goFunction Function hi def link goFunction Function
hi def link goFunctionCall Type
" Methods; " Function calls;
if g:go_highlight_methods != 0 if g:go_highlight_function_calls != 0
syn match goMethodCall /\.\w\+\ze(/hs=s+1 syn match goFunctionCall /\w\+\ze(/ contains=goBuiltins,goDeclaration
endif endif
hi def link goMethodCall Type hi def link goFunctionCall Type
" Fields; " Fields;
if g:go_highlight_fields != 0 if g:go_highlight_fields != 0

View File

@@ -112,7 +112,7 @@ syn keyword htmlArg contained async
" <content> " <content>
syn keyword htmlArg contained select syn keyword htmlArg contained select
" <iframe> " <iframe>
syn keyword htmlArg contained seamless srcdoc sandbox allowfullscreen allowusermedia allowpaymentrequest syn keyword htmlArg contained seamless srcdoc sandbox allowfullscreen allowusermedia allowpaymentrequest allowpresentation
" <picture> " <picture>
syn keyword htmlArg contained srcset sizes syn keyword htmlArg contained srcset sizes
" <a> " <a>

View File

@@ -73,10 +73,12 @@ if (!exists("g:vim_json_warnings") || g:vim_json_warnings==1)
syn match jsonTrailingCommaError ",\_s*[}\]]" syn match jsonTrailingCommaError ",\_s*[}\]]"
" Syntax: Watch out for missing commas between elements " Syntax: Watch out for missing commas between elements
syn match jsonMissingCommaError /\("\|\]\|\d\)\zs\_s\+\ze"/ syn match jsonMissingCommaError /\("\|\]\|\d\)\zs\_s\+\ze"/
syn match jsonMissingCommaError /\(\]\|\}\)\_s\+\ze"/ "arrays/objects as values syn match jsonMissingCommaError /\(\]\|\}\)\_s\+\ze"/ "arrays/objects as values
syn match jsonMissingCommaError /}\_s\+\ze{/ "objects as elements in an array if (expand('%:e') !=? 'jsonl')
syn match jsonMissingCommaError /\(true\|false\)\_s\+\ze"/ "true/false as value syn match jsonMissingCommaError /}\_s\+\ze{/ "objects as elements in an array
endif
syn match jsonMissingCommaError /\(true\|false\)\_s\+\ze"/ "true/false as value
endif endif
" ********************************************** END OF ERROR WARNINGS " ********************************************** END OF ERROR WARNINGS

View File

@@ -112,13 +112,13 @@ else
endif endif
syntax cluster juliaTypesItemsAll contains=juliaBaseTypeBasic,juliaBaseTypeNum,juliaBaseTypeC,juliaBaseTypeError,juliaBaseTypeIter,juliaBaseTypeString,juliaBaseTypeArray,juliaBaseTypeDict,juliaBaseTypeSet,juliaBaseTypeIO,juliaBaseTypeProcess,juliaBaseTypeRange,juliaBaseTypeRegex,juliaBaseTypeFact,juliaBaseTypeFact,juliaBaseTypeSort,juliaBaseTypeRound,juliaBaseTypeSpecial,juliaBaseTypeRandom,juliaBaseTypeDisplay,juliaBaseTypeTime,juliaBaseTypeOther syntax cluster juliaTypesItemsAll contains=juliaBaseTypeBasic,juliaBaseTypeNum,juliaBaseTypeC,juliaBaseTypeError,juliaBaseTypeIter,juliaBaseTypeString,juliaBaseTypeArray,juliaBaseTypeDict,juliaBaseTypeSet,juliaBaseTypeIO,juliaBaseTypeProcess,juliaBaseTypeRange,juliaBaseTypeRegex,juliaBaseTypeFact,juliaBaseTypeFact,juliaBaseTypeSort,juliaBaseTypeRound,juliaBaseTypeSpecial,juliaBaseTypeRandom,juliaBaseTypeDisplay,juliaBaseTypeTime,juliaBaseTypeOther
syntax cluster juliaTypesItems05 contains=juliaBaseTypeIter05,juliaBaseTypeRange05 syntax cluster juliaTypesItems05 contains=juliaBaseTypeIter05,juliaBaseTypeRange05
syntax cluster juliaTypesItems0506 contains=juliaBaseTypeRange0506,juliaBaseTypeSet0506 syntax cluster juliaTypesItems0506 contains=juliaBaseTypeNum0506,juliaBaseTypeRange0506,juliaBaseTypeSet0506
syntax cluster juliaTypesItems0607 contains=juliaBaseTypeBasic0607,juliaBaseTypeArray0607,juliaBaseTypeSet0607,juliaBaseTypeProcess0607,juliaBaseTypeRange0607,juliaBaseTypeTime0607 syntax cluster juliaTypesItems0607 contains=juliaBaseTypeBasic0607,juliaBaseTypeArray0607,juliaBaseTypeSet0607,juliaBaseTypeProcess0607,juliaBaseTypeRange0607,juliaBaseTypeTime0607
syntax cluster juliaTypesItems07 contains=juliaBaseTypeRange07,juliaBaseTypeSet07 syntax cluster juliaTypesItems07 contains=juliaBaseTypeBasic07,juliaBaseTypeNum07,juliaBaseTypeError07,juliaBaseTypeIter07,juliaBaseTypeRange07,juliaBaseTypeArray07,juliaBaseTypeSet07,juliaBaseTypeC07,juliaBaseTypeDisplay07,juliaBaseTypeIO07
syntax cluster juliaConstItemsAll contains=juliaConstNum,juliaConstBool,juliaConstEnv,juliaConstIO,juliaConstMMap,juliaConstC,juliaConstGeneric syntax cluster juliaConstItemsAll contains=juliaConstNum,juliaConstBool,juliaConstEnv,juliaConstIO,juliaConstMMap,juliaConstC,juliaConstGeneric
syntax cluster juliaConstItems0506 contains=juliaConstNum0506 syntax cluster juliaConstItems0506 contains=juliaConstNum0506
syntax cluster juliaConstItems07 contains=juliaPossibleEuler syntax cluster juliaConstItems07 contains=juliaConstGeneric07,juliaPossibleEuler
if b:julia_syntax_version <= 6 if b:julia_syntax_version <= 6
syntax cluster juliaConstItems contains=@juliaConstItemsAll,@juliaConstItems0506 syntax cluster juliaConstItems contains=@juliaConstItemsAll,@juliaConstItems0506
else else
@@ -208,20 +208,28 @@ exec 'syntax match juliaOuter contained "\<outer\ze\s\+' . s:idregex . '\>"
syntax match juliaBaseTypeBasic display "\<\%(Tuple\|NTuple\|Symbol\|\%(Intrinsic\)\?Function\|Union\|Type\%(Name\|Constructor\|Var\)\?\|Any\|ANY\|Vararg\|Top\|None\|Nothing\|Ptr\|Void\|Exception\|Module\|Box\|Expr\|LambdaStaticData\|\%(Data\|Union\)Type\|\%(LineNumber\|Label\|Goto\|Quote\|Top\|Symbol\|Getfield\)Node\|\%(Weak\|Global\)\?Ref\|Associative\|Method\(Table\)\?\|GetfieldNode\|Nullable\|Pair\|Val\|TypeMap\%(Level\|Entry\)\)\>" syntax match juliaBaseTypeBasic display "\<\%(Tuple\|NTuple\|Symbol\|\%(Intrinsic\)\?Function\|Union\|Type\%(Name\|Constructor\|Var\)\?\|Any\|ANY\|Vararg\|Top\|None\|Nothing\|Ptr\|Void\|Exception\|Module\|Box\|Expr\|LambdaStaticData\|\%(Data\|Union\)Type\|\%(LineNumber\|Label\|Goto\|Quote\|Top\|Symbol\|Getfield\)Node\|\%(Weak\|Global\)\?Ref\|Associative\|Method\(Table\)\?\|GetfieldNode\|Nullable\|Pair\|Val\|TypeMap\%(Level\|Entry\)\)\>"
syntax match juliaBaseTypeBasic0607 display "\<\%(UnionAll\|CodeInfo\)\>" syntax match juliaBaseTypeBasic0607 display "\<\%(UnionAll\|CodeInfo\)\>"
syntax match juliaBaseTypeNum display "\<\%(U\?Int\%(8\|16\|32\|64\|128\)\?\|Float\%(16\|32\|64\)\|Complex\%(32\|64\|128\)\?\|Bool\|Char\|Number\|Signed\|Unsigned\|Integer\|AbstractFloat\|Real\|Rational\|Irrational\|Enum\|BigInt\|BigFloat\|MathConst\)\>" syntax match juliaBaseTypeBasic07 display "\<\%(Some\|Missing\)\>"
syntax match juliaBaseTypeNum display "\<\%(U\?Int\%(8\|16\|32\|64\|128\)\?\|Float\%(16\|32\|64\)\|Complex\|Bool\|Char\|Number\|Signed\|Unsigned\|Integer\|AbstractFloat\|Real\|Rational\|Irrational\|Enum\|BigInt\|BigFloat\|MathConst\)\>"
syntax match juliaBaseTypeNum0506 display "\<Complex\%(32\|64\|128\)\>"
syntax match juliaBaseTypeNum07 display "\<\%(AbstractIrrational\|ComplexF\%(16\|32\|64\)\)\>"
syntax match juliaBaseTypeC display "\<\%(FileOffset\|C\%(u\?\%(char\|short\|int\|long\(long\)\?\|w\?string\)\|float\|double\|\%(ptrdiff\|s\?size\|wchar\|off\|u\?intmax\)_t\)\)\>" syntax match juliaBaseTypeC display "\<\%(FileOffset\|C\%(u\?\%(char\|short\|int\|long\(long\)\?\|w\?string\)\|float\|double\|\%(ptrdiff\|s\?size\|wchar\|off\|u\?intmax\)_t\)\)\>"
syntax match juliaBaseTypeC07 display "\<Cvoid\>"
syntax match juliaBaseTypeError display "\<\%(\%(Bounds\|Divide\|Domain\|\%(Stack\)\?Overflow\|EOF\|Undef\%(Ref\|Var\)\|System\|Type\|Parse\|Argument\|Key\|Load\|Method\|Inexact\|OutOfMemory\|Init\|Assertion\|Unicode\|ReadOnlyMemory\)Error\|\%(Interrupt\|Error\|ProcessExited\|Captured\|Composite\|InvalidState\|Null\|Remote\)Exception\|DimensionMismatch\|SegmentationFault\)\>" syntax match juliaBaseTypeError display "\<\%(\%(Bounds\|Divide\|Domain\|\%(Stack\)\?Overflow\|EOF\|Undef\%(Ref\|Var\)\|System\|Type\|Parse\|Argument\|Key\|Load\|Method\|Inexact\|OutOfMemory\|Init\|Assertion\|Unicode\|ReadOnlyMemory\)Error\|\%(Interrupt\|Error\|ProcessExited\|Captured\|Composite\|InvalidState\|Null\|Remote\)Exception\|DimensionMismatch\|SegmentationFault\)\>"
syntax match juliaBaseTypeError07 display "\<\%(StringIndexError\|MissingException\)\>"
syntax match juliaBaseTypeIter display "\<\%(EachLine\|Enumerate\|Cartesian\%(Index\|Range\)\|LinSpace\)\>" syntax match juliaBaseTypeIter display "\<\%(EachLine\|Enumerate\|Cartesian\%(Index\|Range\)\|LinSpace\)\>"
syntax match juliaBaseTypeIter05 display "\<\%(Zip\|Filter\)\>" syntax match juliaBaseTypeIter05 display "\<\%(Zip\|Filter\)\>"
syntax match juliaBaseTypeIter07 display "\<CartesianIndices\>"
syntax match juliaBaseTypeString display "\<\%(DirectIndex\|Sub\|Rep\|Rev\|Abstract\)\?String\>" syntax match juliaBaseTypeString display "\<\%(DirectIndex\|Sub\|Rep\|Rev\|Abstract\)\?String\>"
syntax match juliaBaseTypeArray display "\<\%(\%(Sub\)\?Array\|\%(Abstract\|Dense\|Strided\)\?\%(Array\|Matrix\|Vec\%(tor\|OrMat\)\)\|SparseMatrixCSC\|\%(AbstractSparse\|Bit\|Shared\)\%(Array\|Vector\|Matrix\)\|\%\(D\|Bid\|\%(Sym\)\?Trid\)iagonal\|Hermitian\|Symmetric\|UniformScaling\|\%(Lower\|Upper\)Triangular\|SparseVector\|VecElement\)\>" syntax match juliaBaseTypeArray display "\<\%(\%(Sub\)\?Array\|\%(Abstract\|Dense\|Strided\)\?\%(Array\|Matrix\|Vec\%(tor\|OrMat\)\)\|SparseMatrixCSC\|\%(AbstractSparse\|Bit\|Shared\)\%(Array\|Vector\|Matrix\)\|\%\(D\|Bid\|\%(Sym\)\?Trid\)iagonal\|Hermitian\|Symmetric\|UniformScaling\|\%(Lower\|Upper\)Triangular\|SparseVector\|VecElement\)\>"
syntax match juliaBaseTypeArray0607 display "\<\%(Conj\%(Array\|Matrix\|Vector\)\|Index\%(Cartesian\|Linear\|Style\)\|PermutedDimsArray\|RowVector\)\>" syntax match juliaBaseTypeArray0607 display "\<\%(Conj\%(Array\|Matrix\|Vector\)\|Index\%(Cartesian\|Linear\|Style\)\|PermutedDimsArray\|RowVector\)\>"
syntax match juliaBaseTypeArray07 display "\<\%(BroadcastStyle\|Adjoint\|Transpose\|LinearIndices\)\>"
syntax match juliaBaseTypeDict display "\<\%(WeakKey\|ObjectId\)\?Dict\>" syntax match juliaBaseTypeDict display "\<\%(WeakKey\|ObjectId\)\?Dict\>"
syntax match juliaBaseTypeSet display "\<Set\>" syntax match juliaBaseTypeSet display "\<Set\>"
syntax match juliaBaseTypeSet0506 display "\<IntSet\>" syntax match juliaBaseTypeSet0506 display "\<IntSet\>"
syntax match juliaBaseTypeSet0607 display "\<AbstractSet\>" syntax match juliaBaseTypeSet0607 display "\<AbstractSet\>"
syntax match juliaBaseTypeSet07 display "\<BitSet\>" 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 juliaBaseTypeProcess display "\<\%(ProcessGroup\|Pipe\|Cmd\)\>"
syntax match juliaBaseTypeProcess0607 display "\<PipeBuffer\>" syntax match juliaBaseTypeProcess0607 display "\<PipeBuffer\>"
syntax match juliaBaseTypeRange display "\<\%(Dims\|RangeIndex\|\%(Ordinal\|Step\|\%(Abstract\)\?Unit\)Range\|Colon\)\>" syntax match juliaBaseTypeRange display "\<\%(Dims\|RangeIndex\|\%(Ordinal\|Step\|\%(Abstract\)\?Unit\)Range\|Colon\)\>"
@@ -236,6 +244,7 @@ syntax match juliaBaseTypeRound display "\<Round\%(ingMode\|FromZero\|Down\|Ne
syntax match juliaBaseTypeSpecial display "\<\%(LocalProcess\|ClusterManager\)\>" syntax match juliaBaseTypeSpecial display "\<\%(LocalProcess\|ClusterManager\)\>"
syntax match juliaBaseTypeRandom display "\<\%(AbstractRNG\|MersenneTwister\|RandomDevice\)\>" syntax match juliaBaseTypeRandom display "\<\%(AbstractRNG\|MersenneTwister\|RandomDevice\)\>"
syntax match juliaBaseTypeDisplay display "\<\%(Text\(Display\)\?\|Display\|MIME\|HTML\)\>" syntax match juliaBaseTypeDisplay display "\<\%(Text\(Display\)\?\|Display\|MIME\|HTML\)\>"
syntax match juliaBaseTypeDisplay07 display "\<AbstractDisplay\>"
syntax match juliaBaseTypeTime display "\<\%(Date\%(Time\)\?\)\>" syntax match juliaBaseTypeTime display "\<\%(Date\%(Time\)\?\)\>"
syntax match juliaBaseTypeTime0607 display "\<DateFormat\>" syntax match juliaBaseTypeTime0607 display "\<DateFormat\>"
syntax match juliaBaseTypeOther display "\<\%(RemoteRef\|Task\|Condition\|VersionNumber\|IPv[46]\|SerializationState\|WorkerConfig\|Future\|RemoteChannel\|IPAddr\|Stack\%(Trace\|Frame\)\|\(Caching\|Worker\)Pool\|AbstractSerializer\)\>" syntax match juliaBaseTypeOther display "\<\%(RemoteRef\|Task\|Condition\|VersionNumber\|IPv[46]\|SerializationState\|WorkerConfig\|Future\|RemoteChannel\|IPAddr\|Stack\%(Trace\|Frame\)\|\(Caching\|Worker\)Pool\|AbstractSerializer\)\>"
@@ -251,9 +260,10 @@ 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 . '\)"' 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 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 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 juliaConstC display "\<\%(WORD_SIZE\|C_NULL\)\>"
syntax match juliaConstGeneric display "\<\%(nothing\|Main\)\>" syntax match juliaConstGeneric display "\<\%(nothing\|Main\)\>"
syntax match juliaConstGeneric07 display "\<missing\>"
syntax match juliaPossibleMacro transparent "@" contains=juliaMacroCall,juliaMacroCallP,juliaPrintfMacro syntax match juliaPossibleMacro transparent "@" contains=juliaMacroCall,juliaMacroCallP,juliaPrintfMacro
@@ -442,11 +452,11 @@ for t in ["Iter", "Range"]
let h = b:julia_syntax_version == 5 ? "Type" : b:julia_syntax_version == 6 ? "juliaDeprecated" : "NONE" let h = b:julia_syntax_version == 5 ? "Type" : b:julia_syntax_version == 6 ? "juliaDeprecated" : "NONE"
exec "hi! def link juliaBaseType" . t . "05 " . h exec "hi! def link juliaBaseType" . t . "05 " . h
endfor endfor
for t in ["Range", "Set"] for t in ["Num", "Range", "Set"]
let h = b:julia_syntax_version <= 6 ? "Type" : "juliaDeprecated" let h = b:julia_syntax_version <= 6 ? "Type" : "juliaDeprecated"
exec "hi! def link juliaBaseType" . t . "0506 " . h exec "hi! def link juliaBaseType" . t . "0506 " . h
endfor endfor
for t in ["Range", "Set"] for t in ["Range", "Set", "Basic", "C", "Array", "Iter", "Display", "IO", "Num", "Error"]
let h = b:julia_syntax_version >= 7 ? "Type" : "NONE" let h = b:julia_syntax_version >= 7 ? "Type" : "NONE"
exec "hi! def link juliaBaseType" . t . "07 " . h exec "hi! def link juliaBaseType" . t . "07 " . h
endfor endfor
@@ -469,6 +479,9 @@ hi def link juliaConstGeneric Constant
hi def link juliaRangeEnd Constant hi def link juliaRangeEnd Constant
hi def link juliaConstBool Boolean hi def link juliaConstBool Boolean
let h = b:julia_syntax_version >= 7 ? "Constant" : "NONE"
exec "hi! def link juliaConstGeneric07 " . h
hi def link juliaComprehensionFor Keyword hi def link juliaComprehensionFor Keyword
hi def link juliaComprehensionIf Keyword hi def link juliaComprehensionIf Keyword

View File

@@ -66,7 +66,7 @@ syntax match plantumlHorizontalArrow /\%([-\.]\%(|>\|>\|\*\|o\>\|\\\\\|\\\|\/\/\
syntax match plantumlDirectedOrVerticalArrowLR /[-\.]\%(le\?f\?t\?\|ri\?g\?h\?t\?\|up\?\|do\?w\?n\?\)\?[-\.]\%(|>\|>>\|>\|\*\|o\>\|\\\\\|\\\|\/\/\|\/\|\.\|-\)\%(\[[^\]]*\]\)\?/ contains=plantumlLabel syntax match plantumlDirectedOrVerticalArrowLR /[-\.]\%(le\?f\?t\?\|ri\?g\?h\?t\?\|up\?\|do\?w\?n\?\)\?[-\.]\%(|>\|>>\|>\|\*\|o\>\|\\\\\|\\\|\/\/\|\/\|\.\|-\)\%(\[[^\]]*\]\)\?/ contains=plantumlLabel
syntax match plantumlDirectedOrVerticalArrowRL /\%(<|\|<<\|<\|\*\|\<o\|\\\\\|\\\|\/\/\|\/\)[-\.]\%(le\?f\?t\?\|ri\?g\?h\?t\?\|up\?\|do\?w\?n\?\)\?[-\.]\%(\[[^\]]*\]\)\?/ contains=plantumlLabel syntax match plantumlDirectedOrVerticalArrowRL /\%(<|\|<<\|<\|\*\|\<o\|\\\\\|\\\|\/\/\|\/\)[-\.]\%(le\?f\?t\?\|ri\?g\?h\?t\?\|up\?\|do\?w\?n\?\)\?[-\.]\%(\[[^\]]*\]\)\?/ contains=plantumlLabel
syntax region plantumlLabel start=/\[/ms=s+1 end=/\]/me=s-1 contained contains=plantumlText syntax region plantumlLabel start=/\[/ms=s+1 end=/\]/me=s-1 contained contains=plantumlText
syntax match plantumlText /\%([0-9A-Za-zÀ-ÿ]\|\s\|[\.,;_-]\)\+/ contained syntax match plantumlText /\%([0-9A-Za-z\0xc0-\0xff]\|\s\|[\.,;_-]\)\+/ contained
" Note " Note
syntax region plantumlNoteMultiLine start=/\%(^\s*[rh]\?note\)\@<=\s\%([^:"]\+$\)\@=/ end=/^\%(\s*end \?[rh]\?note$\)\@=/ contains=plantumlSpecialString,plantumlNoteMultiLineStart syntax region plantumlNoteMultiLine start=/\%(^\s*[rh]\?note\)\@<=\s\%([^:"]\+$\)\@=/ end=/^\%(\s*end \?[rh]\?note$\)\@=/ contains=plantumlSpecialString,plantumlNoteMultiLineStart

View File

@@ -3,7 +3,6 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'swift') == -1
" File: swift.vim " File: swift.vim
" Author: Keith Smiley " Author: Keith Smiley
" Description: Runtime files for Swift " Description: Runtime files for Swift
" Last Modified: June 15, 2014
if exists("b:current_syntax") if exists("b:current_syntax")
finish finish
@@ -242,6 +241,8 @@ syntax keyword swiftPreprocessor
\ #else \ #else
\ #endif \ #endif
\ #selector \ #selector
\ #warning
\ #error
" Comment patterns " Comment patterns

View File

@@ -9,14 +9,25 @@ endif
syn case match 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 syn keyword terraValueBool true false on off yes no
""" data """ data
syn keyword terraDataTypeBI syn keyword terraDataTypeBI
\ alicloud_dns_domain_groups
\ alicloud_dns_domain_records
\ alicloud_dns_domains
\ alicloud_dns_groups
\ alicloud_dns_records
\ alicloud_images \ alicloud_images
\ alicloud_instance_types \ alicloud_instance_types
\ alicloud_key_pairs \ alicloud_key_pairs
\ alicloud_ram_account_alias
\ alicloud_ram_account_aliases
\ alicloud_ram_groups
\ alicloud_ram_policies
\ alicloud_ram_roles
\ alicloud_ram_users
\ alicloud_regions \ alicloud_regions
\ alicloud_vpcs \ alicloud_vpcs
\ alicloud_zones \ alicloud_zones
@@ -52,6 +63,7 @@ syn keyword terraDataTypeBI
\ aws_elastic_beanstalk_solution_stack \ aws_elastic_beanstalk_solution_stack
\ aws_elasticache_cluster \ aws_elasticache_cluster
\ aws_elasticache_replication_group \ aws_elasticache_replication_group
\ aws_elb
\ aws_elb_hosted_zone_id \ aws_elb_hosted_zone_id
\ aws_elb_service_account \ aws_elb_service_account
\ aws_iam_account_alias \ aws_iam_account_alias
@@ -73,6 +85,7 @@ syn keyword terraDataTypeBI
\ aws_lb_listener \ aws_lb_listener
\ aws_lb_target_group \ aws_lb_target_group
\ aws_nat_gateway \ aws_nat_gateway
\ aws_network_interface
\ aws_partition \ aws_partition
\ aws_prefix_list \ aws_prefix_list
\ aws_rds_cluster \ aws_rds_cluster
@@ -97,6 +110,7 @@ syn keyword terraDataTypeBI
\ azurerm_image \ azurerm_image
\ azurerm_key_vault_access_policy \ azurerm_key_vault_access_policy
\ azurerm_managed_disk \ azurerm_managed_disk
\ azurerm_network_security_group
\ azurerm_platform_image \ azurerm_platform_image
\ azurerm_public_ip \ azurerm_public_ip
\ azurerm_resource_group \ azurerm_resource_group
@@ -104,6 +118,7 @@ syn keyword terraDataTypeBI
\ azurerm_snapshot \ azurerm_snapshot
\ azurerm_subnet \ azurerm_subnet
\ azurerm_subscription \ azurerm_subscription
\ azurerm_virtual_network
\ circonus_account \ circonus_account
\ circonus_collector \ circonus_collector
\ cloudstack_template \ cloudstack_template
@@ -124,21 +139,28 @@ syn keyword terraDataTypeBI
\ github_team \ github_team
\ github_user \ github_user
\ google_active_folder \ google_active_folder
\ google_billing_account
\ google_client_config \ google_client_config
\ google_compute_address \ google_compute_address
\ google_compute_global_address \ google_compute_global_address
\ google_compute_image
\ google_compute_instance_group \ google_compute_instance_group
\ google_compute_lb_ip_ranges \ google_compute_lb_ip_ranges
\ google_compute_network \ google_compute_network
\ google_compute_region_instance_group
\ google_compute_subnetwork \ google_compute_subnetwork
\ google_compute_zones \ google_compute_zones
\ google_container_cluster
\ google_container_engine_versions \ google_container_engine_versions
\ google_dns_managed_zone \ google_dns_managed_zone
\ google_iam_policy \ google_iam_policy
\ google_kms_secret
\ google_organization
\ google_storage_object_signed_url \ google_storage_object_signed_url
\ http \ http
\ kubernetes_service \ kubernetes_service
\ kubernetes_storage_class \ kubernetes_storage_class
\ local_file
\ logicmonitor_collectors \ logicmonitor_collectors
\ logicmonitor_device_group \ logicmonitor_device_group
\ newrelic_application \ newrelic_application
@@ -154,6 +176,10 @@ syn keyword terraDataTypeBI
\ openstack_networking_network_v2 \ openstack_networking_network_v2
\ openstack_networking_secgroup_v2 \ openstack_networking_secgroup_v2
\ openstack_networking_subnet_v2 \ openstack_networking_subnet_v2
\ opentelekomcloud_images_image_v2
\ opentelekomcloud_networking_network_v2
\ opentelekomcloud_networking_secgroup_v2
\ opentelekomcloud_s3_bucket_object
\ opsgenie_user \ opsgenie_user
\ ovh_publiccloud_region \ ovh_publiccloud_region
\ ovh_publiccloud_regions \ ovh_publiccloud_regions
@@ -175,22 +201,33 @@ syn keyword terraDataTypeBI
\ template_cloudinit_config \ template_cloudinit_config
\ template_file \ template_file
\ terraform_remote_state \ terraform_remote_state
\ triton_account
\ triton_datacenter
\ triton_image \ triton_image
\ triton_network \ triton_network
\ vsphere_custom_attribute
\ vsphere_datacenter \ vsphere_datacenter
\ vsphere_datastore
\ vsphere_distributed_virtual_switch \ vsphere_distributed_virtual_switch
\ vsphere_host \ vsphere_host
\ vsphere_network \ vsphere_network
\ vsphere_resource_pool
\ vsphere_tag \ vsphere_tag
\ vsphere_tag_category \ vsphere_tag_category
\ vsphere_virtual_machine
\ vsphere_vmfs_disks \ vsphere_vmfs_disks
""" end data sources """ end data sources
""" resource """ resource
syn keyword terraResourceTypeBI syn keyword terraResourceTypeBI
\ alicloud_cdn_domain
\ alicloud_container_cluster
\ alicloud_db_instance \ alicloud_db_instance
\ alicloud_disk \ alicloud_disk
\ alicloud_disk_attachment \ alicloud_disk_attachment
\ alicloud_dns
\ alicloud_dns_group
\ alicloud_dns_record
\ alicloud_eip \ alicloud_eip
\ alicloud_eip_association \ alicloud_eip_association
\ alicloud_ess_scaling_configuration \ alicloud_ess_scaling_configuration
@@ -204,12 +241,26 @@ syn keyword terraResourceTypeBI
\ alicloud_nat_gateway \ alicloud_nat_gateway
\ alicloud_oss_bucket \ alicloud_oss_bucket
\ alicloud_oss_bucket_object \ alicloud_oss_bucket_object
\ alicloud_ram_access_key
\ alicloud_ram_account_alias
\ alicloud_ram_alias
\ alicloud_ram_group
\ alicloud_ram_group_membership
\ alicloud_ram_group_policy_attachment
\ alicloud_ram_login_profile
\ alicloud_ram_policy
\ alicloud_ram_role
\ alicloud_ram_role_attachment
\ alicloud_ram_role_policy_attachment
\ alicloud_ram_user
\ alicloud_ram_user_policy_attachment
\ alicloud_route_entry \ alicloud_route_entry
\ alicloud_router_interface \ alicloud_router_interface
\ alicloud_security_group \ alicloud_security_group
\ alicloud_security_group_rule \ alicloud_security_group_rule
\ alicloud_slb \ alicloud_slb
\ alicloud_slb_attachment \ alicloud_slb_attachment
\ alicloud_slb_listener
\ alicloud_snat_entry \ alicloud_snat_entry
\ alicloud_subnet \ alicloud_subnet
\ alicloud_vpc \ alicloud_vpc
@@ -247,6 +298,7 @@ syn keyword terraResourceTypeBI
\ aws_api_gateway_usage_plan_key \ aws_api_gateway_usage_plan_key
\ aws_app_cookie_stickiness_policy \ aws_app_cookie_stickiness_policy
\ aws_appautoscaling_policy \ aws_appautoscaling_policy
\ aws_appautoscaling_scheduled_action
\ aws_appautoscaling_target \ aws_appautoscaling_target
\ aws_athena_database \ aws_athena_database
\ aws_athena_named_query \ aws_athena_named_query
@@ -270,6 +322,7 @@ syn keyword terraResourceTypeBI
\ aws_cloudwatch_log_destination_policy \ aws_cloudwatch_log_destination_policy
\ aws_cloudwatch_log_group \ aws_cloudwatch_log_group
\ aws_cloudwatch_log_metric_filter \ aws_cloudwatch_log_metric_filter
\ aws_cloudwatch_log_resource_policy
\ aws_cloudwatch_log_stream \ aws_cloudwatch_log_stream
\ aws_cloudwatch_log_subscription_filter \ aws_cloudwatch_log_subscription_filter
\ aws_cloudwatch_metric_alarm \ aws_cloudwatch_metric_alarm
@@ -309,6 +362,7 @@ syn keyword terraResourceTypeBI
\ aws_dms_replication_subnet_group \ aws_dms_replication_subnet_group
\ aws_dms_replication_task \ aws_dms_replication_task
\ aws_dx_connection \ aws_dx_connection
\ aws_dx_connection_association
\ aws_dx_lag \ aws_dx_lag
\ aws_dynamodb_table \ aws_dynamodb_table
\ aws_ebs_snapshot \ aws_ebs_snapshot
@@ -398,6 +452,9 @@ syn keyword terraResourceTypeBI
\ aws_load_balancer_listener_policy \ aws_load_balancer_listener_policy
\ aws_load_balancer_policy \ aws_load_balancer_policy
\ aws_main_route_table_association \ aws_main_route_table_association
\ aws_media_store_container
\ aws_mq_broker
\ aws_mq_configuration
\ aws_nat_gateway \ aws_nat_gateway
\ aws_network_acl \ aws_network_acl
\ aws_network_acl_rule \ aws_network_acl_rule
@@ -443,6 +500,8 @@ syn keyword terraResourceTypeBI
\ aws_s3_bucket_policy \ aws_s3_bucket_policy
\ aws_security_group \ aws_security_group
\ aws_security_group_rule \ aws_security_group_rule
\ aws_service_discovery_private_dns_namespace
\ aws_service_discovery_public_dns_namespace
\ aws_servicecatalog_portfolio \ aws_servicecatalog_portfolio
\ aws_ses_active_receipt_rule_set \ aws_ses_active_receipt_rule_set
\ aws_ses_configuration_set \ aws_ses_configuration_set
@@ -559,6 +618,7 @@ syn keyword terraResourceTypeBI
\ azurerm_local_network_gateway \ azurerm_local_network_gateway
\ azurerm_log_analytics_workspace \ azurerm_log_analytics_workspace
\ azurerm_managed_disk \ azurerm_managed_disk
\ azurerm_management_lock
\ azurerm_mysql_configuration \ azurerm_mysql_configuration
\ azurerm_mysql_database \ azurerm_mysql_database
\ azurerm_mysql_firewall_rule \ azurerm_mysql_firewall_rule
@@ -566,6 +626,7 @@ syn keyword terraResourceTypeBI
\ azurerm_network_interface \ azurerm_network_interface
\ azurerm_network_security_group \ azurerm_network_security_group
\ azurerm_network_security_rule \ azurerm_network_security_rule
\ azurerm_network_watcher
\ azurerm_postgresql_configuration \ azurerm_postgresql_configuration
\ azurerm_postgresql_database \ azurerm_postgresql_database
\ azurerm_postgresql_firewall_rule \ azurerm_postgresql_firewall_rule
@@ -758,10 +819,11 @@ syn keyword terraResourceTypeBI
\ google_container_cluster \ google_container_cluster
\ google_container_node_pool \ google_container_node_pool
\ google_dataproc_cluster \ google_dataproc_cluster
\ google_dataproc_job
\ google_dns_managed_zone \ google_dns_managed_zone
\ google_dns_record_set \ google_dns_record_set
\ google_folder \ google_folder
\ google_folder_iam_policy \ google_folder_organization_policy
\ google_kms_crypto_key \ google_kms_crypto_key
\ google_kms_key_ring \ google_kms_key_ring
\ google_logging_billing_account_sink \ google_logging_billing_account_sink
@@ -770,9 +832,7 @@ syn keyword terraResourceTypeBI
\ google_organization_iam_custom_role \ google_organization_iam_custom_role
\ google_organization_policy \ google_organization_policy
\ google_project \ google_project
\ google_project_iam_binding
\ google_project_iam_custom_role \ google_project_iam_custom_role
\ google_project_iam_member
\ google_project_iam_policy \ google_project_iam_policy
\ google_project_service \ google_project_service
\ google_project_services \ google_project_services
@@ -874,6 +934,7 @@ syn keyword terraResourceTypeBI
\ opc_compute_ip_network \ opc_compute_ip_network
\ opc_compute_ip_network_exchange \ opc_compute_ip_network_exchange
\ opc_compute_ip_reservation \ opc_compute_ip_reservation
\ opc_compute_orchestrated_instance
\ opc_compute_route \ opc_compute_route
\ opc_compute_sec_rule \ opc_compute_sec_rule
\ opc_compute_security_application \ opc_compute_security_application
@@ -887,7 +948,6 @@ syn keyword terraResourceTypeBI
\ opc_compute_storage_volume \ opc_compute_storage_volume
\ opc_compute_storage_volume_snapshot \ opc_compute_storage_volume_snapshot
\ opc_compute_vnic_set \ opc_compute_vnic_set
\ opc_database_service_instance
\ opc_storage_container \ opc_storage_container
\ opc_storage_object \ opc_storage_object
\ openstack_blockstorage_volume_attach_v2 \ openstack_blockstorage_volume_attach_v2
@@ -901,6 +961,8 @@ syn keyword terraResourceTypeBI
\ openstack_compute_secgroup_v2 \ openstack_compute_secgroup_v2
\ openstack_compute_servergroup_v2 \ openstack_compute_servergroup_v2
\ openstack_compute_volume_attach_v2 \ openstack_compute_volume_attach_v2
\ openstack_db_database_v1
\ openstack_db_instance_v1
\ openstack_dns_recordset_v2 \ openstack_dns_recordset_v2
\ openstack_dns_zone_v2 \ openstack_dns_zone_v2
\ openstack_fw_firewall_v1 \ openstack_fw_firewall_v1
@@ -929,8 +991,47 @@ syn keyword terraResourceTypeBI
\ openstack_networking_subnet_v2 \ openstack_networking_subnet_v2
\ openstack_objectstorage_container_v1 \ openstack_objectstorage_container_v1
\ openstack_objectstorage_object_v1 \ openstack_objectstorage_object_v1
\ opentelekomcloud_blockstorage_volume_v2
\ opentelekomcloud_ces_alarmrule
\ opentelekomcloud_compute_floatingip_associate_v2
\ opentelekomcloud_compute_floatingip_v2
\ opentelekomcloud_compute_instance_v2
\ opentelekomcloud_compute_keypair_v2
\ opentelekomcloud_compute_secgroup_v2
\ opentelekomcloud_compute_servergroup_v2
\ opentelekomcloud_compute_volume_attach_v2
\ opentelekomcloud_dns_recordset_v2
\ opentelekomcloud_dns_zone_v2
\ opentelekomcloud_elb_backend
\ opentelekomcloud_elb_health
\ opentelekomcloud_elb_listener
\ opentelekomcloud_elb_loadbalancer
\ opentelekomcloud_fw_firewall_group_v2
\ opentelekomcloud_fw_policy_v2
\ opentelekomcloud_fw_rule_v2
\ opentelekomcloud_images_image_v2
\ opentelekomcloud_lb_listener_v2
\ opentelekomcloud_lb_loadbalancer_v2
\ opentelekomcloud_lb_member_v2
\ opentelekomcloud_lb_monitor_v2
\ opentelekomcloud_lb_pool_v2
\ opentelekomcloud_networking_floatingip_v2
\ opentelekomcloud_networking_network_v2
\ opentelekomcloud_networking_port_v2
\ opentelekomcloud_networking_router_interface_v2
\ opentelekomcloud_networking_router_route_v2
\ opentelekomcloud_networking_router_v2
\ opentelekomcloud_networking_secgroup_rule_v2
\ opentelekomcloud_networking_secgroup_v2
\ opentelekomcloud_networking_subnet_v2
\ opentelekomcloud_s3_bucket
\ opentelekomcloud_s3_bucket_object
\ opentelekomcloud_s3_bucket_policy
\ opentelekomcloud_smn_subscription_v2
\ opentelekomcloud_smn_topic_v2
\ opsgenie_team \ opsgenie_team
\ opsgenie_user \ opsgenie_user
\ ovh_domain_zone_record
\ ovh_publiccloud_private_network \ ovh_publiccloud_private_network
\ ovh_publiccloud_private_network_subnet \ ovh_publiccloud_private_network_subnet
\ ovh_publiccloud_user \ ovh_publiccloud_user
@@ -984,6 +1085,7 @@ syn keyword terraResourceTypeBI
\ rancher_registry_credential \ rancher_registry_credential
\ rancher_secret \ rancher_secret
\ rancher_stack \ rancher_stack
\ rancher_volume
\ random_id \ random_id
\ random_integer \ random_integer
\ random_pet \ random_pet
@@ -1029,6 +1131,7 @@ syn keyword terraResourceTypeBI
\ vcd_snat \ vcd_snat
\ vcd_vapp \ vcd_vapp
\ vcd_vapp_vm \ vcd_vapp_vm
\ vsphere_custom_attribute
\ vsphere_datacenter \ vsphere_datacenter
\ vsphere_distributed_port_group \ vsphere_distributed_port_group
\ vsphere_distributed_virtual_switch \ vsphere_distributed_virtual_switch

View File

@@ -47,8 +47,8 @@ if !exists("typescript_ignore_typescriptdoc")
"unlet b:current_syntax "unlet b:current_syntax
syntax region typescriptDocComment start="/\*\*\s*$" end="\*/" contains=typescriptDocTags,typescriptCommentTodo,typescriptCvsTag,@typescriptHtml,@Spell fold extend 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 "@\(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\|returns\=\|constructor\|private\|protected\|final\|ignore\|addon\|exec\)\>" syntax match typescriptDocTags contained "@\(beta\|deprecated\|description\|fileoverview\|author\|license\|version\|constructor\|private\|protected\|final\|ignore\|addon\|exec\)\>"
syntax match typescriptDocParam contained "\%(#\|\w\|\.\|:\|\/\)\+" syntax match typescriptDocParam contained "\%(#\|\w\|\.\|:\|\/\)\+"
syntax region typescriptDocSeeTag contained matchgroup=typescriptDocSeeTag start="{" end="}" contains=typescriptDocTags syntax region typescriptDocSeeTag contained matchgroup=typescriptDocSeeTag start="{" end="}" contains=typescriptDocTags
@@ -67,14 +67,16 @@ syn region typescriptInterpolation matchgroup=typescriptInterpolationDelimiter
\ start=/${/ end=/}/ contained \ start=/${/ end=/}/ contained
\ contains=@typescriptExpression \ 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 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 match typescriptSpecial "\\\d\d\d\|\\x\x\{2\}\|\\u\x\{4\}\|\\."
" syntax region typescriptStringD start=+"+ skip=+\\\\\|\\$"+ end=+"+ contains=typescriptSpecial,@htmlPreproc " syntax region typescriptStringD start=+"+ skip=+\\\\\|\\$"+ end=+"+ contains=typescriptSpecial,@htmlPreproc
" syntax region typescriptStringS 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 region typescriptRegexpString start=+/\(\*\|/\)\@!+ skip=+\\\\\|\\/+ end=+/[gim]\{,3}+ contains=typescriptSpecial,@htmlPreproc oneline
" syntax match typescriptNumber /\<-\=\d\+L\=\>\|\<0[xX]\x\+\>/ " 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*:\)\@=/ " syntax match typescriptLabel /\(?\s*\)\@<!\<\w\+\(\s*:\)\@=/
syn match typescriptDecorators /@\([_$a-zA-Z][_$a-zA-Z0-9]*\.\)*[_$a-zA-Z][_$a-zA-Z0-9]*\>/ syn match typescriptDecorators /@\([_$a-zA-Z][_$a-zA-Z0-9]*\.\)*[_$a-zA-Z][_$a-zA-Z0-9]*\>/