diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2015-02-11 11:27:11 -0800 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2015-02-11 11:27:11 -0800 |
commit | 6cd2d5417d728ea96c5c52b34629c944a89eec60 (patch) | |
tree | f6d49573e7a22b1ede56055d3952707eab085c18 | |
parent | b7a30b1f1a963902d9743ae229a1f9d18b887e17 (diff) | |
download | vim-polyglot-6cd2d5417d728ea96c5c52b34629c944a89eec60.tar.gz vim-polyglot-6cd2d5417d728ea96c5c52b34629c944a89eec60.zip |
Updatev1.11.4
-rw-r--r-- | after/syntax/help.vim | 10 | ||||
-rw-r--r-- | compiler/sbt.vim | 30 | ||||
-rw-r--r-- | ftdetect/polyglot.vim | 6 | ||||
-rw-r--r-- | ftplugin/csv.vim | 99 | ||||
-rw-r--r-- | ftplugin/jade.vim | 2 | ||||
-rw-r--r-- | ftplugin/latex-box/common.vim | 32 | ||||
-rw-r--r-- | ftplugin/latex-box/complete.vim | 3 | ||||
-rw-r--r-- | ftplugin/latex-box/folding.vim | 4 | ||||
-rw-r--r-- | ftplugin/latex-box/motion.vim | 25 | ||||
-rw-r--r-- | ftplugin/perl.vim | 2 | ||||
-rw-r--r-- | ftplugin/perl6.vim | 15 | ||||
-rw-r--r-- | ftplugin/scala.vim | 81 | ||||
-rw-r--r-- | ftplugin/scala/tagbar.vim | 47 | ||||
-rw-r--r-- | ftplugin/toml.vim | 2 | ||||
-rw-r--r-- | indent/go.vim | 9 | ||||
-rw-r--r-- | indent/javascript.vim | 4 | ||||
-rw-r--r-- | indent/scala.vim | 11 | ||||
-rw-r--r-- | syntax/javascript.vim | 76 | ||||
-rw-r--r-- | syntax/jst.vim | 12 | ||||
-rw-r--r-- | syntax/ruby.vim | 11 | ||||
-rw-r--r-- | syntax/scala.vim | 50 | ||||
-rw-r--r-- | syntax/tmux.vim | 289 |
22 files changed, 611 insertions, 209 deletions
diff --git a/after/syntax/help.vim b/after/syntax/help.vim index b352a1e6..e3232128 100644 --- a/after/syntax/help.vim +++ b/after/syntax/help.vim @@ -1,6 +1,12 @@ -let b:current_syntax = '' -unlet b:current_syntax +" Extends standard help syntax with highlighting of Scala code. +" +" Place code between !sc! and !/sc! delimiters. These will be hidden if Vim is +" built with conceal support. + +unlet! b:current_syntax + syntax include @ScalaCode syntax/scala.vim + if has('conceal') syntax region rgnScala matchgroup=Ignore concealends start='!sc!' end='!/sc!' contains=@ScalaCode else diff --git a/compiler/sbt.vim b/compiler/sbt.vim new file mode 100644 index 00000000..4c621922 --- /dev/null +++ b/compiler/sbt.vim @@ -0,0 +1,30 @@ +" Vim compiler file +" Language: Scala SBT (http://www.scala-sbt.org/) +" Maintainer: Derek Wyatt +" URL: https://github.com/derekwyatt/vim-scala +" License: Apache 2 +" ---------------------------------------------------------------------------- + +if exists('current_compiler') + finish +endif +let current_compiler = 'sbt' + +if exists(':CompilerSet') != 2 " older Vim always used :setlocal + command -nargs=* CompilerSet setlocal <args> +endif + +let s:cpo_save = &cpo +set cpo-=C + +CompilerSet makeprg=sbt\ -Dsbt.log.noformat=true\ compile + +CompilerSet errorformat= + \%E\ %#[error]\ %f:%l:\ %m,%C\ %#[error]\ %p^,%-C%.%#,%Z, + \%W\ %#[warn]\ %f:%l:\ %m,%C\ %#[warn]\ %p^,%-C%.%#,%Z, + \%-G%.%# + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim:set sw=2 sts=2 ts=8 et: diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index 168b9d25..eb2ab691 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -86,6 +86,7 @@ augroup END au BufNewFile,BufRead *.ejs set filetype=jst au BufNewFile,BufRead *.jst set filetype=jst au BufNewFile,BufRead *.hamljs set filetype=jst +au BufNewFile,BufRead *.ect set filetype=jst autocmd BufNewFile,BufRead *.less setf less au BufNewFile,BufRead *.liquid set ft=liquid au BufNewFile,BufRead */_layouts/*.html,*/_includes/*.html set ft=liquid @@ -178,14 +179,15 @@ au BufNewFile,BufRead [Bb]uildfile call s:setf('ruby') au BufNewFile,BufRead Appraisals call s:setf('ruby') au BufNewFile,BufRead Podfile,*.podspec call s:setf('ruby') au BufRead,BufNewFile *.rs set filetype=rust -au BufRead,BufNewFile *.sbt set filetype=sbt +au BufRead,BufNewFile *.sbt set filetype=sbt.scala fun! s:DetectScala() if getline(1) == '#!/usr/bin/env scala' set filetype=scala endif endfun -au BufRead,BufNewFile *.scala,*.sbt set filetype=scala +au BufRead,BufNewFile *.scala set filetype=scala au BufRead,BufNewFile * call s:DetectScala() +au BufRead,BufNewFile *.sbt setfiletype sbt.scala autocmd BufNewFile,BufRead *.slim set filetype=slim autocmd BufNewFile,BufReadPost *.styl set filetype=stylus autocmd BufNewFile,BufReadPost *.stylus set filetype=stylus diff --git a/ftplugin/csv.vim b/ftplugin/csv.vim index 95b609c9..e7455cb1 100644 --- a/ftplugin/csv.vim +++ b/ftplugin/csv.vim @@ -41,7 +41,9 @@ fu! <sid>Warn(mess) "{{{3 echohl Normal endfu -fu! <sid>Init(startline, endline) "{{{3 +fu! <sid>Init(startline, endline, ...) "{{{3 + " if a:1 is set, keep the b:delimiter + let keep = exists("a:1") && a:1 " Hilight Group for Columns if exists("g:csv_hiGroup") let s:hiGroup = g:csv_hiGroup @@ -56,10 +58,12 @@ fu! <sid>Init(startline, endline) "{{{3 exe "hi link CSVHeaderLine" s:hiHeader " Determine default Delimiter - if !exists("g:csv_delim") - let b:delimiter=<SID>GetDelimiter(a:startline, a:endline) - else - let b:delimiter=g:csv_delim + if !keep + if !exists("g:csv_delim") + let b:delimiter=<SID>GetDelimiter(a:startline, a:endline) + else + let b:delimiter=g:csv_delim + endif endif " Define custom commentstring @@ -579,7 +583,15 @@ fu! <sid>ColWidth(colnr) "{{{3 if !exists("b:csv_fixed_width_cols") if !exists("b:csv_list") - let b:csv_list=getline(1,'$') + " only check first 10000 lines, to be faster + let last = line('$') + if !get(b:, 'csv_arrange_use_all_rows', 0) + if last > 10000 + let last = 10000 + call <sid>Warn('File too large, only checking the first 10000 rows for the width') + endif + endif + let b:csv_list=getline(1,last) let pat = '^\s*\V'. escape(b:csv_cmt[0], '\\') call filter(b:csv_list, 'v:val !~ pat') call filter(b:csv_list, '!empty(v:val)') @@ -646,15 +658,40 @@ fu! <sid>ArrangeCol(first, last, bang, limit) range "{{{3 else let ro = 0 endif - exe "sil". a:first . ',' . a:last .'s/' . (b:col) . - \ '/\=<SID>Columnize(submatch(0))/' . (&gd ? '' : 'g') - " Clean up variables, that were only needed for <sid>Columnize() function - unlet! s:columnize_count s:max_cols s:prev_line - if ro - setl ro - unlet ro + let s:count = 0 + let _stl = &stl + let s:max = (a:last - a:first + 1) * len(b:col_width) + let s:temp = 0 + try + exe "sil". a:first . ',' . a:last .'s/' . (b:col) . + \ '/\=<SID>Columnize(submatch(0))/' . (&gd ? '' : 'g') + finally + " Clean up variables, that were only needed for <sid>Columnize() function + unlet! s:columnize_count s:max_cols s:prev_line s:max s:count s:temp s:val + if ro + setl ro + unlet ro + endif + let &stl = _stl + call winrestview(cur) + endtry +endfu + +fu! <sid>ProgressBar(cnt, max) "{{{3 + if get(g:, 'csv_no_progress', 0) + return + endif + let width = 40 " max width of progressbar + if width > &columns + let width = &columns + endif + let s:val = a:cnt * width / a:max + if (s:val > s:temp || a:cnt==1) + let &stl='%#DiffAdd#['.repeat('=', s:val).'>'. repeat(' ', width-s:val).']'. + \ (width < &columns ? ' '.100*s:val/width. '%%' : '') + redrawstatus + let s:temp = s:val endif - call winrestview(cur) endfu fu! <sid>PrepUnArrangeCol(first, last) "{{{3 @@ -706,9 +743,7 @@ fu! <sid>CalculateColumnWidth() "{{{3 endtry " 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 + unlet! b:csv_list s:columnize_count s:decimal_column endfu fu! <sid>Columnize(field) "{{{3 @@ -725,6 +760,7 @@ fu! <sid>Columnize(field) "{{{3 if exists("s:prev_line") && s:prev_line != line('.') let s:columnize_count = 0 endif + let s:count+=1 let s:prev_line = line('.') " convert zero based indexed list to 1 based indexed list, @@ -733,8 +769,8 @@ fu! <sid>Columnize(field) "{{{3 " let width=get(b:col_width,<SID>WColumn()-1,20) " is too slow, so we are using: let colnr = s:columnize_count % s:max_cols - let width=get(b:col_width, colnr, 20) - let align='r' + 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 @@ -747,9 +783,10 @@ fu! <sid>Columnize(field) "{{{3 \ align isnot? 'c' && align isnot? '.') || get(b:, 'csv_arrange_leftalign', 0)) let align = 'r' endif + call <sid>ProgressBar(s:count,s:max) let s:columnize_count += 1 - let has_delimiter = (a:field =~# b:delimiter.'$') + let has_delimiter = (a:field[-1:] is? b:delimiter) if align is? 'l' " left-align content return printf("%-*S%s", width+1 , @@ -1910,7 +1947,8 @@ fu! <sid>CommandDefinitions() "{{{3 call <sid>LocalCmd("UnArrangeColumn", \':call <sid>PrepUnArrangeCol(<line1>, <line2>)', \ '-range') - call <sid>LocalCmd("InitCSV", ':call <sid>Init(<line1>,<line2>)', '-range=%') + call <sid>LocalCmd("InitCSV", ':call <sid>Init(<line1>,<line2>,<bang>0)', + \ '-bang -range=%') call <sid>LocalCmd('Header', \ ':call <sid>SplitHeaderLine(<q-args>,<bang>0,1)', \ '-nargs=? -bang') @@ -2232,6 +2270,10 @@ fu! <sid>NrColumns(bang) "{{{3 endfu fu! <sid>Tabularize(bang, first, last) "{{{3 + if match(split(&ft, '\.'),'csv') == -1 + call <sid>Warn("No CSV filetype, aborting!") + return + endif let _c = winsaveview() " Table delimiter definition "{{{4 if !exists("s:td") @@ -2307,10 +2349,7 @@ fu! <sid>Tabularize(bang, first, last) "{{{3 call <sid>Warn('An error occured, aborting!') return endif - 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) + if getline(a:first)[-1:] isnot? b:delimiter 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 @@ -2335,12 +2374,14 @@ fu! <sid>Tabularize(bang, first, last) "{{{3 call append(a:first + s:csv_fold_headerline, marginline) let adjust_last += 1 endif + " Syntax will be turned off, so disable this part + " " Adjust headerline to header of new table - let b:csv_headerline = (exists('b:csv_headerline')?b:csv_headerline+2:3) - call <sid>CheckHeaderLine() + "let b:csv_headerline = (exists('b:csv_headerline')?b:csv_headerline+2:3) + "call <sid>CheckHeaderLine() " Adjust syntax highlighting - unlet! b:current_syntax - ru syntax/csv.vim + "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, diff --git a/ftplugin/jade.vim b/ftplugin/jade.vim index 235770d0..577f5547 100644 --- a/ftplugin/jade.vim +++ b/ftplugin/jade.vim @@ -11,6 +11,8 @@ endif let s:save_cpo = &cpo set cpo-=C +setlocal iskeyword+=- + " Define some defaults in case the included ftplugins don't set them. let s:undo_ftplugin = "" let s:browsefilter = "All Files (*.*)\t*.*\n" diff --git a/ftplugin/latex-box/common.vim b/ftplugin/latex-box/common.vim index bf6305cc..59cf95d6 100644 --- a/ftplugin/latex-box/common.vim +++ b/ftplugin/latex-box/common.vim @@ -64,14 +64,24 @@ setlocal efm+=%-G%.%# " Vim Windows {{{ -" Width of vertical splits +" Type of split, "new" for horiz. "vnew" for vert. +if !exists('g:LatexBox_split_type') + let g:LatexBox_split_type = "vnew" +endif + +" Length of vertical splits +if !exists('g:LatexBox_split_length') + let g:LatexBox_split_length = 15 +endif + +" Width of horizontal splits if !exists('g:LatexBox_split_width') let g:LatexBox_split_width = 30 endif -" Where vertical splits appear +" Where splits appear if !exists('g:LatexBox_split_side') - let g:LatexBox_split_side = "leftabove" + let g:LatexBox_split_side = "aboveleft" endif " Resize when split? @@ -229,12 +239,18 @@ endfunction " Default pdf viewer if !exists('g:LatexBox_viewer') - if has('win32') - " On windows, 'running' a file will open it with the default program - let g:LatexBox_viewer = '' - else - let g:LatexBox_viewer = 'xdg-open' + " On windows, 'running' a file will open it with the default program + let s:viewer = '' + if has('unix') + " echo -n necessary as uname -s will append \n otherwise + let s:uname = system('echo -n $(uname -s)') + if s:uname == "Darwin" + let s:viewer = 'open' + else + let s:viewer = 'xdg-open' + endif endif + let g:LatexBox_viewer = s:viewer endif function! LatexBox_View(...) diff --git a/ftplugin/latex-box/complete.vim b/ftplugin/latex-box/complete.vim index 150b00e7..0ab8f974 100644 --- a/ftplugin/latex-box/complete.vim +++ b/ftplugin/latex-box/complete.vim @@ -459,7 +459,8 @@ function! s:GetLabelCache(file) if !has_key(s:LabelCache , a:file) || s:LabelCache[a:file][0] != getftime(a:file) " Open file in temporary split window for label extraction. - silent execute '1sp +let\ labels=s:ExtractLabels()|let\ inputs=s:ExtractInputs()|quit! ' . fnameescape(a:file) + let main_tex_file = LatexBox_GetMainTexFile() + silent execute '1sp +let\ b:main_tex_file=main_tex_file|let\ labels=s:ExtractLabels()|let\ inputs=s:ExtractInputs()|quit! ' . fnameescape(a:file) let s:LabelCache[a:file] = [ getftime(a:file), labels, inputs ] endif diff --git a/ftplugin/latex-box/folding.vim b/ftplugin/latex-box/folding.vim index 5d733c23..aedca8f6 100644 --- a/ftplugin/latex-box/folding.vim +++ b/ftplugin/latex-box/folding.vim @@ -75,8 +75,8 @@ if g:LatexBox_fold_automatic == 1 " augroup FastFold autocmd! - autocmd InsertEnter *.tex setlocal foldmethod=manual - autocmd InsertLeave *.tex setlocal foldmethod=expr + autocmd InsertEnter *.tex if !&diff | setlocal foldmethod=manual | endif + autocmd InsertLeave *.tex if !&diff | setlocal foldmethod=expr | endif augroup end else setl foldmethod=manual diff --git a/ftplugin/latex-box/motion.vim b/ftplugin/latex-box/motion.vim index 41605aea..7e5b0011 100644 --- a/ftplugin/latex-box/motion.vim +++ b/ftplugin/latex-box/motion.vim @@ -349,7 +349,7 @@ function! s:ReadTOC(auxfile, texfile, ...) if len(tree) > 3 && empty(tree[1]) call remove(tree, 1) endif - if len(tree) > 1 && tree[0] =~ '^\\\(numberline\|tocsection\)' + if len(tree) > 1 && type(tree[0]) == type("") && tree[0] =~ '^\\\(numberline\|tocsection\)' let secnum = LatexBox_TreeToTex(tree[1]) let secnum = substitute(secnum, '\\\S\+\s', '', 'g') let secnum = substitute(secnum, '\\\S\+{\(.\{-}\)}', '\1', 'g') @@ -379,6 +379,21 @@ function! LatexBox_TOC(...) " Check if window already exists let winnr = bufwinnr(bufnr('LaTeX TOC')) + " Two types of splits, horizontal and vertical + let l:hori = "new" + let l:vert = "vnew" + + " Set General Vars and initialize size + let l:type = g:LatexBox_split_type + let l:size = 10 + + " Size detection + if l:type == l:hori + let l:size = g:LatexBox_split_length + elseif l:type == l:vert + let l:size = g:LatexBox_split_width + endif + if winnr >= 0 if a:0 == 0 silent execute winnr . 'wincmd w' @@ -386,13 +401,12 @@ function! LatexBox_TOC(...) " Supplying an argument to this function causes toggling instead " of jumping to the TOC window if g:LatexBox_split_resize - silent exe "set columns-=" . g:LatexBox_split_width + silent exe "set columns-=" . l:size endif silent execute 'bwipeout' . bufnr('LaTeX TOC') endif return endif - " Read TOC let [toc, fileindices] = s:ReadTOC(LatexBox_GetAuxFile(), \ LatexBox_GetMainTexFile()) @@ -403,9 +417,10 @@ function! LatexBox_TOC(...) " Create TOC window and set local settings if g:LatexBox_split_resize - silent exe "set columns+=" . g:LatexBox_split_width + silent exe "set columns+=" . l:size endif - silent exe g:LatexBox_split_side g:LatexBox_split_width . 'vnew LaTeX\ TOC' + silent exe g:LatexBox_split_side l:size . l:type . ' LaTeX\ TOC' + let b:toc = toc let b:toc_numbers = 1 let b:calling_win = bufwinnr(calling_buf) diff --git a/ftplugin/perl.vim b/ftplugin/perl.vim index d52015e3..89ce8a1b 100644 --- a/ftplugin/perl.vim +++ b/ftplugin/perl.vim @@ -77,7 +77,7 @@ endif "--------------------------------------------- " Undo the stuff we changed. -let b:undo_ftplugin = "setlocal fo< com< cms< inc< inex< def< isf< kp< path<" . +let b:undo_ftplugin = "setlocal fo< com< cms< inc< inex< def< isk< isf< kp< path<" . \ " | unlet! b:browsefilter" " proper matching for matchit plugin diff --git a/ftplugin/perl6.vim b/ftplugin/perl6.vim index 4082ef24..ebb39555 100644 --- a/ftplugin/perl6.vim +++ b/ftplugin/perl6.vim @@ -65,11 +65,22 @@ if !exists("perlpath") endif endif -let &l:path=perlpath +" Append perlpath to the existing path value, if it is set. Since we don't +" use += to do it because of the commas in perlpath, we have to handle the +" global / local settings, too. +if &l:path == "" + if &g:path == "" + let &l:path=perlpath + else + let &l:path=&g:path.",".perlpath + endif +else + let &l:path=&l:path.",".perlpath +endif "--------------------------------------------- " Undo the stuff we changed. -let b:undo_ftplugin = "setlocal fo< com< cms< inc< inex< def< isk<" . +let b:undo_ftplugin = "setlocal fo< com< cms< inc< inex< def< isf< isk< kp< path<" . \ " | unlet! b:browsefilter" " Restore the saved compatibility options. diff --git a/ftplugin/scala.vim b/ftplugin/scala.vim index 3f0de967..d723eece 100644 --- a/ftplugin/scala.vim +++ b/ftplugin/scala.vim @@ -1,14 +1,33 @@ -setlocal formatoptions+=ro -setlocal commentstring=//%s -let &l:include = '^\s*import' -let &l:includeexpr = 'substitute(v:fname,"\\.","/","g")' +" Vim filetype plugin +" Language: Scala +" Maintainer: Derek Wyatt +" URL: https://github.com/derekwyatt/vim-scala +" License: Apache 2 +" ---------------------------------------------------------------------------- + +if exists('b:did_ftplugin') || &cp + finish +endif +let b:did_ftplugin = 1 + +" j is fairly new in Vim, so don't complain if it's not there +setlocal formatoptions-=t formatoptions+=croqnl +silent! setlocal formatoptions+=j + +" Just like c.vim, but additionally doesn't wrap text onto /** line when +" formatting. Doesn't bungle bulleted lists when formatting. +setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/**,mb:*,ex:*/,s1:/*,mb:*,ex:*/,:// +setlocal commentstring=//\ %s + +setlocal shiftwidth=2 softtabstop=2 expandtab + +setlocal include='^\s*import' +setlocal includeexpr='substitute(v:fname,"\\.","/","g")' + setlocal path+=src/main/scala,src/test/scala setlocal suffixesadd=.scala -set makeprg=sbt\ -Dsbt.log.noformat=true\ compile -set efm=%E\ %#[error]\ %f:%l:\ %m,%C\ %#[error]\ %p^,%-C%.%#,%Z, - \%W\ %#[warn]\ %f:%l:\ %m,%C\ %#[warn]\ %p^,%-C%.%#,%Z, - \%-G%.%# +compiler sbt if globpath(&rtp, 'plugin/fuf.vim') != '' " @@ -127,49 +146,6 @@ if globpath(&rtp, 'plugin/fuf.vim') != '' endif endif -" If you want to disable the default key mappings, write the following line in -" your ~/.vimrc -" let g:scala_use_default_keymappings = 0 -if get(g:, 'scala_use_default_keymappings', 1) - nnoremap <buffer> <Leader>jt :call JustifyCurrentLine()<cr> -endif - -" -" TagBar -" -let g:tagbar_type_scala = { - \ 'ctagstype' : 'scala', - \ 'kinds' : [ - \ 'p:packages:1', - \ 'V:values', - \ 'v:variables', - \ 'T:types', - \ 't:traits', - \ 'o:objects', - \ 'a:aclasses', - \ 'c:classes', - \ 'r:cclasses', - \ 'm:methods' - \ ], - \ 'sro' : '.', - \ 'kind2scope' : { - \ 'T' : 'type', - \ 't' : 'trait', - \ 'o' : 'object', - \ 'a' : 'abstract class', - \ 'c' : 'class', - \ 'r' : 'case class' - \ }, - \ 'scope2kind' : { - \ 'type' : 'T', - \ 'trait' : 't', - \ 'object' : 'o', - \ 'abstract class' : 'a', - \ 'class' : 'c', - \ 'case class' : 'r' - \ } -\ } - function! s:CreateOrExpression(keywords) return '('.join(a:keywords, '|').')' endfunction @@ -191,5 +167,6 @@ function! s:NextSection(backwards) endfunction noremap <script> <buffer> <silent> ]] :call <SID>NextSection(0)<cr> - noremap <script> <buffer> <silent> [[ :call <SID>NextSection(1)<cr> + +" vim:set sw=2 sts=2 ts=8 et: diff --git a/ftplugin/scala/tagbar.vim b/ftplugin/scala/tagbar.vim new file mode 100644 index 00000000..19353ef1 --- /dev/null +++ b/ftplugin/scala/tagbar.vim @@ -0,0 +1,47 @@ +" +" Support for Tagbar -- https://github.com/majutsushi/tagbar +" +" Hat tip to Leonard Ehrenfried for the built-in ctags deffile: +" https://leonard.io/blog/2013/04/editing-scala-with-vim/ +" +if !exists(':Tagbar') + finish +endif + +let g:tagbar_type_scala = { + \ 'ctagstype' : 'scala', + \ 'kinds' : [ + \ 'p:packages:1', + \ 'V:values', + \ 'v:variables', + \ 'T:types', + \ 't:traits', + \ 'o:objects', + \ 'a:aclasses', + \ 'c:classes', + \ 'r:cclasses', + \ 'm:methods' + \ ], + \ 'sro' : '.', + \ 'kind2scope' : { + \ 'T' : 'type', + \ 't' : 'trait', + \ 'o' : 'object', + \ 'a' : 'abstract class', + \ 'c' : 'class', + \ 'r' : 'case class' + \ }, + \ 'scope2kind' : { + \ 'type' : 'T', + \ 'trait' : 't', + \ 'object' : 'o', + \ 'abstract class' : 'a', + \ 'class' : 'c', + \ 'case class' : 'r' + \ } +\ } + +" In case you've updated/customized your ~/.ctags and prefer to use it. +if get(g:, 'scala_use_builtin_tagbar_defs', 1) + let g:tagbar_type_scala.deffile = expand('<sfile>:p:h:h:h') . '/ctags/scala.ctags' +endif diff --git a/ftplugin/toml.vim b/ftplugin/toml.vim index 141157dd..6e205c23 100644 --- a/ftplugin/toml.vim +++ b/ftplugin/toml.vim @@ -11,6 +11,8 @@ let b:did_ftplugin = 1 let s:save_cpo = &cpo set cpo&vim +setlocal commentstring=#\ %s + " Add NERDCommenter delimiters let s:delims = { 'left': '#' } diff --git a/indent/go.vim b/indent/go.vim index faf4d79e..660aa506 100644 --- a/indent/go.vim +++ b/indent/go.vim @@ -37,20 +37,21 @@ function! GoIndent(lnum) let previ = indent(prevlnum) let ind = previ + let s:shiftwidth = shiftwidth() if prevl =~ '[({]\s*$' " previous line opened a block - let ind += &sw + let ind += s:shiftwidth endif if prevl =~# '^\s*\(case .*\|default\):$' " previous line is part of a switch statement - let ind += &sw + let ind += s:shiftwidth endif " TODO: handle if the previous line is a label. if thisl =~ '^\s*[)}]' " this line closed a block - let ind -= &sw + let ind -= s:shiftwidth endif " Colons are tricky. @@ -58,7 +59,7 @@ function! GoIndent(lnum) " We ignore trying to deal with jump labels because (a) they're rare, and " (b) they're hard to disambiguate from a composite literal key. if thisl =~# '^\s*\(case .*\|default\):$' - let ind -= &sw + let ind -= s:shiftwidth endif return ind diff --git a/indent/javascript.vim b/indent/javascript.vim index d483409e..0a2f839e 100644 --- a/indent/javascript.vim +++ b/indent/javascript.vim @@ -49,11 +49,11 @@ let s:skip_expr = "synIDattr(synID(line('.'),col('.'),1),'name') =~ '".s:syng_st let s:line_term = '\s*\%(\%(\/\/\).*\)\=$' " Regex that defines continuation lines, not including (, {, or [. -let s:continuation_regex = '\%([\\*+/.:]\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\)' . s:line_term +let s:continuation_regex = '\%([\\*+/.:]\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\|[^=]=[^=].*,\)' . s:line_term " Regex that defines continuation lines. " TODO: this needs to deal with if ...: and so on -let s:msl_regex = '\%([\\*+/.:([]\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\)' . s:line_term +let s:msl_regex = s:continuation_regex let s:one_line_scope_regex = '\<\%(if\|else\|for\|while\)\>[^{;]*' . s:line_term diff --git a/indent/scala.vim b/indent/scala.vim index f533a514..4930becd 100644 --- a/indent/scala.vim +++ b/indent/scala.vim @@ -9,13 +9,9 @@ if exists("b:did_indent") endif let b:did_indent = 1 +setlocal autoindent setlocal indentexpr=GetScalaIndent() setlocal indentkeys=0{,0},0),!^F,<>>,o,O,e,=case,<CR> -setlocal autoindent -setlocal softtabstop=2 -setlocal tabstop=2 -setlocal shiftwidth=2 -setlocal expandtab if exists("*GetScalaIndent") finish @@ -543,7 +539,7 @@ function! GetScalaIndent() let ind = ind - 1 endif - if scala#LineEndsInIncomplete(curline) + if scala#LineEndsInIncomplete(prevline) call scala#ConditionalConfirm("19") return ind endif @@ -597,5 +593,6 @@ function! GetScalaIndent() return ind endfunction -" vim:set ts=2 sts=2 sw=2: + +" vim:set sw=2 sts=2 ts=8 et: " vim600:fdm=marker fdl=1 fdc=0: diff --git a/syntax/javascript.vim b/syntax/javascript.vim index 0ef56cbc..56c7422d 100644 --- a/syntax/javascript.vim +++ b/syntax/javascript.vim @@ -35,7 +35,13 @@ 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 +syntax keyword jsModules import export contained +syntax keyword jsModuleWords default from as contained +syntax keyword jsOf of contained + +syntax region jsImportContainer start="^\s\?import \?" end="$" contains=jsModules,jsModuleWords,jsComment,jsStringS,jsStringD,jsTemplateString + +syntax region jsExportContainer start="^\s\?export \?" end="$" contains=jsModules,jsModuleWords,jsComment,jsTemplateString,jsStringD,jsStringS,jsRegexpString,jsNumber,jsFloat,jsThis,jsOperator,jsBooleanTrue,jsBooleanFalse,jsNull,jsFunction,jsArrowFunction,jsGlobalObjects,jsExceptions,jsDomErrNo,jsDomNodeConsts,jsHtmlEvents,jsDotNotation,jsBracket,jsParen,jsFuncCall,jsUndefined,jsNan,jsKeyword,jsClass,jsStorageClass,jsPrototype,jsBuiltins,jsNoise,jsAssignmentExpr "" JavaScript comments syntax keyword jsCommentTodo TODO FIXME XXX TBD contained @@ -53,7 +59,7 @@ if !exists("javascript_ignore_javaScriptdoc") "syntax include @javaHtml <sfile>:p:h/html.vim "unlet b:current_syntax - syntax region jsDocComment matchgroup=jsComment start="/\*\*\s*" end="\*/" contains=jsDocTags,jsCommentTodo,jsCvsTag,@jsHtml,@Spell fold + syntax region jsBlockComment matchgroup=jsComment start="/\*\s*" end="\*/" contains=jsDocTags,jsCommentTodo,jsCvsTag,@jsHtml,@Spell fold " tags containing a param 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 @@ -79,26 +85,27 @@ endif "" JSDoc end syntax case match "" Syntax in the JavaScript code -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 jsRegexpCharClass start=+\[+ skip=+\\.+ end=+\]+ contained +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 jsTaggedTemplate start=/\k\+\(\(\n\|\s\)\+\)\?`/ end=+`\|$+ contains=jsTemplateString +syntax region jsRegexpCharClass start=+\[+ skip=+\\.+ end=+\]+ contained syntax match jsRegexpBoundary "\v%(\<@![\^$]|\\[bB])" contained -syntax match jsRegexpBackRef "\v\\[1-9][0-9]*" contained +syntax match jsRegexpBackRef "\v\\[1-9][0-9]*" contained syntax match jsRegexpQuantifier "\v\\@<!%([?*+]|\{\d+%(,|,\d+)?})\??" contained -syntax match jsRegexpOr "\v\<@!\|" contained -syntax match jsRegexpMod "\v\(@<=\?[:=!>]" contained -syntax cluster jsRegexpSpecial contains=jsSpecial,jsRegexpBoundary,jsRegexpBackRef,jsRegexpQuantifier,jsRegexpOr,jsRegexpMod -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\|[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 jsRegexpOr "\v\<@!\|" contained +syntax match jsRegexpMod "\v\(@<=\?[:=!>]" contained +syntax cluster jsRegexpSpecial contains=jsSpecial,jsRegexpBoundary,jsRegexpBackRef,jsRegexpQuantifier,jsRegexpOr,jsRegexpMod +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\|[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 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 @@ -112,23 +119,26 @@ exe 'syntax keyword jsUndefined undefined '.(exists('g:javascript_conceal_undefi 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 : '') +exe 'syntax keyword jsStatic static '.(exists('g:javascript_conceal_static') ? 'conceal cchar='.g:javascript_conceal_static : '') +exe 'syntax keyword jsSuper super '.(exists('g:javascript_conceal_super') ? 'conceal cchar='.g:javascript_conceal_super : '') "" 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 import export default extends class +syntax keyword jsKeyword yield +syntax keyword jsClass 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 +syntax keyword jsGlobalObjects Array Boolean Date Function Iterator Number Object Symbol Map WeakMap Set RegExp String Proxy Promise ParallelArray ArrayBuffer DataView Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray Intl JSON Math console document window syntax match jsGlobalObjects /\%(Intl\.\)\@<=\(Collator\|DateTimeFormat\|NumberFormat\)/ syntax keyword jsExceptions Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError syntax keyword jsBuiltins decodeURI decodeURIComponent encodeURI encodeURIComponent eval isFinite isNaN parseFloat parseInt uneval -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 +syntax keyword jsFutureKeys abstract enum int short boolean interface byte long char final native synchronized float package throws goto private transient debugger implements protected volatile double public "" DOM/HTML/CSS specified things @@ -178,12 +188,11 @@ endif "DOM/HTML/CSS "" end DOM/HTML/CSS specified things - "" 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,jsAssignmentExpr +syntax cluster jsExpression contains=jsComment,jsLineComment,jsBlockComment,jsTaggedTemplate,jsTemplateString,jsStringD,jsStringS,jsRegexpString,jsNumber,jsFloat,jsThis,jsStatic,jsSuper,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,jsImportContainer,jsExportContainer,jsClass 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 +syntax region jsParen matchgroup=jsParens start="(" end=")" contains=@jsAll,jsOf,jsParensErrA,jsParensErrC,jsParen,jsBracket,jsBlock,@htmlPreproc fold syntax region jsBlock matchgroup=jsBraces start="{" end="}" contains=@jsAll,jsParensErrA,jsParensErrB,jsParen,jsBracket,jsBlock,jsObjectKey,@htmlPreproc fold syntax region jsFuncBlock matchgroup=jsFuncBraces start="{" end="}" contains=@jsAll,jsParensErrA,jsParensErrB,jsParen,jsBracket,jsBlock,@htmlPreproc contained fold syntax region jsTernaryIf matchgroup=jsTernaryIfOperator start=+?+ end=+:+ contains=@jsExpression,jsTernaryIf @@ -204,7 +213,7 @@ exe 'syntax match jsFunction /\<function\>/ nextgroup=jsGenerator,jsFuncName,jsF 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 region jsFuncArgs contained matchgroup=jsFuncParens start='(' end=')' contains=jsFuncArgCommas,jsFuncArgRest,jsAssignmentExpr nextgroup=jsFuncBlock keepend skipwhite skipempty syntax match jsFuncArgCommas contained ',' syntax match jsFuncArgRest contained /\%(\.\.\.[a-zA-Z_$][0-9a-zA-Z_$]*\))/ syntax keyword jsArgsObj arguments contained containedin=jsFuncBlock @@ -225,7 +234,7 @@ if version >= 508 || !exists("did_javascript_syn_inits") HiLink jsComment Comment HiLink jsLineComment Comment HiLink jsEnvComment PreProc - HiLink jsDocComment Comment + HiLink jsBlockComment Comment HiLink jsCommentTodo Todo HiLink jsCvsTag Function HiLink jsDocTags Special @@ -236,6 +245,7 @@ if version >= 508 || !exists("did_javascript_syn_inits") HiLink jsStringS String HiLink jsStringD String HiLink jsTemplateString String + HiLink jsTaggedTemplate StorageClass HiLink jsTernaryIfOperator Conditional HiLink jsRegexpString String HiLink jsRegexpBoundary SpecialChar @@ -266,8 +276,12 @@ if version >= 508 || !exists("did_javascript_syn_inits") HiLink jsParensErrB Error HiLink jsParensErrC Error HiLink jsOperator Operator + HiLink jsOf Operator HiLink jsStorageClass StorageClass + HiLink jsClass Structure HiLink jsThis Special + HiLink jsStatic Special + HiLink jsSuper Special HiLink jsNan Number HiLink jsNull Type HiLink jsUndefined Type @@ -287,7 +301,8 @@ if version >= 508 || !exists("did_javascript_syn_inits") HiLink jsExceptions Special HiLink jsFutureKeys Special HiLink jsBuiltins Special - HiLink jsCommonJS Include + HiLink jsModules Include + HiLink jsModuleWords Include HiLink jsDomErrNo Constant HiLink jsDomNodeConsts Constant @@ -304,10 +319,9 @@ if version >= 508 || !exists("did_javascript_syn_inits") endif " Define the htmlJavaScript for HTML syntax html.vim -"syntax clear htmlJavaScript -"syntax clear jsExpression syntax cluster htmlJavaScript contains=@jsAll,jsBracket,jsParen,jsBlock syntax cluster javaScriptExpression contains=@jsAll,jsBracket,jsParen,jsBlock,@htmlPreproc + " Vim's default html.vim highlights all javascript as 'Special' hi! def link javaScript NONE diff --git a/syntax/jst.vim b/syntax/jst.vim index 25abe238..ea95878b 100644 --- a/syntax/jst.vim +++ b/syntax/jst.vim @@ -24,6 +24,8 @@ elseif !exists("b:jst_subtype") && main_syntax == 'jst' let b:jst_subtype = 'haml' elseif b:jst_subtype == 'ejs' let b:jst_subtype = 'html' + elseif b:jst_subtype == 'ect' + let b:jst_subtype = 'html' elseif b:jst_subtype == 'rb' let b:jst_subtype = 'ruby' elseif b:jst_subtype == 'yml' @@ -70,4 +72,14 @@ if main_syntax == 'jst' unlet main_syntax endif +set commentstring=<!--%s--> + +if exists("loaded_matchit") + let b:match_ignorecase = 1 + let b:match_words = '<:>,' . + \ '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' . + \ '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' . + \ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>' +endif + " vim: nowrap sw=2 sts=2 ts=8: diff --git a/syntax/ruby.vim b/syntax/ruby.vim index a570b14c..a2ebecef 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -130,9 +130,14 @@ syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\[" end="\][io syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r(" end=")[iomxneus]*" skip="\\\\\|\\)" contains=@rubyRegexpSpecial fold " Normal String and Shell Command Output -syn region rubyString matchgroup=rubyStringDelimiter start="\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial fold -syn region rubyString matchgroup=rubyStringDelimiter start="'" end="'" skip="\\\\\|\\'" contains=rubyQuoteEscape fold -syn region rubyString matchgroup=rubyStringDelimiter start="`" end="`" skip="\\\\\|\\`" contains=@rubyStringSpecial fold +if exists('ruby_spellcheck_strings') + syn region rubyString matchgroup=rubyStringDelimiter start="\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial,@Spell fold + syn region rubyString matchgroup=rubyStringDelimiter start="'" end="'" skip="\\\\\|\\'" contains=rubyQuoteEscape,@Spell fold +else + syn region rubyString matchgroup=rubyStringDelimiter start="\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial fold + syn region rubyString matchgroup=rubyStringDelimiter start="'" end="'" skip="\\\\\|\\'" contains=rubyQuoteEscape fold +endif +syn region rubyString matchgroup=rubyStringDelimiter start="`" end="`" skip="\\\\\|\\`" contains=@rubyStringSpecial fold " Generalized Single Quoted String, Symbol and Array of Strings syn region rubyString matchgroup=rubyStringDelimiter start="%[qwi]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold diff --git a/syntax/scala.vim b/syntax/scala.vim index 97189aed..9ac17a96 100644 --- a/syntax/scala.vim +++ b/syntax/scala.vim @@ -1,22 +1,40 @@ -if version < 600 - syntax clear -elseif exists("b:current_syntax") - finish +" Vim syntax file +" Language: Scala +" Maintainer: Derek Wyatt +" URL: https://github.com/derekwyatt/vim-scala +" License: Apache 2 +" ---------------------------------------------------------------------------- + +if !exists('main_syntax') + if version < 600 + syntax clear + elseif exists("b:current_syntax") + finish + endif + let main_syntax = 'scala' endif scriptencoding utf-8 let b:current_syntax = "scala" +" Allows for embedding, see #59; main_syntax convention instead? Refactor TOP +" +" The @Spell here is a weird hack, it means *exclude* if the first group is +" TOP. Otherwise we get spelling errors highlighted on code elements that +" match scalaBlock, even with `syn spell notoplevel`. function! s:ContainedGroup() try silent syn list @scala - return '@scala' + return '@scala,@NoSpell' catch /E392/ - return 'TOP' + return 'TOP,@Spell' endtry endfunction +syn include @scalaHtml syntax/html.vim " Doc comment HTML +unlet! b:current_syntax + syn case match syn sync minlines=200 maxlines=1000 @@ -58,6 +76,9 @@ syn match scalaInstanceHash /#/ contained nextgroup=scalaInstanceDeclaration hi link scalaInstanceDeclaration Special hi link scalaInstanceHash Type +syn match scalaUnimplemented /???/ +hi link scalaUnimplemented ERROR + syn match scalaCapitalWord /\<[A-Z][A-Za-z0-9$]*\>/ hi link scalaCapitalWord Special @@ -97,12 +118,15 @@ hi link scalaCaseFollowing Special syn keyword scalaKeywordModifier abstract override final lazy implicit implicitly private protected sealed null require super hi link scalaKeywordModifier Function -syn keyword scalaSpecial this true false package import ne eq +syn keyword scalaSpecial this true false ne eq syn keyword scalaSpecial new nextgroup=scalaInstanceDeclaration skipwhite syn match scalaSpecial "\%(=>\|⇒\|<-\|←\|->\|→\)" syn match scalaSpecial /`[^`]*`/ " Backtick literals hi link scalaSpecial PreProc +syn keyword scalaExternal package import +hi link scalaExternal Include + syn match scalaStringEmbeddedQuote /\\"/ contained syn region scalaString start=/"/ end=/"/ contains=scalaStringEmbeddedQuote,scalaEscapedChar,scalaUnicodeChar hi link scalaString String @@ -146,7 +170,7 @@ syn match scalaTypeAnnotationParameter /@\<[`_A-Za-z0-9$]\+\>/ contained hi link scalaTypeOperator Keyword hi link scalaTypeAnnotationParameter Function -syn region scalaMultilineComment start="/\*" end="\*/" contains=scalaMultilineComment,scalaDocLinks,scalaParameterAnnotation,scalaCommentAnnotation,scalaCommentCodeBlock,@scalaHtml keepend +syn region scalaMultilineComment start="/\*" end="\*/" contains=scalaMultilineComment,scalaDocLinks,scalaParameterAnnotation,scalaCommentAnnotation,scalaCommentCodeBlock,@scalaHtml,@Spell keepend syn match scalaCommentAnnotation "@[_A-Za-z0-9$]\+" contained syn match scalaParameterAnnotation "@param" nextgroup=scalaParamAnnotationValue skipwhite contained syn match scalaParamAnnotationValue /[`_A-Za-z0-9$]\+/ contained @@ -162,7 +186,7 @@ hi link scalaCommentCodeBlock String syn match scalaAnnotation /@\<[`_A-Za-z0-9$]\+\>/ hi link scalaAnnotation PreProc -syn match scalaTrailingComment "//.*$" +syn match scalaTrailingComment "//.*$" contains=@Spell hi link scalaTrailingComment Comment syn match scalaAkkaFSM /goto([^)]*)\_s\+\<using\>/ contains=scalaAkkaFSMGotoUsing @@ -178,3 +202,11 @@ syn match scalaAkkaFSMGotoUsing /\<using\>/ syn match scalaAkkaFSMGotoUsing /\<goto\>/ hi link scalaAkkaFSM PreProc hi link scalaAkkaFSMGotoUsing PreProc + +let b:current_syntax = 'scala' + +if main_syntax ==# 'scala' + unlet main_syntax +endif + +" vim:set sw=2 sts=2 ts=8 et: diff --git a/syntax/tmux.vim b/syntax/tmux.vim index 361aec1c..4d64514a 100644 --- a/syntax/tmux.vim +++ b/syntax/tmux.vim @@ -3,6 +3,20 @@ " Maintainer: Tiago Cunha <tcunha@users.sourceforge.net> " Last Change: $Date: 2010-07-27 18:29:07 $ " License: This file is placed in the public domain. +" +" To install this file: +" +" - Drop the file in the syntax directory into runtimepath (such as +" ~/.vim/syntax/tmux.vim). +" - Make the filetype recognisable by adding the following to filetype.vim +" (~/.vim/filetype.vim): +" +" augroup filetypedetect +" au BufNewFile,BufRead .tmux.conf*,tmux.conf* setf tmux +" augroup END +" +" - Switch on syntax highlighting by adding "syntax enable" to .vimrc. +" if version < 600 syntax clear @@ -17,60 +31,237 @@ syn keyword tmuxAction any current none syn keyword tmuxBoolean off on syn keyword tmuxCmds - \ attach[-session] detach[-client] has[-session] kill-server - \ kill-session lsc list-clients lscm list-commands ls list-sessions - \ lockc lock-client locks lock-session new[-session] refresh[-client] - \ rename[-session] showmsgs show-messages source[-file] start[-server] - \ suspendc suspend-client switchc switch-client copy-mode - \ breakp break-pane capturep capture-pane choose-client choose-session - \ choose-tree choose-window displayp display-panes findw find-window - \ joinp join-pane killp kill-pane killw kill-window lastp last-pane - \ last[-window] linkw link-window lsp list-panes lsw list-windows movep - \ move-pane movew move-window neww new-window nextl next-layout - \ next[-window] pipep pipe-pane prevl previous-layout prev[ious-window] - \ renamew rename-window resizep resize-pane respawnp respawn-pane - \ respawnw respawn-window rotatew rotate-window selectl select-layout - \ selectp select-pane selectw select-window splitw split-window swapp - \ swap-pane swapw swap-window unlinkw unlink-window - \ bind[-key] lsk list-keys send[-keys] send-prefix unbind[-key] - \ set[-option] setw set-window-option show[-options] showw - \ show-window-options setenv set-environment showenv show-environment - \ command-prompt confirm[-before] display[-message] - \ choose-buffer clearhist clear-history deleteb delete-buffer lsb - \ list-buffers loadb load-buffer pasteb paste-buffer saveb save-buffer - \ setb set-buffer showb show-buffer - \ clock-mode if[-shell] lock[-server] run[-shell] [server-]info + \ attach[-session] + \ bind[-key] + \ break-pane + \ breakp + \ capture-pane + \ capturep + \ choose-buffer + \ choose-client + \ choose-list + \ choose-session + \ choose-tree + \ choose-window + \ clear-history + \ clearhist + \ clock-mode + \ command-prompt + \ confirm[-before] + \ copy-mode + \ delete-buffer + \ deleteb + \ detach[-client] + \ display[-message] + \ display-panes + \ displayp + \ find-window + \ findw + \ has[-session] + \ if[-shell] + \ join-pane + \ joinp + \ kill-pane + \ killp + \ kill-server + \ kill-session + \ kill-window + \ killw + \ last-pane + \ lastp + \ last[-window] + \ link-window + \ linkw + \ list-buffers + \ lsb + \ list-clients + \ lsc + \ list-commands + \ lscm + \ list-keys + \ lsk + \ list-panes + \ lsp + \ list-sessions + \ ls + \ list-windows + \ lsw + \ load-buffer + \ loadb + \ lock-client + \ lockc + \ lock[-server] + \ lock-session + \ locks + \ move-pane + \ movep + \ move-window + \ movew + \ new[-session] + \ next-layout + \ nextl + \ next[-window] + \ paste-buffer + \ pasteb + \ pipe-pane + \ pipep + \ previous-layout + \ prevl + \ prev[ious-window] + \ refresh[-client] + \ rename[-session] + \ rename-window + \ renamew + \ resize-pane + \ resizep + \ respawn-pane + \ respawnp + \ respawn-window + \ respawnw + \ rotate-window + \ rotatew + \ run[-shell] + \ save-buffer + \ saveb + \ select-layout + \ selectl + \ select-pane + \ selectp + \ select-window + \ selectw + \ send[-keys] + \ send-prefix + \ server-info + \ info + \ set-buffer + \ setb + \ set-environment + \ setenv + \ set[-option] + \ set-window-option + \ setw + \ show-buffer + \ showb + \ show-environment + \ showenv + \ show-messages + \ showmsgs + \ show[-options] + \ show-window-options + \ showw + \ source[-file] + \ split-window + \ splitw + \ start[-server] + \ suspend-client + \ suspendc + \ swap-pane + \ swapp + \ swap-window + \ swapw + \ switch-client + \ switchc + \ unbind[-key] + \ unlink-window + \ unlinkw + \ wait[-for] syn keyword tmuxOptsSet - \ buffer-limit escape-time exit-unattached exit-unattached quiet + \ assume-paste-time + \ base-index + \ bell-action + \ bell-on-alert + \ buffer-limit + \ default-command + \ default-shell + \ default-terminal + \ destroy-unattached + \ detach-on-destroy + \ display-panes-active-colour + \ display-panes-colour + \ display-panes-time + \ display-time + \ escape-time + \ exit-unattached + \ focus-events + \ history-limit + \ lock-after-time + \ lock-command + \ lock-server + \ message-command-style + \ message-limit + \ message-style + \ mouse-resize-pane + \ mouse-select-pane + \ mouse-select-window + \ mouse-utf8 + \ pane-active-border-style + \ pane-border-style + \ prefix + \ prefix2 + \ quiet + \ renumber-windows + \ repeat-time \ set-clipboard - \ base-index bell-action bell-on-alert default-command default-path - \ default-shell default-terminal destroy-unattached detach-on-destroy - \ display-panes-[active-]colour display-[panes-]time history-limit - \ lock-after-time lock-command lock-server message-[command-]attr - \ message-[command-]bg message-[command-]fg message-limit - \ mouse-resize-pane mouse-select-pane mouse-select-window mouse-utf8 - \ pane-[active-]border-style prefix prefix2 - \ renumber-windows repeat-time set-remain-on-exit set-titles - \ set-titles-string status status-style - \ status-interval status-justify status-keys status-left - \ status-left-style status-left-length status-position status-right - \ status-right-style status-right-length status-utf8 terminal-overrides - \ update-environment visual-activity visual-bell visual-content - \ visual-silence word-separators + \ set-remain-on-exit + \ set-titles + \ set-titles-string + \ status + \ status-interval + \ status-justify + \ status-keys + \ status-left + \ status-left-length + \ status-left-style + \ status-position + \ status-right + \ status-right-length + \ status-utf8 + \ staus-right-style + \ terminal-overrides + \ update-environment + \ visual-activity + \ visual-bell + \ visual-content + \ visual-silence + \ word-separators syn keyword tmuxOptsSetw - \ aggressive-resize alternate-screen automatic-rename - \ c0-change-interval c0-change-trigger clock-mode-colour - \ clock-mode-style force-height force-width layout-history-limit - \ main-pane-height main-pane-width mode-style move-keys - \ mode-mouse monitor-activity monitor-content monitor-silence - \ other-pane-height other-pane-width pane-base-index remain-on-exit - \ synchronize-panes utf8 window-status-bell-style - \ window-status-content-style window-status-activity-style - \ window-status-[current-]attr window-status-[current-]bg - \ window-status-[current-]fg window-status-[current-]format - \ window-status-separator xterm-keys wrap-search + \ aggressive-resize + \ allow-rename + \ alternate-screen + \ automatic-rename + \ c0-change-interval + \ c0-change-trigger + \ clock-mode-colour + \ clock-mode-style + \ force-height + \ force-width + \ main-pane-height + \ main-pane-width + \ mode-keys + \ mode-mouse + \ mode-style + \ monitor-activity + \ monitor-content + \ monitor-silence + \ other-pane-height + \ other-pane-width + \ pane-base-index + \ remain-on-exit + \ synchronize-panes + \ utf8 + \ window-status-activity-style + \ window-status-bell-style + \ window-status-content-style + \ window-status-current-format + \ window-status-current-style + \ window-status-format + \ window-status-last-style + \ window-status-separator + \ window-status-style + \ wrap-search + \ xterm-keys syn keyword tmuxTodo FIXME NOTE TODO XXX contained |