diff options
Diffstat (limited to '')
-rw-r--r-- | after/syntax/cpp.vim | 2 | ||||
-rw-r--r-- | after/syntax/less.vim | 9 | ||||
-rw-r--r-- | after/syntax/scss.vim | 6 | ||||
-rw-r--r-- | autoload/css_color.vim | 60 | ||||
-rw-r--r-- | autoload/xml/html5.vim | 8 | ||||
-rw-r--r-- | compiler/cargo.vim | 46 | ||||
-rw-r--r-- | compiler/typescript.vim | 7 | ||||
-rw-r--r-- | ftplugin/csv.vim | 78 | ||||
-rw-r--r-- | ftplugin/eruby.vim | 2 | ||||
-rw-r--r-- | ftplugin/rust.vim | 7 | ||||
-rw-r--r-- | ftplugin/typescript.vim | 8 | ||||
-rw-r--r-- | indent/elixir.vim | 10 | ||||
-rw-r--r-- | indent/eruby.vim | 21 | ||||
-rw-r--r-- | indent/html.vim | 2 | ||||
-rw-r--r-- | indent/javascript.vim | 56 | ||||
-rw-r--r-- | indent/ruby.vim | 35 | ||||
-rw-r--r-- | syntax/csv.vim | 29 | ||||
-rw-r--r-- | syntax/elixir.vim | 5 | ||||
-rw-r--r-- | syntax/eruby.vim | 2 | ||||
-rw-r--r-- | syntax/go.vim | 12 | ||||
-rw-r--r-- | syntax/html.vim | 3 | ||||
-rw-r--r-- | syntax/javascript.vim | 49 | ||||
-rw-r--r-- | syntax/mustache.vim | 4 | ||||
-rw-r--r-- | syntax/rust.vim | 72 | ||||
-rw-r--r-- | syntax/typescript.vim | 4 |
25 files changed, 297 insertions, 240 deletions
diff --git a/after/syntax/cpp.vim b/after/syntax/cpp.vim index f286af08..4c9032b2 100644 --- a/after/syntax/cpp.vim +++ b/after/syntax/cpp.vim @@ -1312,6 +1312,8 @@ if !exists("cpp_no_cpp11") "raw string literals syntax region cppRawString matchgroup=cppRawDelimiter start=@\%(u8\|[uLU]\)\=R"\z([[:alnum:]_{}[\]#<>%:;.?*\+\-/\^&|~!=,"']\{,16}\)(@ end=/)\z1"/ contains=@Spell + + syn match cNumber "0b[01]\+" endif " C++11 if !exists("cpp_no_cpp14") diff --git a/after/syntax/less.vim b/after/syntax/less.vim index 7261d9eb..e3efbff4 100644 --- a/after/syntax/less.vim +++ b/after/syntax/less.vim @@ -3,4 +3,11 @@ if !( has('gui_running') || &t_Co==256 ) | finish | endif -call css_color#init('css', 'lessVariableValue,lessDefinition,lessComment') +" variable | property | multiline | end-of-line | plugin +" -----------------------+----------------+----------------+-------------+--------- +" lessCssAttribute | lessCssComment | lessComment | https://github.com/genoma/vim-less +" lessAttribute | lessCssComment | lessComment | https://github.com/KohPoll/vim-less +" lessVariableValue | lessDefinition | cssComment | lessComment | https://github.com/groenewege/vim-less +" lessVariableDefinition | cssDefinition | cssComment | lessComment | https://github.com/lunaru/vim-less + +call css_color#init('css', 'lessVariableValue,lessVariableDefinition,lessDefinition,lessCssAttribute,lessAttribute,cssDefinition,cssComment,lessCssComment,lessComment') diff --git a/after/syntax/scss.vim b/after/syntax/scss.vim new file mode 100644 index 00000000..30be7b40 --- /dev/null +++ b/after/syntax/scss.vim @@ -0,0 +1,6 @@ +" Language: Colorful CSS Color Preview +" Author: Aristotle Pagaltzis <pagaltzis@gmx.de> + +if !( has('gui_running') || &t_Co==256 ) | finish | endif + +call css_color#init('css', 'scssAttribute,scssComment,scssVariableValue,sassCssAttribute,cssComment') diff --git a/autoload/css_color.vim b/autoload/css_color.vim index 56a50157..4c02d720 100644 --- a/autoload/css_color.vim +++ b/autoload/css_color.vim @@ -1,8 +1,7 @@ " Language: Colorful CSS Color Preview " Author: Aristotle Pagaltzis <pagaltzis@gmx.de> -" Last Change: 2014-01-14 -" Licence: No Warranties. WTFPL. But please tell me! -" Version: 1.0 +" Commit: $Format:%H$ +" Licence: The MIT License (MIT) if v:version < 700 echoerr printf('Vim 7 is required for css-color (this is only %d.%d)',v:version/100,v:version%100) @@ -206,28 +205,34 @@ function! s:create_syn_match() return '' endfunction -function! s:update_matches() - call filter(b:color_match_id, 'matchdelete(v:val)') - if &l:cursorline - " adds matches based that duplicate the highlighted colors on the current line - let lnr = line('.') - let group = '' - let groupstart = 0 - let endcol = col('$') - for col in range( 1, endcol ) - let nextgroup = col < endcol ? synIDattr( synID( lnr, col, 1 ), 'name' ) : '' - if group == nextgroup | continue | endif - if group =~ '^BG\x\{6}$' - let regex = '\%'.lnr.'l\%'.groupstart.'c'.repeat( '.', col - groupstart ) - let match = matchadd( group, regex, -1 ) - let b:color_match_id += [ match ] - endif - let group = nextgroup - let groupstart = col - endfor +function! s:clear_matches() + if exists('w:color_match_id') + call filter(w:color_match_id, 'matchdelete(v:val)') + unlet w:color_match_id endif endfunction +function! s:create_matches() + if ! &l:cursorline | return | endif + " adds matches based that duplicate the highlighted colors on the current line + let lnr = line('.') + let group = '' + let groupstart = 0 + let endcol = col('$') + let w:color_match_id = [] + for col in range( 1, endcol ) + let nextgroup = col < endcol ? synIDattr( synID( lnr, col, 1 ), 'name' ) : '' + if group == nextgroup | continue | endif + if group =~ '^BG\x\{6}$' + let regex = '\%'.lnr.'l\%'.groupstart.'c'.repeat( '.', col - groupstart ) + let match = matchadd( group, regex, -1 ) + let w:color_match_id += [ match ] + endif + let group = nextgroup + let groupstart = col + endfor +endfunction + let s:_hexcolor = '#\(\x\{3}\|\x\{6}\)\>' " submatch 1 let s:_funcname = '\(rgb\|hsl\)a\?' " submatch 2 let s:_numval = '\(\d\{1,3}%\?\)' " submatch 3,4,5 @@ -242,11 +247,13 @@ let s:_csscolor = s:_hexcolor . '\|' . s:_funcexpr " scan without examining the start of the string over and over function! s:parse_css_screen() call substitute( join( getline('w0','w$'), "\n" ), s:_csscolor, '\=s:create_syn_match()', 'g' ) - call s:update_matches() + call s:clear_matches() + call s:create_matches() endfunction function! s:parse_any_screen() call substitute( join( getline('w0','w$'), "\n" ), s:_hexcolor, '\=s:create_syn_match()', 'g' ) - call s:update_matches() + call s:clear_matches() + call s:create_matches() endfunction """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -256,14 +263,15 @@ function! css_color#init(type, groups) let b:has_color_hi = {} let b:has_pattern_syn = {} - let b:color_match_id = [] augroup CSSColor autocmd! * <buffer> exe 'autocmd CursorMoved,CursorMovedI <buffer> call s:parse_'.a:type.'_screen()' + autocmd BufWinEnter <buffer> call s:create_matches() + autocmd BufWinLeave <buffer> call s:clear_matches() augroup END - do CSSColor CursorMoved <buffer> + exe 'call s:parse_'.a:type.'_screen()' if a:type != 'css' | return | endif diff --git a/autoload/xml/html5.vim b/autoload/xml/html5.vim index 4c99901a..67926f59 100644 --- a/autoload/xml/html5.vim +++ b/autoload/xml/html5.vim @@ -324,7 +324,7 @@ endif " Ref: http://dev.w3.org/html5/markup/ " Version: Draft 05 April 2011 -let phrasing_elements = ['a', 'em', 'strong', 'small', 'mark', 'abbr', 'dfn', 'i', 'b', 'u', 'code', 'var', 'samp', 'kbd', 'sup', 'sub', 'q', 'cite', 'span', 'bdo', 'bdi', 'br', 'wbr', 'ins', 'del', 'img', 'embed', 'object', 'iframe', 'map', 'area', 'script', 'noscript', 'ruby', 'video', 'audio', 'input', 'textarea', 'select', 'button', 'label', 'output', 'datalist', 'keygen', 'progress', 'command', 'canvas', 'time', 'meter', 'data', 'content', 'shadow'] +let phrasing_elements = ['a', 'em', 'strong', 'small', 'mark', 'abbr', 'dfn', 'i', 'b', 'u', 'code', 'var', 'samp', 'kbd', 'sup', 'sub', 'q', 'cite', 'span', 'bdo', 'bdi', 'br', 'wbr', 'ins', 'del', 'img', 'picture', 'embed', 'object', 'iframe', 'map', 'area', 'script', 'noscript', 'ruby', 'video', 'audio', 'input', 'textarea', 'select', 'button', 'label', 'output', 'datalist', 'keygen', 'progress', 'command', 'canvas', 'time', 'meter', 'data', 'content', 'shadow'] let metadata_elements = ['link', 'style', 'meta', 'script', 'noscript', 'command'] @@ -643,6 +643,10 @@ let g:xmldata_html5 = { \ [], \ extend(copy(global_attributes), {'name': [], 'value': []}) \ ], +\ 'picture': [ + \ flow_elements + ['source'], + \ global_attributes +\ ], \ 'pre': [ \ phrasing_elements, \ global_attributes @@ -693,7 +697,7 @@ let g:xmldata_html5 = { \ ], \ 'source': [ \ [], - \ extend(copy(global_attributes), {'src': [], 'type': [], 'media': []}) + \ extend(copy(global_attributes), {'src': [], 'type': [], 'media': [], 'srcset': [], 'sizes': []}) \ ], \ 'span': [ \ phrasing_elements, diff --git a/compiler/cargo.vim b/compiler/cargo.vim index 89c1cff1..ed487a30 100644 --- a/compiler/cargo.vim +++ b/compiler/cargo.vim @@ -1,29 +1,35 @@ " Vim compiler file " Compiler: Cargo Compiler " Maintainer: Damien Radtke <damienradtke@gmail.com> -" Latest Revision: 2014 Sep 18 +" Latest Revision: 2014 Sep 24 -if exists("current_compiler") +if exists('current_compiler') finish endif +runtime compiler/rustc.vim let current_compiler = "cargo" -if exists(":CompilerSet") != 2 +if exists(':CompilerSet') != 2 command -nargs=* CompilerSet setlocal <args> endif -CompilerSet errorformat& -CompilerSet makeprg=cargo\ $* +if exists('g:cargo_makeprg_params') + execute 'CompilerSet makeprg=cargo\ '.escape(g:cargo_makeprg_params, ' \|"').'\ $*' +else + CompilerSet makeprg=cargo\ $* +endif " Allow a configurable global Cargo.toml name. This makes it easy to " support variations like 'cargo.toml'. -if !exists('g:cargo_toml_name') - let g:cargo_toml_name = 'Cargo.toml' -endif +let s:cargo_manifest_name = get(g:, 'cargo_manifest_name', 'Cargo.toml') -let s:toml_dir = fnamemodify(findfile(g:cargo_toml_name, '.;'), ':p:h').'/' +function! s:is_absolute(path) + return a:path[0] == '/' || a:path =~ '[A-Z]\+:' +endfunction -if s:toml_dir != '' +let s:local_manifest = findfile(s:cargo_manifest_name, '.;') +if s:local_manifest != '' + let s:local_manifest = fnamemodify(s:local_manifest, ':p:h').'/' augroup cargo au! au QuickfixCmdPost make call s:FixPaths() @@ -33,15 +39,25 @@ if s:toml_dir != '' " to be relative to the current directory instead of Cargo.toml. function! s:FixPaths() let qflist = getqflist() + let manifest = s:local_manifest for qf in qflist - if !qf['valid'] + if !qf.valid + let m = matchlist(qf.text, '(file://\(.*\))$') + if !empty(m) + let manifest = m[1].'/' + " Manually strip another slash if needed; usually just an + " issue on Windows. + if manifest =~ '^/[A-Z]\+:/' + let manifest = manifest[1:] + endif + endif continue endif - let filename = bufname(qf['bufnr']) - if stridx(filename, s:toml_dir) == -1 - let filename = s:toml_dir.filename + let filename = bufname(qf.bufnr) + if s:is_absolute(filename) + continue endif - let qf['filename'] = simplify(s:toml_dir.bufname(qf['bufnr'])) + let qf.filename = simplify(manifest.filename) call remove(qf, 'bufnr') endfor call setqflist(qflist, 'r') diff --git a/compiler/typescript.vim b/compiler/typescript.vim index 74f79d11..e81ebd66 100644 --- a/compiler/typescript.vim +++ b/compiler/typescript.vim @@ -3,6 +3,11 @@ if exists("current_compiler") endif let current_compiler = "typescript" -CompilerSet makeprg=tsc\ $*\ % +if !exists("g:typescript_compiler_options") + let g:typescript_compiler_options = "" +endif + + +let &l:makeprg='tsc' . g:typescript_compiler_options . ' $* %' CompilerSet errorformat=%+A\ %#%f\ %#(%l\\\,%c):\ %m,%C%m diff --git a/ftplugin/csv.vim b/ftplugin/csv.vim index 19f649cc..7d15b812 100644 --- a/ftplugin/csv.vim +++ b/ftplugin/csv.vim @@ -11,6 +11,20 @@ " though, implementation differs. " Plugin folklore "{{{2 +fu! <sid>DetermineSID() + let s:SID = matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze_DetermineSID$') +endfu +call s:DetermineSID() +delf s:DetermineSID + +fu! CSVArrangeCol(first, last, bang, limit) range "{{{2 + if &ft =~? 'csv' + call <sid>ArrangeCol(a:first, a:last, a:bang, a:limit) + else + finish + endif +endfu + if v:version < 700 || exists('b:did_ftplugin') finish endif @@ -20,7 +34,6 @@ let s:cpo_save = &cpo set cpo&vim " Function definitions: "{{{2 -" " Script specific functions "{{{2 fu! <sid>Warn(mess) "{{{3 echohl WarningMsg @@ -239,35 +252,6 @@ fu! <sid>DoAutoCommands() "{{{3 let b:undo_ftplugin .= '| exe "sil! au! CSV_HI CursorMoved <buffer> "' let b:undo_ftplugin .= '| exe "sil! aug! CSV_HI" |exe "sil! HiColumn!"' - " Visually arrange columns when opening a csv file - if exists("g:csv_autocmd_arrange") && - \ !exists("#CSV_Edit#BufReadPost") - aug CSV_Edit - au! - au BufReadPost,BufWritePost *.csv,*.dat :sil %ArrangeColumn - au BufWritePre *.csv,*.dat :sil %UnArrangeColumn - aug end - elseif exists("#CSV_Edit#BufReadPost") - aug CSV_Edit - au! - aug end - aug! CSV_Edit - endif - " undo autocommand: - let b:undo_ftplugin .= '| exe "sil! au! CSV_Edit "' - let b:undo_ftplugin .= '| exe "sil! aug! CSV_Edit"' - -" if !exists("#CSV_ColorScheme#ColorScheme") -" " Make sure, syntax highlighting is applied -" " after changing the colorscheme -" augroup CSV_ColorScheme -" au! -" au ColorScheme *.csv,*.dat,*.tsv,*.tab do Syntax -" augroup end -" endif -" let b:undo_ftplugin .= '| exe "sil! au! CSV_ColorScheme "' -" let b:undo_ftplugin .= '| exe "sil! aug! CSV_ColorScheme"' - if has("gui_running") && !exists("#CSV_Menu#FileType") augroup CSV_Menu au! @@ -276,10 +260,6 @@ fu! <sid>DoAutoCommands() "{{{3 au BufLeave <buffer> call <sid>Menu(0) " disable au BufNewFile,BufNew * call <sid>Menu(0) augroup END - "let b:undo_ftplugin .= '| sil! amenu disable CSV' - " - " b:undo_ftplugin does not support calling <sid> Functions - "let b:undo_ftplugin .= '| sil! call <sid>Menu(0)' endif endfu @@ -348,11 +328,6 @@ fu! <sid>SearchColumn(arg) "{{{3 throw "E684" endif endif -" let colnr=arglist[0] -" let pat=substitute(arglist[1], '^\(.\)\(.*\)\1$', '\2', '') -" if pat == arglist[1] -" throw "E684" -" endif endif "catch /^Vim\%((\a\+)\)\=:E684/ catch /E684/ " catch error index out of bounds @@ -364,7 +339,7 @@ fu! <sid>SearchColumn(arg) "{{{3 call <SID>Warn("There exists no column " . colnr) return 1 endif - let @/ = <sid>GetPat(colnr, maxcolnr, pat) + let @/ = <sid>GetPat(colnr, maxcolnr, '\%('.pat. '\)') try norm! n catch /^Vim\%((\a\+)\)\=:E486/ @@ -643,7 +618,7 @@ fu! <sid>ColWidth(colnr) "{{{3 endif endfu -fu! <sid>ArrangeCol(first, last, bang) range "{{{3 +fu! <sid>ArrangeCol(first, last, bang, limit) range "{{{3 "TODO: Why doesn't that work? " is this because of the range flag? " It's because of the way, Vim works with @@ -655,11 +630,16 @@ fu! <sid>ArrangeCol(first, last, bang) range "{{{3 return endif let cur=winsaveview() - if a:bang || !exists("b:col_width") + if a:bang if a:bang " Force recalculating the Column width - unlet! b:csv_list + unlet! b:csv_list b:col_width endif + elseif a:limit > -1 && a:limit < getfsize(fnamemodify(bufname(''), ':p')) + return + endif + + if !exists("b:col_width") " Force recalculation of Column width call <sid>CalculateColumnWidth() endif @@ -895,7 +875,7 @@ fu! <sid>SplitHeaderLine(lines, bang, hor) "{{{3 syn clear noa 0 let b:csv_SplitWindow = winnr() - sil :call <sid>ArrangeCol(1,line('$'), 1) + sil :call <sid>ArrangeCol(1,line('$'), 1, -1) exe "vert res" . len(split(getline(1), '\zs')) call matchadd("CSVHeaderLine", b:col) setl scrollopt=ver winfixwidth @@ -1592,12 +1572,6 @@ fu! <sid>DisableFolding() "{{{3 endif endfu -fu! <sid>DetermineSID() - let s:SID = matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze_DetermineSID$') -endfu -call s:DetermineSID() -delf s:DetermineSID - fu! <sid>NumberFormat() "{{{3 let s:nr_format = [',', '.'] if exists("b:csv_thousands_sep") @@ -1892,7 +1866,7 @@ fu! <sid>CommandDefinitions() "{{{3 call <sid>LocalCmd("DeleteColumn", ':call <sid>DeleteColumn(<q-args>)', \ '-nargs=? -complete=custom,<sid>SortComplete') call <sid>LocalCmd("ArrangeColumn", - \ ':call <sid>ArrangeCol(<line1>, <line2>, <bang>0)', + \ ':call <sid>ArrangeCol(<line1>, <line2>, <bang>0, -1)', \ '-range -bang') call <sid>LocalCmd("UnArrangeColumn", \':call <sid>PrepUnArrangeCol(<line1>, <line2>)', @@ -2248,7 +2222,7 @@ fu! <sid>Tabularize(bang, first, last) "{{{3 else " don't clear column width variable, might have been set in the " plugin! - sil call <sid>ArrangeCol(a:first, a:last, 0) + sil call <sid>ArrangeCol(a:first, a:last, 0, -1) endif if empty(b:col_width) diff --git a/ftplugin/eruby.vim b/ftplugin/eruby.vim index 9bb8e86f..32f3fb86 100644 --- a/ftplugin/eruby.vim +++ b/ftplugin/eruby.vim @@ -27,7 +27,7 @@ elseif !exists("b:eruby_subtype") let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$") let b:eruby_subtype = matchstr(s:lines,'eruby_subtype=\zs\w\+') if b:eruby_subtype == '' - let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\|\.erubis\)\+$','',''),'\.\zs\w\+$') + let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\|\.erubis\)\+$','',''),'\.\zs\w\+\%(\ze+\w\+\)\=$') endif if b:eruby_subtype == 'rhtml' let b:eruby_subtype = 'html' diff --git a/ftplugin/rust.vim b/ftplugin/rust.vim index 09eaf62d..5d556994 100644 --- a/ftplugin/rust.vim +++ b/ftplugin/rust.vim @@ -35,9 +35,10 @@ silent! setlocal formatoptions+=j " otherwise it's better than nothing. setlocal smartindent nocindent -setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab - -setlocal textwidth=99 +if !exists("g:rust_recommended_style") || g:rust_recommended_style == 1 + setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab + setlocal textwidth=99 +endif " This includeexpr isn't perfect, but it's a good start setlocal includeexpr=substitute(v:fname,'::','/','g') diff --git a/ftplugin/typescript.vim b/ftplugin/typescript.vim index e4e39b60..9e98e790 100644 --- a/ftplugin/typescript.vim +++ b/ftplugin/typescript.vim @@ -1,10 +1,2 @@ compiler typescript - -setlocal autoindent -setlocal smartindent -setlocal indentexpr& - -setlocal cindent -setlocal cino=j1J1 - setlocal commentstring=//\ %s diff --git a/indent/elixir.vim b/indent/elixir.vim index 3563f44a..92b98460 100644 --- a/indent/elixir.vim +++ b/indent/elixir.vim @@ -12,7 +12,6 @@ setlocal nosmartindent setlocal indentexpr=GetElixirIndent() setlocal indentkeys+=0=end,0=else,0=match,0=elsif,0=catch,0=after,0=rescue -setlocal indentkeys+==-> if exists("*GetElixirIndent") finish @@ -69,9 +68,16 @@ function! GetElixirIndent() endif " if line starts with pipeline + " and last line contains pipeline(s) + " align them + if last_line =~ '|>.*$' && + \ current_line =~ s:pipeline + let ind = float2nr(match(last_line, '|>') / &sw) * &sw + + " if line starts with pipeline " and last line is an attribution " indents pipeline in same level as attribution - if current_line =~ s:pipeline && + elseif current_line =~ s:pipeline && \ last_line =~ '^[^=]\+=.\+$' let b:old_ind = ind let ind = float2nr(matchend(last_line, '=\s*[^ ]') / &sw) * &sw diff --git a/indent/eruby.vim b/indent/eruby.vim index 5f323857..5028fe06 100644 --- a/indent/eruby.vim +++ b/indent/eruby.vim @@ -42,6 +42,13 @@ if exists("*GetErubyIndent") endif function! GetErubyIndent(...) + " The value of a single shift-width + if exists('*shiftwidth') + let sw = shiftwidth() + else + let sw = &sw + endif + if a:0 && a:1 == '.' let v:lnum = line('.') elseif a:0 && a:1 =~ '^\d' @@ -70,24 +77,24 @@ function! GetErubyIndent(...) let line = getline(lnum) let cline = getline(v:lnum) if cline =~# '^\s*<%[-=]\=\s*\%(}\|end\|else\|\%(ensure\|rescue\|elsif\|when\).\{-\}\)\s*\%([-=]\=%>\|$\)' - let ind = ind - &sw + let ind = ind - sw endif if line =~# '\S\s*<%[-=]\=\s*\%(}\|end\).\{-\}\s*\%([-=]\=%>\|$\)' - let ind = ind - &sw + let ind = ind - sw endif if line =~# '\%({\|\<do\)\%(\s*|[^|]*|\)\=\s*[-=]\=%>' - let ind = ind + &sw + let ind = ind + sw elseif line =~# '<%[-=]\=\s*\%(module\|class\|def\|if\|for\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure\|rescue\)\>.*%>' - let ind = ind + &sw + let ind = ind + sw endif if line =~# '^\s*<%[=#-]\=\s*$' && cline !~# '^\s*end\>' - let ind = ind + &sw + let ind = ind + sw endif if line !~# '^\s*<%' && line =~# '%>\s*$' - let ind = ind - &sw + let ind = ind - sw endif if cline =~# '^\s*[-=]\=%>\s*$' - let ind = ind - &sw + let ind = ind - sw endif return ind endfunction diff --git a/indent/html.vim b/indent/html.vim index 769f6318..c8fe18e0 100644 --- a/indent/html.vim +++ b/indent/html.vim @@ -127,10 +127,12 @@ call add(s:tags, 'meter') call add(s:tags, 'nav') call add(s:tags, 'output') call add(s:tags, 'progress') +call add(s:tags, 'picture') call add(s:tags, 'rp') call add(s:tags, 'rt') call add(s:tags, 'ruby') call add(s:tags, 'section') +call add(s:tags, 'source') call add(s:tags, 'summary') call add(s:tags, 'time') call add(s:tags, 'video') diff --git a/indent/javascript.vim b/indent/javascript.vim index 29fba2ba..5cde88d1 100644 --- a/indent/javascript.vim +++ b/indent/javascript.vim @@ -15,6 +15,7 @@ setlocal nosmartindent " Now, set up our indentation expression and keys that trigger it. setlocal indentexpr=GetJavascriptIndent() +setlocal formatexpr=Fixedgq(v:lnum,v:count) setlocal indentkeys=0{,0},0),0],0\,,!^F,o,O,e " Only define the function once. @@ -437,3 +438,58 @@ endfunction let &cpo = s:cpo_save unlet s:cpo_save + +function! Fixedgq(lnum, count) + let l:tw = &tw ? &tw : 80; + + let l:count = a:count + + if mode() == 'i' " gq was not pressed, but tw was set + return 1 + endif + + if len(getline(a:lnum)) < l:tw && l:count == 1 " No need for gq + return 1 + endif + + " Put all the lines on one line and do normal spliting after that + if l:count > 1 + while l:count > 1 + let l:count -= 1 + normal J + endwhile + endif + + let l:winview = winsaveview() + + call cursor(a:lnum, l:tw + 1) + let orig_breakpoint = searchpairpos(' ', '', '\.', 'bcW', '', a:lnum) + call cursor(a:lnum, l:tw + 1) + let breakpoint = searchpairpos(' ', '', '\.', 'bcW', s:skip_expr, a:lnum) + + " No need for special treatment, normal gq handles edgecases better + if breakpoint[1] == orig_breakpoint[1] + call winrestview(l:winview) + return 1 + endif + + " Try breaking after string + if breakpoint[1] <= indent(a:lnum) + call cursor(a:lnum, l:tw + 1) + let breakpoint = searchpairpos('\.', '', ' ', 'cW', s:skip_expr, a:lnum) + endif + + + if breakpoint[1] != 0 + call feedkeys("r\<CR>") + else + let l:count = l:count - 1 + endif + + " run gq on new lines + if l:count == 1 + call feedkeys("gqq") + endif + + return 0 +endfunction diff --git a/indent/ruby.vim b/indent/ruby.vim index f2059982..1acde808 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -369,6 +369,13 @@ function GetRubyIndent(...) " 3.1. Setup {{{2 " ---------- + " The value of a single shift-width + if exists('*shiftwidth') + let sw = shiftwidth() + else + let sw = &sw + endif + " For the current line, use the first argument if given, else v:lnum let clnum = a:0 ? a:1 : v:lnum @@ -388,7 +395,7 @@ function GetRubyIndent(...) if s:Match(clnum, s:access_modifier_regex) let class_line = s:FindContainingClass() if class_line > 0 - return indent(class_line) + &sw + return indent(class_line) + sw endif endif elseif g:ruby_indent_access_modifier_style == 'outdent' @@ -458,7 +465,7 @@ function GetRubyIndent(...) " If the current line starts with a leading operator, add a level of indent. if s:Match(clnum, s:leading_operator_regex) - return indent(s:GetMSL(clnum)) + &sw + return indent(s:GetMSL(clnum)) + sw endif " 3.3. Work on the previous line. {{{2 @@ -485,23 +492,23 @@ function GetRubyIndent(...) " If the previous line was a private/protected keyword, add a " level of indent. if s:Match(lnum, s:indent_access_modifier_regex) - return indent(lnum) + &sw + return indent(lnum) + sw endif elseif g:ruby_indent_access_modifier_style == 'outdent' " If the previous line was a private/protected/public keyword, add " a level of indent, since the keyword has been out-dented. if s:Match(lnum, s:access_modifier_regex) - return indent(lnum) + &sw + return indent(lnum) + sw endif endif if s:Match(lnum, s:continuable_regex) && s:Match(lnum, s:continuation_regex) - return indent(s:GetMSL(lnum)) + &sw + &sw + return indent(s:GetMSL(lnum)) + sw + sw endif " If the previous line ended with a block opening, add a level of indent. if s:Match(lnum, s:block_regex) - return indent(s:GetMSL(lnum)) + &sw + return indent(s:GetMSL(lnum)) + sw endif " If the previous line started with a leading operator, use its MSL's level @@ -512,7 +519,7 @@ function GetRubyIndent(...) " If the previous line ended with the "*" of a splat, add a level of indent if line =~ s:splat_regex - return indent(lnum) + &sw + return indent(lnum) + sw endif " If the previous line contained unclosed opening brackets and we are still @@ -527,20 +534,20 @@ function GetRubyIndent(...) if opening.pos != -1 if opening.type == '(' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0 if col('.') + 1 == col('$') - return ind + &sw + return ind + sw else return virtcol('.') endif else let nonspace = matchend(line, '\S', opening.pos + 1) - 1 - return nonspace > 0 ? nonspace : ind + &sw + return nonspace > 0 ? nonspace : ind + sw endif elseif closing.pos != -1 call cursor(lnum, closing.pos + 1) normal! % if s:Match(line('.'), s:ruby_indent_keywords) - return indent('.') + &sw + return indent('.') + sw else return indent('.') endif @@ -569,7 +576,7 @@ function GetRubyIndent(...) let col = s:Match(lnum, s:ruby_indent_keywords) if col > 0 call cursor(lnum, col) - let ind = virtcol('.') - 1 + &sw + let ind = virtcol('.') - 1 + sw " TODO: make this better (we need to count them) (or, if a searchpair " fails, we know that something is lacking an end and thus we indent a " level @@ -606,9 +613,9 @@ function GetRubyIndent(...) " TODO: this does not take into account contrived things such as " module Foo; class Bar; end if s:Match(lnum, s:ruby_indent_keywords) - let ind = msl_ind + &sw + let ind = msl_ind + sw if s:Match(lnum, s:end_end_regex) - let ind = ind - &sw + let ind = ind - sw endif return ind endif @@ -617,7 +624,7 @@ function GetRubyIndent(...) " closing bracket, indent one extra level. if s:Match(lnum, s:non_bracket_continuation_regex) && !s:Match(lnum, '^\s*\([\])}]\|end\)') if lnum == p_lnum - let ind = msl_ind + &sw + let ind = msl_ind + sw else let ind = msl_ind endif diff --git a/syntax/csv.vim b/syntax/csv.vim index e2da7dbc..543a9fe9 100644 --- a/syntax/csv.vim +++ b/syntax/csv.vim @@ -139,35 +139,6 @@ fu! <sid>DoSyntaxDefinitions() "{{{3 hi def link CSVColumnHeaderEven WarningMsg hi def link CSVColumnOdd DiffAdd hi def link CSVColumnEven DiffChange - " Old Version - if 0 - if &t_Co < 88 - if !exists("b:csv_fixed_width_cols") - hi default CSVColumnHeaderOdd ctermfg=DarkRed ctermbg=15 - \ guibg=grey80 guifg=black term=underline cterm=standout,bold - \ gui=bold,underline - endif - hi default CSVColumnOdd ctermfg=DarkRed ctermbg=15 guibg=grey80 - \ guifg=black term=underline cterm=bold gui=underline - else - if !exists("b:csv_fixed_width_cols") - hi default CSVColumnHeaderOdd ctermfg=darkblue ctermbg=white - \ guibg=grey80 guifg=black cterm=standout,underline - \ gui=bold,underline - endif - hi default CSVColumnOdd ctermfg=darkblue ctermbg=white guibg=grey80 - \ guifg=black cterm=reverse,underline gui=underline - endif - - " ctermbg=8 should be safe, even in 8 color terms - if !exists("b:csv_fixed_width_cols") - hi default CSVColumnHeaderEven ctermfg=white ctermbg=darkgrey - \ guibg=grey50 guifg=black term=bold cterm=standout,underline - \ gui=bold,underline - endif - hi default CSVColumnEven ctermfg=white ctermbg=darkgrey guibg=grey50 - \ guifg=black term=bold cterm=underline gui=bold,underline - endif endfun " Main: {{{2 diff --git a/syntax/elixir.vim b/syntax/elixir.vim index f7035633..c6818f29 100644 --- a/syntax/elixir.vim +++ b/syntax/elixir.vim @@ -22,6 +22,8 @@ syn keyword elixirKeyword quote unquote super syn keyword elixirInclude import require alias use +syn keyword elixirSelf self + syn match elixirId '\<[_a-zA-Z]\w*[!?]\?\>' " This unfortunately also matches function names in function calls @@ -68,7 +70,7 @@ syn region elixirRegex matchgroup=elixirRegexDelimiter start="%r/" end="/[uiomxf syn cluster elixirRegexSpecial contains=elixirRegexEscape,elixirRegexCharClass,elixirRegexQuantifier,elixirRegexEscapePunctuation syn cluster elixirStringContained contains=elixirInterpolation,elixirRegexEscape,elixirRegexCharClass -syn region elixirString matchgroup=elixirStringDelimiter start="'" end="'" skip="\\'" +syn region elixirString matchgroup=elixirStringDelimiter start="'" end="'" skip="\\'|\\\\" syn region elixirString matchgroup=elixirStringDelimiter start='"' end='"' skip='\\"' contains=@elixirStringContained syn region elixirInterpolation matchgroup=elixirInterpolationDelimiter start="#{" end="}" contained contains=ALLBUT,elixirComment,@elixirNotTop @@ -160,6 +162,7 @@ hi def link elixirPseudoVariable Constant hi def link elixirAlias Type hi def link elixirBoolean Boolean hi def link elixirVariable Identifier +hi def link elixirSelf Identifier hi def link elixirUnusedVariable Comment hi def link elixirNumber Number hi def link elixirDocString String diff --git a/syntax/eruby.vim b/syntax/eruby.vim index c20b086b..4e175bcc 100644 --- a/syntax/eruby.vim +++ b/syntax/eruby.vim @@ -22,7 +22,7 @@ elseif !exists("b:eruby_subtype") && main_syntax == 'eruby' let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$") let b:eruby_subtype = matchstr(s:lines,'eruby_subtype=\zs\w\+') if b:eruby_subtype == '' - let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\|\.erubis\)\+$','',''),'\.\zs\w\+$') + let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\|\.erubis\)\+$','',''),'\.\zs\w\+\%(\ze+\w\+\)\=$') endif if b:eruby_subtype == 'rhtml' let b:eruby_subtype = 'html' diff --git a/syntax/go.vim b/syntax/go.vim index 59f72ed7..4ee39a71 100644 --- a/syntax/go.vim +++ b/syntax/go.vim @@ -10,7 +10,9 @@ " let OPTION_NAME = 0 " in your ~/.vimrc file to disable particular options. You can also write: " let OPTION_NAME = 1 -" to enable particular options. At present, all options default to on. +" to enable particular options. +" At present, all options default to on, except highlight of: +" functions, methods and structs. " " - go_highlight_array_whitespace_error " Highlights white space after "[]". @@ -107,10 +109,10 @@ syn match goDeclaration /\<func\>/ " Predefined functions and values syn keyword goBuiltins append cap close complex copy delete imag len syn keyword goBuiltins make new panic print println real recover -syn keyword goConstants iota true false nil +syn keyword goBoolean iota true false nil hi def link goBuiltins Keyword -hi def link goConstants Keyword +hi def link goBoolean Boolean " Comments; their contents syn keyword goTodo contained TODO FIXME XXX BUG @@ -141,9 +143,11 @@ hi def link goEscapeError Error syn cluster goStringGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU,goEscapeError syn region goString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@goStringGroup syn region goRawString start=+`+ end=+`+ +syn match goFormatSpecifier /%[#0\-\ \+\*]*[vTtbcdoqxXUeEfgGsp]/ contained containedin=goString hi def link goString String hi def link goRawString String +hi def link goFormatSpecifier goSpecialString " Characters; their contents syn cluster goCharacterGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU @@ -199,7 +203,7 @@ endif " Extra types commonly seen if g:go_highlight_extra_types != 0 syn match goExtraType /\<bytes\.\(Buffer\)\>/ - syn match goExtraType /\<io\.\(Reader\|Writer\|ReadWriter\|ReadWriteCloser\)\>/ + syn match goExtraType /\<io\.\(Reader\|ReadSeeker\|ReadWriter\|ReadCloser\|ReadWriteCloser\|Writer\|WriteCloser\|Seeker\)\>/ syn match goExtraType /\<reflect\.\(Kind\|Type\|Value\)\>/ syn match goExtraType /\<unsafe\.Pointer\>/ endif diff --git a/syntax/html.vim b/syntax/html.vim index 78da84f0..3e9beea4 100644 --- a/syntax/html.vim +++ b/syntax/html.vim @@ -24,6 +24,7 @@ syn keyword htmlTagName contained header hgroup keygen main mark meter menu nav syn keyword htmlTagName contained progress ruby rt rp section source summary time track video data syn keyword htmlTagName contained template content shadow syn keyword htmlTagName contained wbr bdi +syn keyword htmlTagName contained picture " SVG tags " http://www.w3.org/TR/SVG/ @@ -75,6 +76,8 @@ syn keyword htmlArg contained label icon open datetime pubdate syn keyword htmlArg contained async " <content> syn keyword htmlArg contained select +" <picture> +syn keyword htmlArg contained srcset sizes " Custom Data Attributes " http://dev.w3.org/html5/spec/elements.html#embedding-custom-non-visible-data diff --git a/syntax/javascript.vim b/syntax/javascript.vim index 7d27707e..beb6b527 100644 --- a/syntax/javascript.vim +++ b/syntax/javascript.vim @@ -35,6 +35,7 @@ syntax keyword jsOperator delete instanceof typeof void new in syntax match jsOperator /\(!\||\|&\|+\|-\|<\|>\|=\|%\|\/\|*\|\~\|\^\)/ syntax keyword jsBooleanTrue true syntax keyword jsBooleanFalse false +syntax keyword jsCommonJS require module exports "" JavaScript comments syntax keyword jsCommentTodo TODO FIXME XXX TBD contained @@ -55,15 +56,15 @@ if !exists("javascript_ignore_javaScriptdoc") syntax region jsDocComment matchgroup=jsComment start="/\*\*\s*" end="\*/" contains=jsDocTags,jsCommentTodo,jsCvsTag,@jsHtml,@Spell fold " tags containing a param - syntax match jsDocTags contained "@\(alias\|augments\|borrows\|class\|constructs\|default\|defaultvalue\|emits\|exception\|exports\|extends\|file\|fires\|kind\|listens\|member\|member[oO]f\|mixes\|module\|name\|namespace\|requires\|throws\|var\|variation\|version\)\>" nextgroup=jsDocParam skipwhite + syntax match jsDocTags contained "@\(alias\|augments\|borrows\|class\|constructs\|default\|defaultvalue\|emits\|exception\|exports\|extends\|file\|fires\|kind\|listens\|member\|member[oO]f\|mixes\|module\|name\|namespace\|requires\|template\|throws\|var\|variation\|version\)\>" nextgroup=jsDocParam skipwhite " tags containing type and param syntax match jsDocTags contained "@\(arg\|argument\|param\|property\)\>" nextgroup=jsDocType skipwhite " tags containing type but no param - syntax match jsDocTags contained "@\(callback\|enum\|external\|this\|type\|typedef\|return\|returns\)\>" nextgroup=jsDocTypeNoParam skipwhite + syntax match jsDocTags contained "@\(callback\|define\|enum\|external\|implements\|this\|type\|typedef\|return\|returns\)\>" nextgroup=jsDocTypeNoParam skipwhite " tags containing references syntax match jsDocTags contained "@\(lends\|see\|tutorial\)\>" nextgroup=jsDocSeeTag skipwhite " other tags (no extra syntax) - syntax match jsDocTags contained "@\(abstract\|access\|author\|classdesc\|constant\|const\|constructor\|copyright\|deprecated\|desc\|description\|event\|example\|file[oO]verview\|function\|global\|ignore\|inner\|instance\|license\|method\|mixin\|overview\|private\|protected\|public\|readonly\|since\|static\|todo\|summary\|undocumented\|virtual\)\>" + syntax match jsDocTags contained "@\(abstract\|access\|author\|classdesc\|constant\|const\|constructor\|copyright\|deprecated\|desc\|description\|dict\|event\|example\|file[oO]verview\|final\|function\|global\|ignore\|inheritDoc\|inner\|instance\|interface\|license\|method\|mixin\|nosideeffects\|override\|overview\|preserve\|private\|protected\|public\|readonly\|since\|static\|struct\|todo\|summary\|undocumented\|virtual\)\>" syntax region jsDocType start="{" end="}" oneline contained nextgroup=jsDocParam skipwhite syntax match jsDocType contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+" nextgroup=jsDocParam skipwhite @@ -81,9 +82,9 @@ syntax case match syntax match jsFuncCall /\k\+\%(\s*(\)\@=/ syntax match jsSpecial "\v\\%(0|\\x\x\{2\}\|\\u\x\{4\}\|\c[A-Z]|.)" contained syntax match jsTemplateVar "\${.\{-}}" contained -syntax region jsStringD start=+"+ skip=+\\\\\|\\$"+ end=+"+ contains=jsSpecial,@htmlPreproc,@Spell -syntax region jsStringS start=+'+ skip=+\\\\\|\\$'+ end=+'+ contains=jsSpecial,@htmlPreproc,@Spell -syntax region jsTemplateString start=+`+ skip=+\\\\\|\\$`+ end=+`+ contains=jsTemplateVar,jsSpecial,@htmlPreproc +syntax region jsStringD start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@htmlPreproc,@Spell +syntax region jsStringS start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contains=jsSpecial,@htmlPreproc,@Spell +syntax region jsTemplateString start=+`+ skip=+\\\(`\|$\)+ end=+`\|$+ contains=jsTemplateVar,jsSpecial,@htmlPreproc syntax region jsRegexpCharClass start=+\[+ skip=+\\.+ end=+\]+ contained syntax match jsRegexpBoundary "\v%(\<@![\^$]|\\[bB])" contained syntax match jsRegexpBackRef "\v\\[1-9][0-9]*" contained @@ -91,7 +92,7 @@ syntax match jsRegexpQuantifier "\v\\@<!%([?*+]|\{\d+%(,|,\d+)?})\??" containe syntax match jsRegexpOr "\v\<@!\|" contained syntax match jsRegexpMod "\v\(@<=\?[:=!>]" contained syntax cluster jsRegexpSpecial contains=jsSpecial,jsRegexpBoundary,jsRegexpBackRef,jsRegexpQuantifier,jsRegexpOr,jsRegexpMod -syntax region jsRegexpGroup start="\\\@<!(" end="\\\@<!)" contained contains=jsRegexpCharClass,@jsRegexpSpecial keepend +syntax region jsRegexpGroup start="\\\@<!(" skip="\\.\|\[\(\\.\|[^]]\)*\]" end="\\\@<!)" contained contains=jsRegexpCharClass,@jsRegexpSpecial keepend syntax region jsRegexpString start=+\(\(\(return\|case\)\s\+\)\@<=\|\(\([)\]"']\|\d\|\w\)\s*\)\@<!\)/\(\*\|/\)\@!+ skip=+\\.\|\[\(\\.\|[^]]\)*\]+ end=+/[gimy]\{,4}+ contains=jsRegexpCharClass,jsRegexpGroup,@jsRegexpSpecial,@htmlPreproc oneline keepend syntax match jsNumber /\<-\=\d\+L\=\>\|\<0[xX]\x\+\>/ syntax keyword jsNumber Infinity @@ -99,28 +100,19 @@ syntax match jsFloat /\<-\=\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%([eE][+- syntax match jsObjectKey /\<[a-zA-Z_$][0-9a-zA-Z_$]*\(\s*:\)\@=/ contains=jsFunctionKey contained syntax match jsFunctionKey /\<[a-zA-Z_$][0-9a-zA-Z_$]*\(\s*:\s*function\s*\)\@=/ contained -if g:javascript_conceal == 1 - syntax keyword jsNull null conceal cchar=ø - syntax keyword jsThis this conceal cchar=@ - syntax keyword jsReturn return conceal cchar=⇚ - syntax keyword jsUndefined undefined conceal cchar=¿ - syntax keyword jsNan NaN conceal cchar=ℕ - syntax keyword jsPrototype prototype conceal cchar=¶ -else - syntax keyword jsNull null - syntax keyword jsThis this - syntax keyword jsReturn return - syntax keyword jsUndefined undefined - syntax keyword jsNan NaN - syntax keyword jsPrototype prototype -endif +exe 'syntax keyword jsNull null '.(exists('g:javascript_conceal_null') ? 'conceal cchar='.g:javascript_conceal_null : '') +exe 'syntax keyword jsReturn return '.(exists('g:javascript_conceal_return') ? 'conceal cchar='.g:javascript_conceal_return : '') +exe 'syntax keyword jsUndefined undefined '.(exists('g:javascript_conceal_undefined') ? 'conceal cchar='.g:javascript_conceal_undefined : '') +exe 'syntax keyword jsNan NaN '.(exists('g:javascript_conceal_NaN') ? 'conceal cchar='.g:javascript_conceal_NaN : '') +exe 'syntax keyword jsPrototype prototype '.(exists('g:javascript_conceal_prototype') ? 'conceal cchar='.g:javascript_conceal_prototype : '') +exe 'syntax keyword jsThis this '.(exists('g:javascript_conceal_this') ? 'conceal cchar='.g:javascript_conceal_this : '') "" Statement Keywords syntax keyword jsStatement break continue with syntax keyword jsConditional if else switch syntax keyword jsRepeat do while for syntax keyword jsLabel case default -syntax keyword jsKeyword yield +syntax keyword jsKeyword yield import export default extends class syntax keyword jsException try catch throw finally syntax keyword jsGlobalObjects Array Boolean Date Function Iterator Number Object RegExp String Proxy ParallelArray ArrayBuffer DataView Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray Intl JSON Math console document window @@ -130,7 +122,7 @@ syntax keyword jsExceptions Error EvalError InternalError RangeError Referen syntax keyword jsBuiltins decodeURI decodeURIComponent encodeURI encodeURIComponent eval isFinite isNaN parseFloat parseInt uneval -syntax keyword jsFutureKeys abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws goto private transient debugger implements protected volatile double import public +syntax keyword jsFutureKeys abstract enum int short boolean interface static byte long super char final native synchronized float package throws goto private transient debugger implements protected volatile double public "" DOM/HTML/CSS specified things @@ -182,7 +174,7 @@ endif "DOM/HTML/CSS "" Code blocks -syntax cluster jsExpression contains=jsComment,jsLineComment,jsDocComment,jsTemplateString,jsStringD,jsStringS,jsRegexpString,jsNumber,jsFloat,jsThis,jsOperator,jsBooleanTrue,jsBooleanFalse,jsNull,jsFunction,jsArrowFunction,jsGlobalObjects,jsExceptions,jsFutureKeys,jsDomErrNo,jsDomNodeConsts,jsHtmlEvents,jsDotNotation,jsBracket,jsParen,jsBlock,jsFuncCall,jsUndefined,jsNan,jsKeyword,jsStorageClass,jsPrototype,jsBuiltins,jsNoise +syntax cluster jsExpression contains=jsComment,jsLineComment,jsDocComment,jsTemplateString,jsStringD,jsStringS,jsRegexpString,jsNumber,jsFloat,jsThis,jsOperator,jsBooleanTrue,jsBooleanFalse,jsNull,jsFunction,jsArrowFunction,jsGlobalObjects,jsExceptions,jsFutureKeys,jsDomErrNo,jsDomNodeConsts,jsHtmlEvents,jsDotNotation,jsBracket,jsParen,jsBlock,jsFuncCall,jsUndefined,jsNan,jsKeyword,jsStorageClass,jsPrototype,jsBuiltins,jsNoise,jsCommonJS syntax cluster jsAll contains=@jsExpression,jsLabel,jsConditional,jsRepeat,jsReturn,jsStatement,jsTernaryIf,jsException syntax region jsBracket matchgroup=jsBrackets start="\[" end="\]" contains=@jsAll,jsParensErrB,jsParensErrC,jsBracket,jsParen,jsBlock,@htmlPreproc fold syntax region jsParen matchgroup=jsParens start="(" end=")" contains=@jsAll,jsParensErrA,jsParensErrC,jsParen,jsBracket,jsBlock,@htmlPreproc fold @@ -202,11 +194,7 @@ if main_syntax == "javascript" syntax sync match jsHighlight grouphere jsBlock /{/ endif -if g:javascript_conceal == 1 - syntax match jsFunction /\<function\>/ nextgroup=jsFuncName,jsFuncArgs skipwhite conceal cchar=ƒ -else - syntax match jsFunction /\<function\>/ nextgroup=jsFuncName,jsFuncArgs skipwhite -endif +exe 'syntax match jsFunction /\<function\>/ nextgroup=jsFuncName,jsFuncArgs skipwhite '.(exists('g:javascript_conceal_function') ? 'conceal cchar='.g:javascript_conceal_function : '') syntax match jsFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*/ nextgroup=jsFuncArgs skipwhite syntax region jsFuncArgs contained matchgroup=jsFuncParens start='(' end=')' contains=jsFuncArgCommas,jsFuncArgRest nextgroup=jsFuncBlock keepend skipwhite skipempty @@ -291,6 +279,7 @@ if version >= 508 || !exists("did_javascript_syn_inits") HiLink jsExceptions Special HiLink jsFutureKeys Special HiLink jsBuiltins Special + HiLink jsCommonJS Include HiLink jsDomErrNo Constant HiLink jsDomNodeConsts Constant diff --git a/syntax/mustache.vim b/syntax/mustache.vim index 8f1d0a0f..ec7d4fe5 100644 --- a/syntax/mustache.vim +++ b/syntax/mustache.vim @@ -50,8 +50,8 @@ syntax match mustacheHandlebars '{{\|}}' contained containedin=mustacheInside,@h syntax match mustacheUnescape '{{{\|}}}' contained containedin=mustacheInside,@htmlMustacheContainer syntax match mustacheConditionals '\([/#]\(if\|unless\)\|else\)' contained containedin=mustacheInside syntax match mustacheHelpers '[/#]\(with\|each\)' contained containedin=mustacheSection -syntax region mustacheComment start=/{{!/rs=s+2 end=/}}/re=e-2 contains=Todo contained containedin=mustacheInside,@htmlMustacheContainer -syntax region mustacheBlockComment start=/{{!--/rs=s+2 end=/--}}/re=e-2 contains=Todo contained containedin=mustacheInside,@htmlMustacheContainer +syntax region mustacheComment start=/{{!/rs=s+2 skip=/{{.\{-}}}/ end=/}}/re=e-2 contains=Todo contained containedin=mustacheInside,@htmlMustacheContainer +syntax region mustacheBlockComment start=/{{!--/rs=s+2 skip=/{{.\{-}}}/ end=/--}}/re=e-2 contains=Todo contained extend containedin=mustacheInside,@htmlMustacheContainer syntax region mustacheQString start=/'/ skip=/\\'/ end=/'/ contained containedin=mustacheInside syntax region mustacheDQString start=/"/ skip=/\\"/ end=/"/ contained containedin=mustacheInside diff --git a/syntax/rust.vim b/syntax/rust.vim index 25d3b4bf..0c7dcb8b 100644 --- a/syntax/rust.vim +++ b/syntax/rust.vim @@ -17,7 +17,7 @@ syn keyword rustConditional match if else syn keyword rustOperator as syn match rustAssert "\<assert\(\w\)*!" contained -syn match rustFail "\<fail\(\w\)*!" contained +syn match rustPanic "\<panic\(\w\)*!" contained syn keyword rustKeyword break syn keyword rustKeyword box nextgroup=rustBoxPlacement skipwhite skipempty syn keyword rustKeyword continue @@ -30,7 +30,7 @@ syn keyword rustKeyword unsafe virtual where while syn keyword rustKeyword use nextgroup=rustModPath skipwhite skipempty " FIXME: Scoped impl's name is also fallen in this category syn keyword rustKeyword mod trait struct enum type nextgroup=rustIdentifier skipwhite skipempty -syn keyword rustStorage mut ref static const +syn keyword rustStorage move mut ref static const syn keyword rustInvalidBareKeyword crate @@ -66,70 +66,64 @@ syn keyword rustType f64 i8 i16 i32 i64 str Self " This section is just straight transformation of the contents of the prelude, " to make it easy to update. -" Core operators {{{3 +" Reexported core operators {{{3 syn keyword rustTrait Copy Send Sized Sync syn keyword rustTrait Add Sub Mul Div Rem Neg Not syn keyword rustTrait BitAnd BitOr BitXor syn keyword rustTrait Drop Deref DerefMut -syn keyword rustTrait Shl Shr Index IndexMut -syn keyword rustEnum Option -syn keyword rustEnumVariant Some None -syn keyword rustEnum Result -syn keyword rustEnumVariant Ok Err +syn keyword rustTrait Shl Shr +syn keyword rustTrait Index IndexMut +syn keyword rustTrait Slice SliceMut +syn keyword rustTrait Fn FnMut FnOnce -" Functions {{{3 -"syn keyword rustFunction from_str -"syn keyword rustFunction range +" Reexported functions {{{3 +"syn keyword rustFunction range repeat "syn keyword rustFunction drop +"syn keyword rustFunction from_str -" Types and traits {{{3 +" Reexported types and traits {{{3 syn keyword rustTrait Ascii AsciiCast OwnedAsciiCast AsciiStr syn keyword rustTrait IntoBytes syn keyword rustTrait ToCStr syn keyword rustTrait Char UnicodeChar syn keyword rustTrait Clone -syn keyword rustTrait PartialEq PartialOrd Eq Ord Equiv -syn keyword rustEnum Ordering +syn keyword rustTrait PartialEq PartialOrd Eq Ord +syn keyword rustEnum Ordering Equiv syn keyword rustEnumVariant Less Equal Greater -syn keyword rustTrait Collection Mutable Map MutableMap MutableSeq -syn keyword rustTrait Set MutableSet -syn keyword rustTrait FromIterator IntoIterator Extend ExactSize +syn keyword rustTrait FromIterator Extend ExactSize syn keyword rustTrait Iterator DoubleEndedIterator syn keyword rustTrait RandomAccessIterator CloneableIterator syn keyword rustTrait OrdIterator MutableDoubleEndedIterator -syn keyword rustTrait Num NumCast CheckedAdd CheckedSub CheckedMul CheckedDiv -syn keyword rustTrait Signed Unsigned Primitive Int Float -syn keyword rustTrait FloatMath ToPrimitive FromPrimitive +syn keyword rustTrait ToPrimitive FromPrimitive syn keyword rustTrait Box +syn keyword rustEnum Option +syn keyword rustEnumVariant Some None syn keyword rustTrait GenericPath Path PosixPath WindowsPath -syn keyword rustTrait RawPtr -syn keyword rustTrait Buffer Writer Reader Seek -syn keyword rustTrait Str StrVector StrSlice -syn keyword rustTrait IntoMaybeOwned StrAllocating UnicodeStrSlice -syn keyword rustTrait ToString IntoStr +syn keyword rustTrait RawPtr RawMutPtr +syn keyword rustEnum Result +syn keyword rustEnumVariant Ok Err +syn keyword rustTrait Buffer Writer Reader Seek BufferPrelude +syn keyword rustTrait Str StrVector StrPrelude +syn keyword rustTrait IntoMaybeOwned StrAllocating UnicodeStrPrelude syn keyword rustTrait Tuple1 Tuple2 Tuple3 Tuple4 syn keyword rustTrait Tuple5 Tuple6 Tuple7 Tuple8 syn keyword rustTrait Tuple9 Tuple10 Tuple11 Tuple12 -syn keyword rustTrait CloneableVector ImmutableCloneableVector -syn keyword rustTrait MutableCloneableSlice MutableOrdSlice -syn keyword rustTrait ImmutableSlice MutableSlice -syn keyword rustTrait ImmutablePartialEqSlice ImmutableOrdSlice -syn keyword rustTrait Slice VectorVector -syn keyword rustTrait MutableSliceAllocating -syn keyword rustTrait String +syn keyword rustTrait SlicePrelude AsSlice CloneSlicePrelude +syn keyword rustTrait VectorVector PartialEqSlicePrelude OrdSlicePrelude +syn keyword rustTrait CloneSliceAllocPrelude OrdSliceAllocPrelude SliceAllocPrelude +syn keyword rustTrait IntoString String ToString syn keyword rustTrait Vec +" Reexported runtime types {{{3 "syn keyword rustFunction sync_channel channel syn keyword rustTrait SyncSender Sender Receiver "syn keyword rustFunction spawn -"syn keyword rustConstant GC +" Other syntax {{{2 syn keyword rustSelf self syn keyword rustBoolean true false -" Other syntax {{{2 - " If foo::bar changes to foo.bar, change this ("::" to "\."). " If foo::bar changes to Foo::bar, change this (first "\w" to "\u"). syn match rustModPath "\w\(\w\)*::[^<]"he=e-3,me=e-3 @@ -151,8 +145,8 @@ syn match rustSigil display /[&~@*][^)= \t\r\n]/he=e-1,me=e-1 " Last, because the & in && isn't a sigil syn match rustOperator display "&&\|||" -syn match rustMacro '\w\(\w\)*!' contains=rustAssert,rustFail -syn match rustMacro '#\w\(\w\)*' contains=rustAssert,rustFail +syn match rustMacro '\w\(\w\)*!' contains=rustAssert,rustPanic +syn match rustMacro '#\w\(\w\)*' contains=rustAssert,rustPanic syn match rustEscapeError display contained /\\./ syn match rustEscape display contained /\\\([nrt0\\'"]\|x\x\{2}\)/ @@ -263,7 +257,7 @@ hi def link rustCommentLineDoc SpecialComment hi def link rustCommentBlock rustCommentLine hi def link rustCommentBlockDoc rustCommentLineDoc hi def link rustAssert PreCondit -hi def link rustFail PreCondit +hi def link rustPanic PreCondit hi def link rustMacro Macro hi def link rustType Type hi def link rustTodo Todo @@ -282,7 +276,7 @@ hi def link rustBoxPlacementExpr rustKeyword " hi rustAttribute ctermfg=cyan " hi rustDeriving ctermfg=cyan " hi rustAssert ctermfg=yellow -" hi rustFail ctermfg=red +" hi rustPanic ctermfg=red " hi rustMacro ctermfg=magenta syn sync minlines=200 diff --git a/syntax/typescript.vim b/syntax/typescript.vim index 6b1c6d65..9d48d480 100644 --- a/syntax/typescript.vim +++ b/syntax/typescript.vim @@ -116,7 +116,7 @@ syntax keyword typeScriptGlobalObjects Array Boolean Date Function Infinity Math syntax keyword typeScriptExceptions try catch throw finally Error EvalError RangeError ReferenceError SyntaxError TypeError URIError -syntax keyword typeScriptReserved constructor declare as interface module abstract enum int short export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public +syntax keyword typeScriptReserved constructor declare as interface module abstract enum int short export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public type "}}} "" TypeScript/DOM/HTML/CSS specified things"{{{ @@ -250,7 +250,7 @@ if version >= 508 || !exists("did_typeScript_syn_inits") HiLink typeScriptIdentifier Identifier HiLink typeScriptRepeat Repeat HiLink typeScriptStatement Statement - HiLink typeScriptFuncKeyword Function + HiLink typeScriptFuncKeyword Type HiLink typeScriptMessage Keyword HiLink typeScriptDeprecated Exception HiLink typeScriptError Error |