diff --git a/after/syntax/coffee.vim b/after/syntax/coffee.vim deleted file mode 100644 index 3781c3a..0000000 --- a/after/syntax/coffee.vim +++ /dev/null @@ -1,20 +0,0 @@ -" This file describes a very basic syntax for TomDoc comments in a -" CoffeeScript file. -" -" For more information on TomDoc, check it out here: http://tomdoc.org/ -" - -syn keyword tomdocKeywords Returns containedin=coffeeComment contained -syn keyword tomdocKeywords Throws containedin=coffeeComment contained -syn keyword tomdocKeywords Examples containedin=coffeeComment contained -syn keyword tomdocKeywords Signature containedin=coffeeComment contained - -syn match tomdocArguments +\s*[A-Za-z0-9_\-&\*:]*\(\s*- \)+he=e-3 containedin=coffeeComment contained - -syn match tomdocDescriptions +\s*Public:+he=e-1 containedin=coffeeComment contained -syn match tomdocDescriptions +\s*Internal:+he=e-1 containedin=coffeeComment contained -syn match tomdocDescriptions +\s*Deprecated:+he=e-1 containedin=coffeeComment contained - -hi default link tomdocDescriptions String -hi default link tomdocKeywords String -hi default link tomdocArguments HELP diff --git a/after/syntax/ruby.vim b/after/syntax/ruby.vim index e01a098..781e614 100644 --- a/after/syntax/ruby.vim +++ b/after/syntax/ruby.vim @@ -1,23 +1,3 @@ -" This file describes a very basic syntax for TomDoc comments in a Ruby file. -" -" For more information on TomDoc, check it out here: http://tomdoc.org/ -" - -syn keyword tomdocKeywords Returns containedin=rubyComment contained -syn keyword tomdocKeywords Yields containedin=rubyComment contained -syn keyword tomdocKeywords Raises containedin=rubyComment contained -syn keyword tomdocKeywords Examples containedin=rubyComment contained -syn keyword tomdocKeywords Signature containedin=rubyComment contained - -syn match tomdocArguments +\s*[A-Za-z0-9_\-&\*:]*\(\s*- \)+he=e-3 containedin=rubyComment contained - -syn match tomdocDescriptions +\s*Public:+he=e-1 containedin=rubyComment contained -syn match tomdocDescriptions +\s*Internal:+he=e-1 containedin=rubyComment contained -syn match tomdocDescriptions +\s*Deprecated:+he=e-1 containedin=rubyComment contained - -hi default link tomdocDescriptions String -hi default link tomdocKeywords String -hi default link tomdocArguments HELP " Ruby syntax extensions for highlighting YARD documentation. " " Author: Joel Holdbrooks diff --git a/autoload/css_color.vim b/autoload/css_color.vim index 4c02d72..e94a69c 100644 --- a/autoload/css_color.vim +++ b/autoload/css_color.vim @@ -235,9 +235,9 @@ 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 let s:_ws_ = '\s*' -let s:_listsep = s:_ws_ . ',' . s:_ws_ +let s:_numval = s:_ws_ . '\(\d\{1,3}%\?\)' " submatch 3,4,5 +let s:_listsep = s:_ws_ . ',' let s:_otherargs_ = '\%(,[^)]*\)\?' let s:_funcexpr = s:_funcname . '[(]' . s:_numval . s:_listsep . s:_numval . s:_listsep . s:_numval . s:_ws_ . s:_otherargs_ . '[)]' let s:_csscolor = s:_hexcolor . '\|' . s:_funcexpr diff --git a/autoload/xml/html5.vim b/autoload/xml/html5.vim index 67926f5..5ec9cd7 100644 --- a/autoload/xml/html5.vim +++ b/autoload/xml/html5.vim @@ -601,7 +601,7 @@ let g:xmldata_html5 = { \ ], \ 'meta': [ \ [], - \ extend(copy(global_attributes), {'name': [], 'http-equiv': ['refresh', 'default-style', 'content-type'], 'content': [], 'charset': charset}) + \ extend(copy(global_attributes), {'name': ['application-name', 'author', 'description', 'generator', 'referrer', 'creator', 'googlebot', 'publisher', 'robots', 'slurp', 'viewport', 'theme-color'], 'http-equiv': ['refresh', 'default-style', 'content-type'], 'content': [], 'charset': charset}) \ ], \ 'meter': [ \ phrasing_elements, diff --git a/compiler/typescript.vim b/compiler/typescript.vim index e81ebd6..7833e00 100644 --- a/compiler/typescript.vim +++ b/compiler/typescript.vim @@ -3,11 +3,14 @@ if exists("current_compiler") endif let current_compiler = "typescript" +if !exists("g:typescript_compiler_binary") + let g:typescript_compiler_binary = "tsc" +endif + if !exists("g:typescript_compiler_options") let g:typescript_compiler_options = "" endif - -let &l:makeprg='tsc' . g:typescript_compiler_options . ' $* %' +let &l:makeprg = g:typescript_compiler_binary . ' ' . g:typescript_compiler_options . ' $* %' CompilerSet errorformat=%+A\ %#%f\ %#(%l\\\,%c):\ %m,%C%m diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index b82f872..168b9d2 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -29,11 +29,11 @@ autocmd FileType ember-script set tabstop=2|set shiftwidth=2|set expandtab autocmd BufNewFile,BufRead *.emblem set filetype=emblem autocmd FileType emblem set tabstop=2|set shiftwidth=2|set expandtab autocmd BufNewFile,BufRead *.git/{,modules/**/}{COMMIT_EDIT,TAG_EDIT,MERGE_,}MSG set ft=gitcommit -autocmd BufNewFile,BufRead *.git/config,.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 +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 autocmd BufNewFile,BufRead *.git/** \ if getline(1) =~ '^\x\{40\}\>\|^ref: ' | \ set ft=git | @@ -202,6 +202,7 @@ au BufRead,BufNewFile *.textile set filetype=textile au BufNewFile,BufRead *.thrift setlocal filetype=thrift autocmd BufNewFile,BufRead {.,}tmux.conf{.*,} setlocal filetype=tmux autocmd BufNewFile,BufRead *.toml set filetype=toml +autocmd BufNewFile,BufRead Cargo.lock set filetype=toml autocmd BufNewFile,BufRead *.twig set filetype=twig autocmd BufNewFile,BufRead *.html.twig set filetype=html.twig autocmd BufNewFile,BufRead *.ts setlocal filetype=typescript diff --git a/ftplugin/csv.vim b/ftplugin/csv.vim index c1a5fa4..95b609c 100644 --- a/ftplugin/csv.vim +++ b/ftplugin/csv.vim @@ -1,11 +1,11 @@ " Filetype plugin for editing CSV files. "{{{1 " Author: Christian Brabandt -" Version: 0.30 +" Version: 0.31 " Script: http://www.vim.org/scripts/script.php?script_id=2830 " License: VIM License -" Last Change: Thu, 27 Mar 2014 23:28:40 +0100 +" Last Change: Thu, 15 Jan 2015 21:05:10 +0100 " Documentation: see :help ft-csv.txt -" GetLatestVimScripts: 2830 29 :AutoInstall: csv.vim +" GetLatestVimScripts: 2830 30 :AutoInstall: csv.vim " " Some ideas are taken from the wiki http://vim.wikia.com/wiki/VimTip667 " though, implementation differs. @@ -90,7 +90,7 @@ fu! Init(startline, endline) "{{{3 " - Should work with most ugly solutions that are available let b:col='\%(\%(\%(' . (b:delimiter !~ '\s' ? '\s*' : '') . \ '"\%(' . (exists("g:csv_nl") ? '\_' : '' ) . - \ '[^"]\|""\)*"\)' . s:del . '\)\|\%(' . + \ '[^"]\|""\)*"\s*\)' . s:del . '\)\|\%(' . \ '[^' . b:delimiter . ']*' . s:del . '\)\)' let b:col_end='\%(\%(\%(' . (b:delimiter !~ '\s' ? '\s*' : '') . \ '"\%(' . (exists("g:csv_nl") ? '\_' : '' ) . @@ -147,7 +147,7 @@ fu! Init(startline, endline) "{{{3 let b:undo_ftplugin .= "| unlet! b:delimiter b:col" \ . "| unlet! b:csv_fixed_width_cols b:csv_filter" \ . "| unlet! b:csv_fixed_width b:csv_list b:col_width" - \ . "| unlet! b:csv_SplitWindow b:csv_headerline" + \ . "| unlet! b:csv_SplitWindow b:csv_headerline b:csv_cmt" \ . "| unlet! b:csv_thousands_sep b:csv_decimal_sep" \. " | unlet! b:browsefilter b:csv_cmt" \. " | unlet! b:csv_arrange_leftalign" @@ -182,7 +182,7 @@ fu! Init(startline, endline) "{{{3 " \ delf SaveOptions | delf CheckDuplicates | " \ delf CompleteColumnNr | delf CSVPat | delf Transpose | " \ delf LocalSettings() | delf AddColumn | delf SubstituteInColumn - " \ delf SetupQuitPre() | delf CSV_CloseBuffer + " \ delf SetupAutoCmd() | delf CSV_CloseBuffer endfu fu! LocalSettings(type) "{{{3 @@ -194,11 +194,8 @@ fu! LocalSettings(type) "{{{3 let b:undo_ftplugin = "setlocal sol& tw< wrap<" " Set browsefilter - if (v:version > 703 || (v:version == 703 && has("patch593"))) - \ && exists("browsefilter") - let b:browsefilter="CSV Files (*.csv, *.dat)\t*.csv;*.dat\n". + let b:browsefilter="CSV Files (*.csv, *.dat)\t*.csv;*.dat\n". \ "All Files\t*.*\n" - endif if has("conceal") setl cole=2 cocu=nc @@ -341,7 +338,8 @@ fu! SearchColumn(arg) "{{{3 endif let @/ = GetPat(colnr, maxcolnr, '\%('.pat. '\)') try - norm! n + " force redraw, so that the search pattern isn't shown + exe "norm! n\" catch /^Vim\%((\a\+)\)\=:E486/ " Pattern not found echohl Error @@ -619,10 +617,6 @@ fu! ColWidth(colnr) "{{{3 endfu fu! 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 - " a:firstline and a:lastline parameter, therefore " explicitly give the range as argument to the function if exists("b:csv_fixed_width_cols") " Nothing to do @@ -713,6 +707,8 @@ fu! CalculateColumnWidth() "{{{3 " delete buffer content in variable b:csv_list, " this was only necessary for calculating the max width unlet! b:csv_list + unlet! s:columnize_count + unlet! s:decimal_column endfu fu! Columnize(field) "{{{3 @@ -736,51 +732,83 @@ fu! Columnize(field) "{{{3 " Careful: Keep this fast! Using " let width=get(b:col_width,WColumn()-1,20) " is too slow, so we are using: - let width=get(b:col_width, (s:columnize_count % s:max_cols), 20) + let colnr = s:columnize_count % s:max_cols + let width=get(b:col_width, colnr, 20) + let align='r' + if exists('b:csv_arrange_align') + let align_list=split(get(b:, 'csv_arrange_align', " "), '\zs') + try + let align = align_list[colnr] + catch + let align = 'r' + endtry + endif + if ((align isnot? 'r' && align isnot? 'l' && + \ align isnot? 'c' && align isnot? '.') || get(b:, 'csv_arrange_leftalign', 0)) + let align = 'r' + endif let s:columnize_count += 1 let has_delimiter = (a:field =~# b:delimiter.'$') - if v:version > 703 || v:version == 703 && has("patch713") - " printf knows about %S (e.g. can handle char length - if get(b:, 'csv_arrange_leftalign',0) - " left-align content - return printf("%-*S%s", width+1 , - \ (has_delimiter ? - \ matchstr(a:field, '.*\%('.b:delimiter.'\)\@=') : a:field), - \ (has_delimiter ? b:delimiter : '')) - else - return printf("%*S", width+1 , a:field) + if align is? 'l' + " left-align content + return printf("%-*S%s", width+1 , + \ (has_delimiter ? a:field[:-2] : a:field), + \ (has_delimiter ? b:delimiter : ' ')) + elseif align is? 'c' + " center the column + let t = width - len(split(a:field, '\zs')) + let leftwidth = t/2 + " uneven width, add one + let rightwidth = (t%2 ? leftwidth+1 : leftwidth) + let field = (has_delimiter ? a:field[:-2] : a:field). repeat(' ', rightwidth) + return printf("%*S%s", width , field, (has_delimiter ? b:delimiter : ' ')) + elseif align is? '.' + if !exists("s:decimal_column") + let s:decimal_column = {} endif - else - " printf only handles bytes - if !exists("g:csv_no_multibyte") && - \ match(a:field, '[^ -~]') != -1 - " match characters outside the ascii range - let a = split(a:field, '\zs') - let add = eval(join(map(a, 'len(v:val)'), '+')) - let add -= len(a) - else - let add = 0 - endif - - " Add one for the frame - " plus additional width for multibyte chars, - " since printf(%*s..) uses byte width! - let width = width + add + 1 - - if width == strlen(a:field) - " Column has correct length, don't use printf() - return a:field - else - if get(b:, 'csv_arrange_leftalign',0) - " left-align content - return printf("%-*s%s", width, - \ (has_delimiter ? matchstr(a:field, '.*\%('.b:delimiter.'\)\@=') : a:field), - \ (has_delimiter ? b:delimiter : '')) - else - return printf("%*s", width , a:field) + if get(s:decimal_column, colnr, 0) == 0 + call CheckHeaderLine() + call NumberFormat() + let data = CopyCol('', colnr+1, '')[s:csv_fold_headerline : -1] + let pat1 = escape(s:nr_format[1], '.').'\zs[^'.s:nr_format[1].']*\ze'. + \ (has_delimiter ? b:delimiter : '').'$' + let pat2 = '\d\+\ze\%(\%('.escape(s:nr_format[1], '.'). '\d\+\)\|'. + \ (has_delimiter ? b:delimiter : '').'$\)' + let data1 = map(copy(data), 'matchstr(v:val, pat1)') + let data2 = map(data, 'matchstr(v:val, pat2)') + " strlen should be okay for decimals... + let data1 = map(data1, 'strlen(v:val)') + let data2 = map(data2, 'strlen(v:val)') + let dec = max(data1) + let scal = max(data2) + if dec + scal + 1 + (has_delimiter ? 1 : 0) > width + let width = dec + scal + 1 + (has_delimiter ? 1 :0) + let b:col_width[colnr] = width endif + + let s:decimal_column[colnr] = dec + else + let dec = get(s:decimal_column, colnr) endif + let field = (has_delimiter ? a:field[:-2] : a:field) + let fmt = printf("%%%d.%df", width+1, dec) + try + if s:nr_format[1] isnot '.' + let field = substitute(field, s:nr_format[1], '.', 'g') + let field = substitute(field, s:nr_format[0], '', 'g') + endif + if field =~? '\h' " text in the column, can't be converted to float + throw "no decimal" + endif + let result = printf(fmt, str2float(field)). (has_delimiter ? b:delimiter : ' ') + catch + let result = printf("%*S", width+2, a:field) + endtry + return result + else + " right align + return printf("%*S", width+1 , a:field) endif endfun @@ -809,14 +837,13 @@ fu! GetColPat(colnr, zs_flag) "{{{3 return pat . (a:zs_flag ? '\zs' : '') endfu -fu! SetupQuitPre(window) "{{{3 +fu! SetupAutoCmd(window,bufnr) "{{{3 " Setup QuitPre autocommand to quit cleanly - if exists("##QuitPre") - augroup CSV_QuitPre - au! - exe "au QuitPre * call CSV_CloseBuffer(".winbufnr(a:window).")" - augroup end - endif + aug CSV_QuitPre + au! + exe "au QuitPre * call CSV_CloseBuffer(".winbufnr(a:window).")" + exe "au CursorHold call CSV_SetSplitOptions(".a:window.")" + aug END endfu fu! SplitHeaderLine(lines, bang, hor) "{{{3 @@ -837,8 +864,9 @@ fu! SplitHeaderLine(lines, bang, hor) "{{{3 let _sbo = &sbo let a = [] let b=b:col + let bufnr = bufnr('.') if a:hor - setl scrollopt=hor scrollbind + setl scrollopt=hor scrollbind cursorbind let _fdc = &l:fdc let lines = empty(a:lines) ? s:csv_fold_headerline : a:lines let a = getline(1,lines) @@ -851,16 +879,21 @@ fu! SplitHeaderLine(lines, bang, hor) "{{{3 "setl syntax=csv sil! doautocmd FileType csv noa 1 + sil! sign unplace * exe "resize" . lines - setl scrollopt=hor winfixheight nowrap - "let &l:stl=repeat(' ', winwidth(0)) + setl scrollopt=hor winfixheight nowrap cursorbind let &l:stl="%#Normal#".repeat(' ',winwidth(0)) + let s:local_stl = &l:stl " set the foldcolumn to the same of the other window let &l:fdc = _fdc else - setl scrollopt=ver scrollbind + setl scrollopt=ver scrollbind cursorbind noa 0 - let a=CopyCol('',1,a:lines) + if a:lines[-1:] is? '!' + let a=CopyCol('',a:lines,'') + else + let a=CopyCol('',1, a:lines-1) + endif " Does it make sense to use the preview window? "vert sil! pedit |wincmd w | enew! above vsp +enew @@ -876,11 +909,14 @@ fu! SplitHeaderLine(lines, bang, hor) "{{{3 noa 0 let b:csv_SplitWindow = winnr() sil :call ArrangeCol(1,line('$'), 1, -1) + sil! sign unplace * exe "vert res" . len(split(getline(1), '\zs')) call matchadd("CSVHeaderLine", b:col) - setl scrollopt=ver winfixwidth + setl scrollopt=ver winfixwidth cursorbind nonu nornu fdc=0 endif - call SetupQuitPre(winnr()) + call SetupAutoCmd(winnr(),bufnr) + " disable airline + let w:airline_disabled = 1 let win = winnr() setl scrollbind buftype=nowrite bufhidden=wipe noswapfile nobuflisted noa wincmd p @@ -901,9 +937,9 @@ fu! SplitHeaderLine(lines, bang, hor) "{{{3 if exists("_sbo") let &sbo = _sbo endif - setl noscrollbind + setl noscrollbind nocursorbind try - wincmd c + noa wincmd c catch /^Vim\%((\a\+)\)\=:E444/ " cannot close last window catch /^Vim\%((\a\+)\)\=:E517/ " buffer already wiped " no-op @@ -959,6 +995,9 @@ fu! MoveCol(forward, line, ...) "{{{3 elseif line > line('$') let line=line('$') endif + if foldclosed(line) != -1 + let line = line > line('.') ? foldclosedend(line) : foldclosed(line) + endif " Generate search pattern if colnr == 1 @@ -1906,7 +1945,7 @@ fu! CommandDefinitions() "{{{3 call LocalCmd("CSVFixed", ':call InitCSVFixedWidth()', '') call LocalCmd("NewRecord", ':call NewRecord(, \ , )', '-nargs=? -range') - call LocalCmd("NewDelimiter", ':call NewDelimiter()', + call LocalCmd("NewDelimiter", ':call NewDelimiter(, 1, line(''$''))', \ '-nargs=1') call LocalCmd("Duplicates", ':call CheckDuplicates()', \ '-nargs=1 -complete=custom,CompleteColumnNr') @@ -1993,7 +2032,7 @@ fu! SaveOptions(list) "{{{3 return save endfu -fu! NewDelimiter(newdelimiter) "{{{3 +fu! NewDelimiter(newdelimiter, firstl, lastl) "{{{3 let save = SaveOptions(['ro', 'ma']) if exists("b:csv_fixed_width_cols") call Warn("NewDelimiter does not work with fixed width column!") @@ -2005,8 +2044,12 @@ fu! NewDelimiter(newdelimiter) "{{{3 if &l:ro setl noro endif - let line=1 - while line <= line('$') + let delimiter = a:newdelimiter + if a:newdelimiter is '\t' + let delimiter="\t" + endif + let line=a:firstl + while line <= a:lastl " Don't change delimiter for comments if getline(line) =~ '^\s*\V'. escape(b:csv_cmt[0], '\\') let line+=1 @@ -2016,7 +2059,7 @@ fu! NewDelimiter(newdelimiter) "{{{3 " Remove field delimiter call map(fields, 'substitute(v:val, b:delimiter . \ ''\?$'' , "", "")') - call setline(line, join(fields, a:newdelimiter)) + call setline(line, join(fields, delimiter)) let line+=1 endwhile " reset local buffer options @@ -2024,7 +2067,17 @@ fu! NewDelimiter(newdelimiter) "{{{3 call setbufvar('', '&'. key, value) endfor "reinitialize the plugin + if exists("g:csv_delim") + let _delim = g:csv_delim + endif + let g:csv_delim = delimiter call Init(1,line('$')) + if exists("_delim") + let g:csv_delim = _delim + else + unlet g:csv_delim + endif + unlet! _delim endfu fu! IN(list, value) "{{{3 @@ -2207,6 +2260,23 @@ fu! Tabularize(bang, first, last) "{{{3 let adjust_last = 0 call cursor(a:first,0) call CheckHeaderLine() + let line=a:first + if exists("g:csv_table_leftalign") + let b:csv_arrange_leftalign = 1 + endif + let newlines=[] + while line <= a:last + let curline = getline(line) + if empty(split(curline, b:delimiter)) + " only empty delimiters, add one empty delimiter + " (:NewDelimiter strips trailing delimiter + let curline = repeat(b:delimiter, MaxColumns()) + call add(newlines, line) + call setline(line, curline) + endif + let line+=1 + endw + unlet! line if exists("b:csv_fixed_width_cols") let cols=copy(b:csv_fixed_width_cols) let pat = join(map(cols, ' ''\(\%''. v:val. ''c\)'' '), '\|') @@ -2223,21 +2293,35 @@ fu! Tabularize(bang, first, last) "{{{3 " don't clear column width variable, might have been set in the " plugin! sil call ArrangeCol(a:first, a:last, 0, -1) + if !get(b:, 'csv_arrange_leftalign',0) + for line in newlines + let cline = getline(line) + let cline = substitute(cline, '\s$', ' ', '') + call setline(line, cline) + endfor + unlet! line + endif endif if empty(b:col_width) call Warn('An error occured, aborting!') return endif - let b:col_width[-1] += 1 + if get(b:, 'csv_arrange_leftalign', 0) + call map(b:col_width, 'v:val+1') + endif + if b:delimiter == "\t" && !get(b:, 'csv_arrange_leftalign',0) + let b:col_width[-1] += 1 + endif let marginline = s:td.scol. join(map(copy(b:col_width), 'repeat(s:td.hbar, v:val)'), s:td.cros). s:td.ecol - exe printf('sil %d,%ds/%s/%s/ge', a:first, (a:last+adjust_last), - \ (exists("b:csv_fixed_width_cols") ? pat : b:delimiter ), s:td.vbar) + call NewDelimiter(s:td.vbar, a:first, a:last+adjust_last) + "exe printf('sil %d,%ds/%s/%s/ge', a:first, (a:last+adjust_last), + " \ (exists("b:csv_fixed_width_cols") ? pat : b:delimiter ), s:td.vbar) " Add vertical bar in first column, if there isn't already one exe printf('sil %d,%ds/%s/%s/e', a:first, a:last+adjust_last, \ '^[^'. s:td.vbar. s:td.scol. ']', s:td.vbar.'&') - " And add a final vertical bar, if there isn't already + " And add a final vertical bar, if there isn't one already exe printf('sil %d,%ds/%s/%s/e', a:first, a:last+adjust_last, \ '[^'. s:td.vbar. s:td.ecol. ']$', '&'. s:td.vbar) " Make nice intersection graphs @@ -2247,11 +2331,16 @@ fu! Tabularize(bang, first, last) "{{{3 call append(a:first-1, s:td.ltop. join(line, s:td.dhor). s:td.rtop) call append(a:last+adjust_last+1, s:td.lbot. join(line, s:td.uhor). s:td.rbot) - if s:csv_fold_headerline > 0 && !a:bang - "call NewRecord(s:csv_fold_headerline, s:csv_fold_headerline, 1) + if s:csv_fold_headerline > 0 call append(a:first + s:csv_fold_headerline, marginline) let adjust_last += 1 endif + " Adjust headerline to header of new table + let b:csv_headerline = (exists('b:csv_headerline')?b:csv_headerline+2:3) + call CheckHeaderLine() + " Adjust syntax highlighting + unlet! b:current_syntax + ru syntax/csv.vim if a:bang exe printf('sil %d,%ds/^%s\zs\n/&%s&/e', a:first + s:csv_fold_headerline, a:last + adjust_last, @@ -2484,8 +2573,23 @@ fu! CSV_WCol(...) "{{{3 endtry endfun +fu! CSV_SetSplitOptions(window) "{{{3 + if exists("s:local_stl") + " local horizontal statusline + for opt in items({'&nu': &l:nu, '&rnu': &l:rnu, '&fdc': &fdc}) + if opt[1] != getwinvar(a:window, opt[0]) + call setwinvar(a:window, opt[0], opt[1]) + endif + endfor + " Check statusline (airline might change it) + if getwinvar(a:window, '&l:stl') != s:local_stl + call setwinvar(a:window, '&stl', s:local_stl) + endif + endif +endfun + fu! CSV_CloseBuffer(buffer) "{{{3 - " Setup by SetupQuitPre autocommand + " Setup by SetupAutoCmd autocommand try if bufnr((a:buffer)+0) > -1 exe a:buffer. "bw" diff --git a/ftplugin/latex-box/findmain.vim b/ftplugin/latex-box/findmain.vim index 622c408..b9871a6 100644 --- a/ftplugin/latex-box/findmain.vim +++ b/ftplugin/latex-box/findmain.vim @@ -30,7 +30,7 @@ function! LatexBox_GetMainFileName(...) " move up the directory tree until we find a .latexmain file. " TODO: Should we be doing this recursion by default, or should there be a " setting? - while glob('*.latexmain') == '' + while glob('*.latexmain',1) == '' let dirmodifier = dirmodifier.':h' let dirNew = fnameescape(expand(dirmodifier)) " break from the loop if we cannot go up any further. @@ -41,7 +41,7 @@ function! LatexBox_GetMainFileName(...) exe 'cd '.dirLast endwhile - let lheadfile = glob('*.latexmain') + let lheadfile = glob('*.latexmain',1) if lheadfile != '' " Remove the trailing .latexmain part of the filename... We never want " that. diff --git a/ftplugin/latex-box/latexmk.vim b/ftplugin/latex-box/latexmk.vim index 6c5d3eb..1285bc6 100644 --- a/ftplugin/latex-box/latexmk.vim +++ b/ftplugin/latex-box/latexmk.vim @@ -443,10 +443,32 @@ function! LatexBox_LatexErrors(status, ...) endif endfunction +" Redefine uniq() for compatibility with older Vim versions (< 7.4.218) +function! s:uniq(list) + if exists('*uniq') + return uniq(a:list) + elseif len(a:list) <= 1 + return a:list + endif + + let last_element = get(a:list,0) + let uniq_list = [last_element] + + for i in range(1, len(a:list)-1) + let next_element = get(a:list, i) + if last_element == next_element + continue + endif + let last_element = next_element + call add(uniq_list, next_element) + endfor + return uniq_list +endfunction + function! s:log_contains_error(file) let lines = readfile(a:file) let lines = filter(lines, 'v:val =~ ''^.*:\d\+: ''') - let lines = uniq(map(lines, 'matchstr(v:val, ''^.*\ze:\d\+:'')')) + let lines = s:uniq(map(lines, 'matchstr(v:val, ''^.*\ze:\d\+:'')')) let lines = filter(lines, 'filereadable(fnameescape(v:val))') return len(lines) > 0 endfunction diff --git a/ftplugin/latex-box/mappings.vim b/ftplugin/latex-box/mappings.vim index 648d9b5..ef6b52f 100644 --- a/ftplugin/latex-box/mappings.vim +++ b/ftplugin/latex-box/mappings.vim @@ -5,31 +5,31 @@ if exists("g:LatexBox_no_mappings") endif " latexmk {{{ -map ll :Latexmk -map lL :Latexmk! -map lc :LatexmkClean -map lC :LatexmkClean! -map lg :LatexmkStatus -map lG :LatexmkStatus! -map lk :LatexmkStop -map le :LatexErrors +noremap ll :Latexmk +noremap lL :Latexmk! +noremap lc :LatexmkClean +noremap lC :LatexmkClean! +noremap lg :LatexmkStatus +noremap lG :LatexmkStatus! +noremap lk :LatexmkStop +noremap le :LatexErrors " }}} " View {{{ -map lv :LatexView +noremap lv :LatexView " }}} " TOC {{{ -map lt :LatexTOC +noremap lt :LatexTOC " }}} " List of labels {{{ -map lj :LatexLabels +noremap lj :LatexLabels " }}} " Folding {{{ if g:LatexBox_Folding == 1 - map lf :LatexFold + noremap lf :LatexFold endif " }}} @@ -44,12 +44,12 @@ endif " Define text objects {{{ vmap ie LatexBox_SelectCurrentEnvInner vmap ae LatexBox_SelectCurrentEnvOuter -omap ie :normal vie -omap ae :normal vae +onoremap ie :normal vie +onoremap ae :normal vae vmap i$ LatexBox_SelectInlineMathInner vmap a$ LatexBox_SelectInlineMathOuter -omap i$ :normal vi$ -omap a$ :normal va$ +onoremap i$ :normal vi$ +onoremap a$ :normal va$ " }}} " Jump between sections {{{ diff --git a/indent/javascript.vim b/indent/javascript.vim index 5cde88d..d483409 100644 --- a/indent/javascript.vim +++ b/indent/javascript.vim @@ -443,11 +443,17 @@ function! Fixedgq(lnum, count) let l:tw = &tw ? &tw : 80; let l:count = a:count + let l:first_char = indent(a:lnum) + 1 if mode() == 'i' " gq was not pressed, but tw was set return 1 endif + " This gq is only meant to do code with strings, not comments + if s:IsLineComment(a:lnum, l:first_char) || s:IsInMultilineComment(a:lnum, l:first_char) + return 1 + endif + if len(getline(a:lnum)) < l:tw && l:count == 1 " No need for gq return 1 endif diff --git a/syntax/csv.vim b/syntax/csv.vim index 543a9fe..0acd692 100644 --- a/syntax/csv.vim +++ b/syntax/csv.vim @@ -106,10 +106,9 @@ fu! DoHighlight() "{{{3 \ . s:col . '/ contains=CSVDelimiter' exe 'syn match CSVColumnOdd nextgroup=CSVColumnEven /' \ . s:col . '/ contains=CSVDelimiter' - - exe 'syn match CSVColumnHeaderEven nextgroup=CSVColumnHeaderOdd /\%1l' + exe 'syn match CSVColumnHeaderEven nextgroup=CSVColumnHeaderOdd /\%<'. (get(b:, 'csv_headerline', 1)+1).'l' \. s:col . '/ contains=CSVDelimiter' - exe 'syn match CSVColumnHeaderOdd nextgroup=CSVColumnHeaderEven /\%1l' + exe 'syn match CSVColumnHeaderOdd nextgroup=CSVColumnHeaderEven /\%<'. (get(b:, 'csv_headerline', 1)+1).'l' \. s:col . '/ contains=CSVDelimiter' else for i in range(len(b:csv_fixed_width_cols)) @@ -137,8 +136,13 @@ fu! DoSyntaxDefinitions() "{{{3 hi def link CSVColumnHeaderOdd WarningMsg hi def link CSVColumnHeaderEven WarningMsg - hi def link CSVColumnOdd DiffAdd - hi def link CSVColumnEven DiffChange + if get(g:, 'csv_no_column_highlight', 0) + hi def link CSVColumnOdd Normal + hi def link CSVColumnEven Normal + else + hi def link CSVColumnOdd DiffAdd + hi def link CSVColumnEven DiffChange + endif endfun " Main: {{{2 diff --git a/syntax/elixir.vim b/syntax/elixir.vim index c6818f2..6c48d5e 100644 --- a/syntax/elixir.vim +++ b/syntax/elixir.vim @@ -15,8 +15,8 @@ syn cluster elixirNotTop contains=@elixirRegexSpecial,@elixirStringContained,@el syn match elixirComment '#.*' contains=elixirTodo syn keyword elixirTodo FIXME NOTE TODO OPTIMIZE XXX HACK contained -syn keyword elixirKeyword is_atom is_binary is_bitstring is_boolean is_float is_function is_integer is_list is_number is_pid is_port is_record is_reference is_tuple is_exception -syn keyword elixirKeyword case cond for if unless try receive send +syn keyword elixirKeyword is_atom is_binary is_bitstring is_boolean is_float is_function is_integer is_list is_map is_number is_pid is_port is_record is_reference is_tuple is_exception +syn keyword elixirKeyword case when cond for if unless try receive send syn keyword elixirKeyword exit raise throw after rescue catch else do end syn keyword elixirKeyword quote unquote super diff --git a/syntax/go.vim b/syntax/go.vim index 4ee39a7..7b0fbaf 100644 --- a/syntax/go.vim +++ b/syntax/go.vim @@ -67,6 +67,10 @@ if !exists("g:go_highlight_structs") let g:go_highlight_structs = 0 endif +if !exists("g:go_highlight_build_constraints") + let g:go_highlight_build_constraints = 0 +endif + syn case match syn keyword goDirective package import @@ -270,6 +274,21 @@ endif hi def link goStruct Function hi def link goStructDef Function +" Build Constraints +if g:go_highlight_build_constraints != 0 + syn keyword goBuildOs contained ignore cgo android darwin dragonfly freebsd linux nacl netbsd openbsd plan9 solaris windows + syn keyword goBuildArch contained 386 amd64 amd64p32 arm + syn match goBuildDirective display contained "+build" + syn region goBuildComment start="//\s*+build" end="$" contains=goBuildDirective,goBuildOs,goBuildArch + syn region goBuildComment start="/\*\s*+build" end="\*/" contains=goBuildDirective,goBuildOs,goBuildArch +endif + +hi def link goBuildComment Comment +hi def link goBuildOs Type +hi def link goBuildArch Type +hi def link goBuildDirective PreProc + + " Search backwards for a global declaration to start processing the syntax. "syn sync match goSync grouphere NONE /^\(const\|var\|type\|func\)\>/ diff --git a/syntax/jade.vim b/syntax/jade.vim index ab488d1..2d0acfe 100644 --- a/syntax/jade.vim +++ b/syntax/jade.vim @@ -31,6 +31,7 @@ syn match jadeBegin "^\s*\%([<>]\|&[^=~ ]\)\@!" nextgroup=jadeTag,jadeClassCha syn match jadeTag "+\?\w\+\%(:\w\+\)\=" contained contains=htmlTagName,htmlSpecialTagName nextgroup=@jadeComponent syn cluster jadeComponent contains=jadeAttributes,jadeIdChar,jadeBlockExpansionChar,jadeClassChar,jadePlainChar,jadeJavascript,jadeTagBlockChar,jadeTagInlineText syn match jadeComment '\s*\/\/.*$' +syn region jadeCommentBlock start="\z(\s*\)\/\/.*$" end="^\%(\z1\s\|\s*$\)\@!" keepend syn region jadeHtmlConditionalComment start="" syn region jadeAttributes matchgroup=jadeAttributesDelimiter start="(" end=")" contained contains=@htmlJavascript,jadeHtmlArg,htmlArg,htmlEvent,htmlCssDefinition nextgroup=@jadeComponent syn match jadeClassChar "\." contained nextgroup=jadeClass @@ -45,7 +46,7 @@ syn region jadeDocType start="^\s*\(!!!\|doctype\)" end="$" syn keyword jadeHtmlArg contained href title syn match jadePlainChar "\\" contained -syn region jadeInterpolation matchgroup=jadeInterpolationDelimiter start="#{" end="}" contains=@htmlJavascript +syn region jadeInterpolation matchgroup=jadeInterpolationDelimiter start="[#!]{" end="}" contains=@htmlJavascript syn match jadeInterpolationEscape "\\\@" nextgroup=jsDocParam skipwhite + syntax match jsDocTags contained "@\(alias\|api\|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 @@ -70,7 +70,7 @@ if !exists("javascript_ignore_javaScriptdoc") syntax match jsDocType contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+" nextgroup=jsDocParam skipwhite syntax region jsDocTypeNoParam start="{" end="}" oneline contained syntax match jsDocTypeNoParam contained "\%(#\|\"\|\w\|\.\|:\|\/\)\+" - syntax match jsDocParam contained "\%(#\|\"\|{\|}\|\w\|\.\|:\|\/\)\+" + syntax match jsDocParam contained "\%(#\|\"\|{\|}\|\w\|\.\|:\|\/\|\[\|]\|=\)\+" syntax region jsDocSeeTag contained matchgroup=jsDocSeeTag start="{" end="}" contains=jsDocTags syntax case match @@ -94,11 +94,17 @@ syntax match jsRegexpMod "\v\(@<=\?[:=!>]" contained syntax cluster jsRegexpSpecial contains=jsSpecial,jsRegexpBoundary,jsRegexpBackRef,jsRegexpQuantifier,jsRegexpOr,jsRegexpMod syntax region jsRegexpGroup start="\\\@\|\<0[xX]\x\+\>/ +syntax match jsNumber /\<-\=\d\+\(L\|[eE][+-]\=\d\+\)\=\>\|\<0[xX]\x\+\>/ syntax keyword jsNumber Infinity syntax match jsFloat /\<-\=\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%([eE][+-]\=\d\+\)\=\>/ -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 +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 + +syntax match jsAssignmentExpr /\v%([a-zA-Z_$]\k*\.)*[a-zA-Z_$]\k*\s*\=/ contains=jsFuncAssignExpr,jsAssignExpIdent,jsPrototype,jsOperator,jsThis,jsNoise +syntax match jsAssignExpIdent /\v[a-zA-Z_$]\k*\ze%(\s*\=)/ contained +syntax match jsFuncAssignExpr /\v%(%([a-zA-Z_$]\k*\.)*[a-zA-Z_$]\k*\s*\=\s*){-1,}\ze%(function\s*\*?\s*\()/ contains=jsFuncAssignObjChain,jsFuncAssignIdent,jsFunction,jsPrototype,jsOperator,jsThis contained +syntax match jsFuncAssignObjChain /\v%([a-zA-Z_$]\k*\.)+/ contains=jsPrototype,jsNoise contained +syntax match jsFuncAssignIdent /\v[a-zA-Z_$]\k*\ze%(\s*\=)/ contained 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 : '') @@ -174,7 +180,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,jsCommonJS +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,jsAssignmentExpr 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 @@ -194,8 +200,9 @@ if main_syntax == "javascript" syntax sync match jsHighlight grouphere jsBlock /{/ endif -exe 'syntax match jsFunction /\/ nextgroup=jsFuncName,jsFuncArgs skipwhite '.(exists('g:javascript_conceal_function') ? 'conceal cchar='.g:javascript_conceal_function : '') +exe 'syntax match jsFunction /\/ nextgroup=jsGenerator,jsFuncName,jsFuncArgs skipwhite '.(exists('g:javascript_conceal_function') ? 'conceal cchar='.g:javascript_conceal_function : '') +syntax match jsGenerator contained '\*' nextgroup=jsFuncName skipwhite 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 syntax match jsFuncArgCommas contained ',' @@ -250,6 +257,7 @@ if version >= 508 || !exists("did_javascript_syn_inits") HiLink jsKeyword Keyword HiLink jsArrowFunction Type HiLink jsFunction Type + HiLink jsGenerator jsFunction HiLink jsFuncName Function HiLink jsArgsObj Special HiLink jsError Error diff --git a/syntax/perl.vim b/syntax/perl.vim index 73d647a..6fdebdd 100644 --- a/syntax/perl.vim +++ b/syntax/perl.vim @@ -329,19 +329,24 @@ syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@" contained display syn match phpOperator "||\|\" contained display syn match phpOperator "[!=<>]=" contained display syn match phpOperator "[<>]" contained display -syn match phpMemberSelector "->" contained display +syn match phpMemberSelector "->\|::" contained display syn match phpVarSelector "\$" contained display -" highlight object variables inside strings -syn match phpMethodsVar "->\h\w*" contained contains=phpMethods,phpMemberSelector display containedin=phpStringDouble +" highlight static and object variables inside strings +syn match phpMethodsVar "\%(->\|::$\?\)\h\w*" contained contains=phpMethods,phpMemberSelector,phpIdentifier display containedin=phpStringDouble syn match phpSplatOperator "\.\.\." contained display " Identifier diff --git a/syntax/rust.vim b/syntax/rust.vim index 9e663eb..a37b7b6 100644 --- a/syntax/rust.vim +++ b/syntax/rust.vim @@ -3,7 +3,7 @@ " Maintainer: Patrick Walton " Maintainer: Ben Blum " Maintainer: Chris Morgan -" Last Change: July 18, 2014 +" Last Change: January 5, 2015 if version < 600 syntax clear @@ -56,10 +56,10 @@ syn match rustMacroRepeatCount ".\?[*+]" contained syn match rustMacroVariable "$\w\+" " Reserved (but not yet used) keywords {{{2 -syn keyword rustReservedKeyword alignof be do offsetof priv pure sizeof typeof unsized yield abstract final override +syn keyword rustReservedKeyword alignof be do offsetof priv pure sizeof typeof unsized yield abstract final override macro " Built-in types {{{2 -syn keyword rustType int uint float char bool u8 u16 u32 u64 f32 +syn keyword rustType isize usize float char bool u8 u16 u32 u64 f32 syn keyword rustType f64 i8 i16 i32 i64 str Self " Things from the prelude (src/libstd/prelude.rs) {{{2 @@ -68,59 +68,35 @@ syn keyword rustType f64 i8 i16 i32 i64 str Self " 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 -syn keyword rustTrait Index IndexMut -syn keyword rustTrait Slice SliceMut -syn keyword rustTrait Fn FnMut FnOnce +syn keyword rustTrait Drop Fn FnMut FnOnce " Reexported functions {{{3 -"syn keyword rustFunction range repeat -"syn keyword rustFunction drop -"syn keyword rustFunction from_str +syn keyword rustFunction drop " 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 Box +syn keyword rustTrait CharExt syn keyword rustTrait Clone syn keyword rustTrait PartialEq PartialOrd Eq Ord -syn keyword rustEnum Ordering Equiv -syn keyword rustEnumVariant Less Equal Greater -syn keyword rustTrait FromIterator Extend ExactSizeIterator -syn keyword rustTrait Iterator DoubleEndedIterator -syn keyword rustTrait RandomAccessIterator CloneableIterator -syn keyword rustTrait OrdIterator MutableDoubleEndedIterator -syn keyword rustTrait ToPrimitive FromPrimitive -syn keyword rustTrait Box +syn keyword rustTrait DoubleEndedIterator +syn keyword rustTrait ExactSizeIterator +syn keyword rustTrait Iterator IteratorExt Extend syn keyword rustEnum Option syn keyword rustEnumVariant Some None -syn keyword rustTrait GenericPath Path PosixPath WindowsPath -syn keyword rustTrait RawPtr RawMutPtr +syn keyword rustTrait PtrExt MutPtrExt 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 SlicePrelude AsSlice CloneSlicePrelude -syn keyword rustTrait VectorVector PartialEqSlicePrelude OrdSlicePrelude -syn keyword rustTrait CloneSliceAllocPrelude OrdSliceAllocPrelude SliceAllocPrelude -syn keyword rustTrait IntoString String ToString +syn keyword rustTrait AsSlice +syn keyword rustTrait SliceExt SliceConcatExt +syn keyword rustTrait Str StrExt +syn keyword rustTrait 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 +" FIXME: remove when path reform lands +syn keyword rustTrait Path GenericPath +" FIXME: remove when I/O reform lands +syn keyword rustTrait Buffer Writer Reader Seek BufferPrelude " Other syntax {{{2 - syn keyword rustSelf self syn keyword rustBoolean true false @@ -157,14 +133,14 @@ syn region rustString start=+b"+ skip=+\\\\\|\\"+ end=+"+ contains=rustE syn region rustString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustEscape,rustEscapeUnicode,rustEscapeError,rustStringContinuation,@Spell syn region rustString start='b\?r\z(#*\)"' end='"\z1' contains=@Spell -syn region rustAttribute start="#!\?\[" end="\]" contains=rustString,rustDeriving -syn region rustDeriving start="deriving(" end=")" contained contains=rustTrait +syn region rustAttribute start="#!\?\[" end="\]" contains=rustString,rustDerive +syn region rustDerive start="derive(" end=")" contained contains=rustTrait " Number literals -syn match rustDecNumber display "\<[0-9][0-9_]*\%([iu]\%(8\|16\|32\|64\)\=\)\=" -syn match rustHexNumber display "\<0x[a-fA-F0-9_]\+\%([iu]\%(8\|16\|32\|64\)\=\)\=" -syn match rustOctNumber display "\<0o[0-7_]\+\%([iu]\%(8\|16\|32\|64\)\=\)\=" -syn match rustBinNumber display "\<0b[01_]\+\%([iu]\%(8\|16\|32\|64\)\=\)\=" +syn match rustDecNumber display "\<[0-9][0-9_]*\%([iu]\%(s\|8\|16\|32\|64\)\)\=" +syn match rustHexNumber display "\<0x[a-fA-F0-9_]\+\%([iu]\%(s\|8\|16\|32\|64\)\)\=" +syn match rustOctNumber display "\<0o[0-7_]\+\%([iu]\%(s\|8\|16\|32\|64\)\)\=" +syn match rustBinNumber display "\<0b[01_]\+\%([iu]\%(s\|8\|16\|32\|64\)\)\=" " Special case for numbers of the form "1." which are float literals, unless followed by " an identifier, which makes them integer literals with a method call or field access, @@ -263,7 +239,7 @@ hi def link rustMacro Macro hi def link rustType Type hi def link rustTodo Todo hi def link rustAttribute PreProc -hi def link rustDeriving PreProc +hi def link rustDerive PreProc hi def link rustStorage StorageClass hi def link rustObsoleteStorage Error hi def link rustLifetime Special @@ -275,7 +251,7 @@ hi def link rustBoxPlacementExpr rustKeyword " Other Suggestions: " hi rustAttribute ctermfg=cyan -" hi rustDeriving ctermfg=cyan +" hi rustDerive ctermfg=cyan " hi rustAssert ctermfg=yellow " hi rustPanic ctermfg=red " hi rustMacro ctermfg=magenta diff --git a/syntax/tomdoc.vim b/syntax/tomdoc.vim new file mode 100644 index 0000000..ad607cd --- /dev/null +++ b/syntax/tomdoc.vim @@ -0,0 +1,18 @@ +syn keyword tomdocKeywords + \ Returns Yields Raises Examples Signature + \ containedin=.*Comment + \ contained + +syn match tomdocDescriptions + \ +\s*\(Public\|Internal\|Deprecated\):+he=e-1 + \ containedin=.*Comment + \ contained + +syn match tomdocArguments + \ +\s*[A-Za-z0-9_\-&\*:]*\(\s*- \)+he=e-3 + \ containedin=.*Comment + \ contained + +hi default link tomdocDescriptions String +hi default link tomdocKeywords String +hi default link tomdocArguments HELP