This commit is contained in:
Adam Stankiewicz 2015-02-11 11:27:11 -08:00
parent b7a30b1f1a
commit 6cd2d5417d
22 changed files with 611 additions and 209 deletions

View File

@ -1,6 +1,12 @@
let b:current_syntax = '' " Extends standard help syntax with highlighting of Scala code.
unlet b:current_syntax "
" 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 syntax include @ScalaCode syntax/scala.vim
if has('conceal') if has('conceal')
syntax region rgnScala matchgroup=Ignore concealends start='!sc!' end='!/sc!' contains=@ScalaCode syntax region rgnScala matchgroup=Ignore concealends start='!sc!' end='!/sc!' contains=@ScalaCode
else else

30
compiler/sbt.vim Normal file
View File

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

View File

@ -86,6 +86,7 @@ augroup END
au BufNewFile,BufRead *.ejs set filetype=jst au BufNewFile,BufRead *.ejs set filetype=jst
au BufNewFile,BufRead *.jst set filetype=jst au BufNewFile,BufRead *.jst set filetype=jst
au BufNewFile,BufRead *.hamljs set filetype=jst au BufNewFile,BufRead *.hamljs set filetype=jst
au BufNewFile,BufRead *.ect set filetype=jst
autocmd BufNewFile,BufRead *.less setf less autocmd BufNewFile,BufRead *.less setf less
au BufNewFile,BufRead *.liquid set ft=liquid au BufNewFile,BufRead *.liquid set ft=liquid
au BufNewFile,BufRead */_layouts/*.html,*/_includes/*.html 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 Appraisals call s:setf('ruby')
au BufNewFile,BufRead Podfile,*.podspec call s:setf('ruby') au BufNewFile,BufRead Podfile,*.podspec call s:setf('ruby')
au BufRead,BufNewFile *.rs set filetype=rust 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() fun! s:DetectScala()
if getline(1) == '#!/usr/bin/env scala' if getline(1) == '#!/usr/bin/env scala'
set filetype=scala set filetype=scala
endif endif
endfun 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 * call s:DetectScala()
au BufRead,BufNewFile *.sbt setfiletype sbt.scala
autocmd BufNewFile,BufRead *.slim set filetype=slim autocmd BufNewFile,BufRead *.slim set filetype=slim
autocmd BufNewFile,BufReadPost *.styl set filetype=stylus autocmd BufNewFile,BufReadPost *.styl set filetype=stylus
autocmd BufNewFile,BufReadPost *.stylus set filetype=stylus autocmd BufNewFile,BufReadPost *.stylus set filetype=stylus

View File

@ -41,7 +41,9 @@ fu! <sid>Warn(mess) "{{{3
echohl Normal echohl Normal
endfu 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 " Hilight Group for Columns
if exists("g:csv_hiGroup") if exists("g:csv_hiGroup")
let s:hiGroup = 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 exe "hi link CSVHeaderLine" s:hiHeader
" Determine default Delimiter " Determine default Delimiter
if !exists("g:csv_delim") if !keep
let b:delimiter=<SID>GetDelimiter(a:startline, a:endline) if !exists("g:csv_delim")
else let b:delimiter=<SID>GetDelimiter(a:startline, a:endline)
let b:delimiter=g:csv_delim else
let b:delimiter=g:csv_delim
endif
endif endif
" Define custom commentstring " Define custom commentstring
@ -579,7 +583,15 @@ fu! <sid>ColWidth(colnr) "{{{3
if !exists("b:csv_fixed_width_cols") if !exists("b:csv_fixed_width_cols")
if !exists("b:csv_list") 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], '\\') let pat = '^\s*\V'. escape(b:csv_cmt[0], '\\')
call filter(b:csv_list, 'v:val !~ pat') call filter(b:csv_list, 'v:val !~ pat')
call filter(b:csv_list, '!empty(v:val)') call filter(b:csv_list, '!empty(v:val)')
@ -646,15 +658,40 @@ fu! <sid>ArrangeCol(first, last, bang, limit) range "{{{3
else else
let ro = 0 let ro = 0
endif endif
exe "sil". a:first . ',' . a:last .'s/' . (b:col) . let s:count = 0
\ '/\=<SID>Columnize(submatch(0))/' . (&gd ? '' : 'g') let _stl = &stl
" Clean up variables, that were only needed for <sid>Columnize() function let s:max = (a:last - a:first + 1) * len(b:col_width)
unlet! s:columnize_count s:max_cols s:prev_line let s:temp = 0
if ro try
setl ro exe "sil". a:first . ',' . a:last .'s/' . (b:col) .
unlet ro \ '/\=<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 endif
call winrestview(cur)
endfu endfu
fu! <sid>PrepUnArrangeCol(first, last) "{{{3 fu! <sid>PrepUnArrangeCol(first, last) "{{{3
@ -706,9 +743,7 @@ fu! <sid>CalculateColumnWidth() "{{{3
endtry endtry
" delete buffer content in variable b:csv_list, " delete buffer content in variable b:csv_list,
" this was only necessary for calculating the max width " this was only necessary for calculating the max width
unlet! b:csv_list unlet! b:csv_list s:columnize_count s:decimal_column
unlet! s:columnize_count
unlet! s:decimal_column
endfu endfu
fu! <sid>Columnize(field) "{{{3 fu! <sid>Columnize(field) "{{{3
@ -725,6 +760,7 @@ fu! <sid>Columnize(field) "{{{3
if exists("s:prev_line") && s:prev_line != line('.') if exists("s:prev_line") && s:prev_line != line('.')
let s:columnize_count = 0 let s:columnize_count = 0
endif endif
let s:count+=1
let s:prev_line = line('.') let s:prev_line = line('.')
" convert zero based indexed list to 1 based indexed list, " 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) " let width=get(b:col_width,<SID>WColumn()-1,20)
" is too slow, so we are using: " is too slow, so we are using:
let colnr = s:columnize_count % s:max_cols let colnr = s:columnize_count % s:max_cols
let width=get(b:col_width, colnr, 20) let width = get(b:col_width, colnr, 20)
let align='r' let align = 'r'
if exists('b:csv_arrange_align') if exists('b:csv_arrange_align')
let align_list=split(get(b:, 'csv_arrange_align', " "), '\zs') let align_list=split(get(b:, 'csv_arrange_align', " "), '\zs')
try try
@ -747,9 +783,10 @@ fu! <sid>Columnize(field) "{{{3
\ align isnot? 'c' && align isnot? '.') || get(b:, 'csv_arrange_leftalign', 0)) \ align isnot? 'c' && align isnot? '.') || get(b:, 'csv_arrange_leftalign', 0))
let align = 'r' let align = 'r'
endif endif
call <sid>ProgressBar(s:count,s:max)
let s:columnize_count += 1 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' if align is? 'l'
" left-align content " left-align content
return printf("%-*S%s", width+1 , return printf("%-*S%s", width+1 ,
@ -1910,7 +1947,8 @@ fu! <sid>CommandDefinitions() "{{{3
call <sid>LocalCmd("UnArrangeColumn", call <sid>LocalCmd("UnArrangeColumn",
\':call <sid>PrepUnArrangeCol(<line1>, <line2>)', \':call <sid>PrepUnArrangeCol(<line1>, <line2>)',
\ '-range') \ '-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>LocalCmd('Header',
\ ':call <sid>SplitHeaderLine(<q-args>,<bang>0,1)', \ ':call <sid>SplitHeaderLine(<q-args>,<bang>0,1)',
\ '-nargs=? -bang') \ '-nargs=? -bang')
@ -2232,6 +2270,10 @@ fu! <sid>NrColumns(bang) "{{{3
endfu endfu
fu! <sid>Tabularize(bang, first, last) "{{{3 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() let _c = winsaveview()
" Table delimiter definition "{{{4 " Table delimiter definition "{{{4
if !exists("s:td") if !exists("s:td")
@ -2307,10 +2349,7 @@ fu! <sid>Tabularize(bang, first, last) "{{{3
call <sid>Warn('An error occured, aborting!') call <sid>Warn('An error occured, aborting!')
return return
endif endif
if get(b:, 'csv_arrange_leftalign', 0) if getline(a:first)[-1:] isnot? b:delimiter
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 let b:col_width[-1] += 1
endif endif
let marginline = s:td.scol. join(map(copy(b:col_width), 'repeat(s:td.hbar, v:val)'), s:td.cros). s:td.ecol 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) call append(a:first + s:csv_fold_headerline, marginline)
let adjust_last += 1 let adjust_last += 1
endif endif
" Syntax will be turned off, so disable this part
"
" Adjust headerline to header of new table " Adjust headerline to header of new table
let b:csv_headerline = (exists('b:csv_headerline')?b:csv_headerline+2:3) "let b:csv_headerline = (exists('b:csv_headerline')?b:csv_headerline+2:3)
call <sid>CheckHeaderLine() "call <sid>CheckHeaderLine()
" Adjust syntax highlighting " Adjust syntax highlighting
unlet! b:current_syntax "unlet! b:current_syntax
ru syntax/csv.vim "ru syntax/csv.vim
if a:bang if a:bang
exe printf('sil %d,%ds/^%s\zs\n/&%s&/e', a:first + s:csv_fold_headerline, a:last + adjust_last, exe printf('sil %d,%ds/^%s\zs\n/&%s&/e', a:first + s:csv_fold_headerline, a:last + adjust_last,

View File

@ -11,6 +11,8 @@ endif
let s:save_cpo = &cpo let s:save_cpo = &cpo
set cpo-=C set cpo-=C
setlocal iskeyword+=-
" Define some defaults in case the included ftplugins don't set them. " Define some defaults in case the included ftplugins don't set them.
let s:undo_ftplugin = "" let s:undo_ftplugin = ""
let s:browsefilter = "All Files (*.*)\t*.*\n" let s:browsefilter = "All Files (*.*)\t*.*\n"

View File

@ -64,14 +64,24 @@ setlocal efm+=%-G%.%#
" Vim Windows {{{ " 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') if !exists('g:LatexBox_split_width')
let g:LatexBox_split_width = 30 let g:LatexBox_split_width = 30
endif endif
" Where vertical splits appear " Where splits appear
if !exists('g:LatexBox_split_side') if !exists('g:LatexBox_split_side')
let g:LatexBox_split_side = "leftabove" let g:LatexBox_split_side = "aboveleft"
endif endif
" Resize when split? " Resize when split?
@ -229,12 +239,18 @@ endfunction
" Default pdf viewer " Default pdf viewer
if !exists('g:LatexBox_viewer') if !exists('g:LatexBox_viewer')
if has('win32') " On windows, 'running' a file will open it with the default program
" On windows, 'running' a file will open it with the default program let s:viewer = ''
let g:LatexBox_viewer = '' if has('unix')
else " echo -n necessary as uname -s will append \n otherwise
let g:LatexBox_viewer = 'xdg-open' let s:uname = system('echo -n $(uname -s)')
if s:uname == "Darwin"
let s:viewer = 'open'
else
let s:viewer = 'xdg-open'
endif
endif endif
let g:LatexBox_viewer = s:viewer
endif endif
function! LatexBox_View(...) function! LatexBox_View(...)

View File

@ -459,7 +459,8 @@ function! s:GetLabelCache(file)
if !has_key(s:LabelCache , a:file) || s:LabelCache[a:file][0] != getftime(a: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. " 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 ] let s:LabelCache[a:file] = [ getftime(a:file), labels, inputs ]
endif endif

View File

@ -75,8 +75,8 @@ if g:LatexBox_fold_automatic == 1
" "
augroup FastFold augroup FastFold
autocmd! autocmd!
autocmd InsertEnter *.tex setlocal foldmethod=manual autocmd InsertEnter *.tex if !&diff | setlocal foldmethod=manual | endif
autocmd InsertLeave *.tex setlocal foldmethod=expr autocmd InsertLeave *.tex if !&diff | setlocal foldmethod=expr | endif
augroup end augroup end
else else
setl foldmethod=manual setl foldmethod=manual

View File

@ -349,7 +349,7 @@ function! s:ReadTOC(auxfile, texfile, ...)
if len(tree) > 3 && empty(tree[1]) if len(tree) > 3 && empty(tree[1])
call remove(tree, 1) call remove(tree, 1)
endif 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 = LatexBox_TreeToTex(tree[1])
let secnum = substitute(secnum, '\\\S\+\s', '', 'g') let secnum = substitute(secnum, '\\\S\+\s', '', 'g')
let secnum = substitute(secnum, '\\\S\+{\(.\{-}\)}', '\1', 'g') let secnum = substitute(secnum, '\\\S\+{\(.\{-}\)}', '\1', 'g')
@ -379,6 +379,21 @@ function! LatexBox_TOC(...)
" Check if window already exists " Check if window already exists
let winnr = bufwinnr(bufnr('LaTeX TOC')) 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 winnr >= 0
if a:0 == 0 if a:0 == 0
silent execute winnr . 'wincmd w' silent execute winnr . 'wincmd w'
@ -386,13 +401,12 @@ function! LatexBox_TOC(...)
" Supplying an argument to this function causes toggling instead " Supplying an argument to this function causes toggling instead
" of jumping to the TOC window " of jumping to the TOC window
if g:LatexBox_split_resize if g:LatexBox_split_resize
silent exe "set columns-=" . g:LatexBox_split_width silent exe "set columns-=" . l:size
endif endif
silent execute 'bwipeout' . bufnr('LaTeX TOC') silent execute 'bwipeout' . bufnr('LaTeX TOC')
endif endif
return return
endif endif
" Read TOC " Read TOC
let [toc, fileindices] = s:ReadTOC(LatexBox_GetAuxFile(), let [toc, fileindices] = s:ReadTOC(LatexBox_GetAuxFile(),
\ LatexBox_GetMainTexFile()) \ LatexBox_GetMainTexFile())
@ -403,9 +417,10 @@ function! LatexBox_TOC(...)
" Create TOC window and set local settings " Create TOC window and set local settings
if g:LatexBox_split_resize if g:LatexBox_split_resize
silent exe "set columns+=" . g:LatexBox_split_width silent exe "set columns+=" . l:size
endif 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 = toc
let b:toc_numbers = 1 let b:toc_numbers = 1
let b:calling_win = bufwinnr(calling_buf) let b:calling_win = bufwinnr(calling_buf)

View File

@ -77,7 +77,7 @@ endif
"--------------------------------------------- "---------------------------------------------
" Undo the stuff we changed. " 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" \ " | unlet! b:browsefilter"
" proper matching for matchit plugin " proper matching for matchit plugin

View File

@ -65,11 +65,22 @@ if !exists("perlpath")
endif endif
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. " 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" \ " | unlet! b:browsefilter"
" Restore the saved compatibility options. " Restore the saved compatibility options.

View File

@ -1,14 +1,33 @@
setlocal formatoptions+=ro " Vim filetype plugin
setlocal commentstring=//%s " Language: Scala
let &l:include = '^\s*import' " Maintainer: Derek Wyatt
let &l:includeexpr = 'substitute(v:fname,"\\.","/","g")' " 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 path+=src/main/scala,src/test/scala
setlocal suffixesadd=.scala setlocal suffixesadd=.scala
set makeprg=sbt\ -Dsbt.log.noformat=true\ compile compiler sbt
set efm=%E\ %#[error]\ %f:%l:\ %m,%C\ %#[error]\ %p^,%-C%.%#,%Z,
\%W\ %#[warn]\ %f:%l:\ %m,%C\ %#[warn]\ %p^,%-C%.%#,%Z,
\%-G%.%#
if globpath(&rtp, 'plugin/fuf.vim') != '' if globpath(&rtp, 'plugin/fuf.vim') != ''
" "
@ -127,49 +146,6 @@ if globpath(&rtp, 'plugin/fuf.vim') != ''
endif endif
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) function! s:CreateOrExpression(keywords)
return '('.join(a:keywords, '|').')' return '('.join(a:keywords, '|').')'
endfunction endfunction
@ -191,5 +167,6 @@ function! s:NextSection(backwards)
endfunction endfunction
noremap <script> <buffer> <silent> ]] :call <SID>NextSection(0)<cr> noremap <script> <buffer> <silent> ]] :call <SID>NextSection(0)<cr>
noremap <script> <buffer> <silent> [[ :call <SID>NextSection(1)<cr> noremap <script> <buffer> <silent> [[ :call <SID>NextSection(1)<cr>
" vim:set sw=2 sts=2 ts=8 et:

47
ftplugin/scala/tagbar.vim Normal file
View File

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

View File

@ -11,6 +11,8 @@ let b:did_ftplugin = 1
let s:save_cpo = &cpo let s:save_cpo = &cpo
set cpo&vim set cpo&vim
setlocal commentstring=#\ %s
" Add NERDCommenter delimiters " Add NERDCommenter delimiters
let s:delims = { 'left': '#' } let s:delims = { 'left': '#' }

View File

@ -37,20 +37,21 @@ function! GoIndent(lnum)
let previ = indent(prevlnum) let previ = indent(prevlnum)
let ind = previ let ind = previ
let s:shiftwidth = shiftwidth()
if prevl =~ '[({]\s*$' if prevl =~ '[({]\s*$'
" previous line opened a block " previous line opened a block
let ind += &sw let ind += s:shiftwidth
endif endif
if prevl =~# '^\s*\(case .*\|default\):$' if prevl =~# '^\s*\(case .*\|default\):$'
" previous line is part of a switch statement " previous line is part of a switch statement
let ind += &sw let ind += s:shiftwidth
endif endif
" TODO: handle if the previous line is a label. " TODO: handle if the previous line is a label.
if thisl =~ '^\s*[)}]' if thisl =~ '^\s*[)}]'
" this line closed a block " this line closed a block
let ind -= &sw let ind -= s:shiftwidth
endif endif
" Colons are tricky. " Colons are tricky.
@ -58,7 +59,7 @@ function! GoIndent(lnum)
" We ignore trying to deal with jump labels because (a) they're rare, and " 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. " (b) they're hard to disambiguate from a composite literal key.
if thisl =~# '^\s*\(case .*\|default\):$' if thisl =~# '^\s*\(case .*\|default\):$'
let ind -= &sw let ind -= s:shiftwidth
endif endif
return ind return ind

View File

@ -49,11 +49,11 @@ let s:skip_expr = "synIDattr(synID(line('.'),col('.'),1),'name') =~ '".s:syng_st
let s:line_term = '\s*\%(\%(\/\/\).*\)\=$' let s:line_term = '\s*\%(\%(\/\/\).*\)\=$'
" Regex that defines continuation lines, not including (, {, or [. " 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. " Regex that defines continuation lines.
" TODO: this needs to deal with if ...: and so on " 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 let s:one_line_scope_regex = '\<\%(if\|else\|for\|while\)\>[^{;]*' . s:line_term

View File

@ -9,13 +9,9 @@ if exists("b:did_indent")
endif endif
let b:did_indent = 1 let b:did_indent = 1
setlocal autoindent
setlocal indentexpr=GetScalaIndent() setlocal indentexpr=GetScalaIndent()
setlocal indentkeys=0{,0},0),!^F,<>>,o,O,e,=case,<CR> 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") if exists("*GetScalaIndent")
finish finish
@ -543,7 +539,7 @@ function! GetScalaIndent()
let ind = ind - 1 let ind = ind - 1
endif endif
if scala#LineEndsInIncomplete(curline) if scala#LineEndsInIncomplete(prevline)
call scala#ConditionalConfirm("19") call scala#ConditionalConfirm("19")
return ind return ind
endif endif
@ -597,5 +593,6 @@ function! GetScalaIndent()
return ind return ind
endfunction 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: " vim600:fdm=marker fdl=1 fdc=0:

View File

@ -35,7 +35,13 @@ syntax keyword jsOperator delete instanceof typeof void new in
syntax match jsOperator /\(!\||\|&\|+\|-\|<\|>\|=\|%\|\/\|*\|\~\|\^\)/ syntax match jsOperator /\(!\||\|&\|+\|-\|<\|>\|=\|%\|\/\|*\|\~\|\^\)/
syntax keyword jsBooleanTrue true syntax keyword jsBooleanTrue true
syntax keyword jsBooleanFalse false 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 "" JavaScript comments
syntax keyword jsCommentTodo TODO FIXME XXX TBD contained 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 "syntax include @javaHtml <sfile>:p:h/html.vim
"unlet b:current_syntax "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 " 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 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 case match
"" Syntax in the JavaScript code "" Syntax in the JavaScript code
syntax match jsFuncCall /\k\+\%(\s*(\)\@=/ syntax match jsFuncCall /\k\+\%(\s*(\)\@=/
syntax match jsSpecial "\v\\%(0|\\x\x\{2\}\|\\u\x\{4\}\|\c[A-Z]|.)" contained syntax match jsSpecial "\v\\%(0|\\x\x\{2\}\|\\u\x\{4\}\|\c[A-Z]|.)" contained
syntax match jsTemplateVar "\${.\{-}}" contained syntax match jsTemplateVar "\${.\{-}}" contained
syntax region jsStringD start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@htmlPreproc,@Spell syntax region jsStringD start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@htmlPreproc,@Spell
syntax region jsStringS 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 jsTemplateString start=+`+ skip=+\\\(`\|$\)+ end=+`+ contains=jsTemplateVar,jsSpecial,@htmlPreproc
syntax region jsRegexpCharClass start=+\[+ skip=+\\.+ end=+\]+ contained 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 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 jsRegexpQuantifier "\v\\@<!%([?*+]|\{\d+%(,|,\d+)?})\??" contained
syntax match jsRegexpOr "\v\<@!\|" contained syntax match jsRegexpOr "\v\<@!\|" contained
syntax match jsRegexpMod "\v\(@<=\?[:=!>]" contained syntax match jsRegexpMod "\v\(@<=\?[:=!>]" contained
syntax cluster jsRegexpSpecial contains=jsSpecial,jsRegexpBoundary,jsRegexpBackRef,jsRegexpQuantifier,jsRegexpOr,jsRegexpMod syntax cluster jsRegexpSpecial contains=jsSpecial,jsRegexpBoundary,jsRegexpBackRef,jsRegexpQuantifier,jsRegexpOr,jsRegexpMod
syntax region jsRegexpGroup start="\\\@<!(" skip="\\.\|\[\(\\.\|[^]]\)*\]" end="\\\@<!)" contained contains=jsRegexpCharClass,@jsRegexpSpecial keepend syntax region jsRegexpGroup start="\\\@<!(" skip="\\.\|\[\(\\.\|[^]]\)*\]" end="\\\@<!)" contained contains=jsRegexpCharClass,@jsRegexpSpecial keepend
syntax region jsRegexpString start=+\(\(\(return\|case\)\s\+\)\@<=\|\(\([)\]"']\|\d\|\w\)\s*\)\@<!\)/\(\*\|/\)\@!+ skip=+\\.\|\[\(\\.\|[^]]\)*\]+ end=+/[gimy]\{,4}+ contains=jsRegexpCharClass,jsRegexpGroup,@jsRegexpSpecial,@htmlPreproc oneline keepend syntax 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 match jsNumber /\<-\=\d\+\(L\|[eE][+-]\=\d\+\)\=\>\|\<0[xX]\x\+\>/
syntax keyword jsNumber Infinity syntax keyword jsNumber Infinity
syntax match jsFloat /\<-\=\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%([eE][+-]\=\d\+\)\=\>/ 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 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 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 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 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 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 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 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 "" Statement Keywords
syntax keyword jsStatement break continue with syntax keyword jsStatement break continue with
syntax keyword jsConditional if else switch syntax keyword jsConditional if else switch
syntax keyword jsRepeat do while for syntax keyword jsRepeat do while for
syntax keyword jsLabel case default 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 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 match jsGlobalObjects /\%(Intl\.\)\@<=\(Collator\|DateTimeFormat\|NumberFormat\)/
syntax keyword jsExceptions Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError 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 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 "" DOM/HTML/CSS specified things
@ -178,12 +188,11 @@ endif "DOM/HTML/CSS
"" end DOM/HTML/CSS specified things "" end DOM/HTML/CSS specified things
"" Code blocks "" 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 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 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 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 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 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 jsGenerator contained '\*' nextgroup=jsFuncName skipwhite
syntax match jsFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*/ nextgroup=jsFuncArgs 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 jsFuncArgCommas contained ','
syntax match jsFuncArgRest contained /\%(\.\.\.[a-zA-Z_$][0-9a-zA-Z_$]*\))/ syntax match jsFuncArgRest contained /\%(\.\.\.[a-zA-Z_$][0-9a-zA-Z_$]*\))/
syntax keyword jsArgsObj arguments contained containedin=jsFuncBlock syntax keyword jsArgsObj arguments contained containedin=jsFuncBlock
@ -225,7 +234,7 @@ if version >= 508 || !exists("did_javascript_syn_inits")
HiLink jsComment Comment HiLink jsComment Comment
HiLink jsLineComment Comment HiLink jsLineComment Comment
HiLink jsEnvComment PreProc HiLink jsEnvComment PreProc
HiLink jsDocComment Comment HiLink jsBlockComment Comment
HiLink jsCommentTodo Todo HiLink jsCommentTodo Todo
HiLink jsCvsTag Function HiLink jsCvsTag Function
HiLink jsDocTags Special HiLink jsDocTags Special
@ -236,6 +245,7 @@ if version >= 508 || !exists("did_javascript_syn_inits")
HiLink jsStringS String HiLink jsStringS String
HiLink jsStringD String HiLink jsStringD String
HiLink jsTemplateString String HiLink jsTemplateString String
HiLink jsTaggedTemplate StorageClass
HiLink jsTernaryIfOperator Conditional HiLink jsTernaryIfOperator Conditional
HiLink jsRegexpString String HiLink jsRegexpString String
HiLink jsRegexpBoundary SpecialChar HiLink jsRegexpBoundary SpecialChar
@ -266,8 +276,12 @@ if version >= 508 || !exists("did_javascript_syn_inits")
HiLink jsParensErrB Error HiLink jsParensErrB Error
HiLink jsParensErrC Error HiLink jsParensErrC Error
HiLink jsOperator Operator HiLink jsOperator Operator
HiLink jsOf Operator
HiLink jsStorageClass StorageClass HiLink jsStorageClass StorageClass
HiLink jsClass Structure
HiLink jsThis Special HiLink jsThis Special
HiLink jsStatic Special
HiLink jsSuper Special
HiLink jsNan Number HiLink jsNan Number
HiLink jsNull Type HiLink jsNull Type
HiLink jsUndefined Type HiLink jsUndefined Type
@ -287,7 +301,8 @@ if version >= 508 || !exists("did_javascript_syn_inits")
HiLink jsExceptions Special HiLink jsExceptions Special
HiLink jsFutureKeys Special HiLink jsFutureKeys Special
HiLink jsBuiltins Special HiLink jsBuiltins Special
HiLink jsCommonJS Include HiLink jsModules Include
HiLink jsModuleWords Include
HiLink jsDomErrNo Constant HiLink jsDomErrNo Constant
HiLink jsDomNodeConsts Constant HiLink jsDomNodeConsts Constant
@ -304,10 +319,9 @@ if version >= 508 || !exists("did_javascript_syn_inits")
endif endif
" Define the htmlJavaScript for HTML syntax html.vim " Define the htmlJavaScript for HTML syntax html.vim
"syntax clear htmlJavaScript
"syntax clear jsExpression
syntax cluster htmlJavaScript contains=@jsAll,jsBracket,jsParen,jsBlock syntax cluster htmlJavaScript contains=@jsAll,jsBracket,jsParen,jsBlock
syntax cluster javaScriptExpression contains=@jsAll,jsBracket,jsParen,jsBlock,@htmlPreproc syntax cluster javaScriptExpression contains=@jsAll,jsBracket,jsParen,jsBlock,@htmlPreproc
" Vim's default html.vim highlights all javascript as 'Special' " Vim's default html.vim highlights all javascript as 'Special'
hi! def link javaScript NONE hi! def link javaScript NONE

View File

@ -24,6 +24,8 @@ elseif !exists("b:jst_subtype") && main_syntax == 'jst'
let b:jst_subtype = 'haml' let b:jst_subtype = 'haml'
elseif b:jst_subtype == 'ejs' elseif b:jst_subtype == 'ejs'
let b:jst_subtype = 'html' let b:jst_subtype = 'html'
elseif b:jst_subtype == 'ect'
let b:jst_subtype = 'html'
elseif b:jst_subtype == 'rb' elseif b:jst_subtype == 'rb'
let b:jst_subtype = 'ruby' let b:jst_subtype = 'ruby'
elseif b:jst_subtype == 'yml' elseif b:jst_subtype == 'yml'
@ -70,4 +72,14 @@ if main_syntax == 'jst'
unlet main_syntax unlet main_syntax
endif 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: " vim: nowrap sw=2 sts=2 ts=8:

View File

@ -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 syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r(" end=")[iomxneus]*" skip="\\\\\|\\)" contains=@rubyRegexpSpecial fold
" Normal String and Shell Command Output " Normal String and Shell Command Output
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=rubyQuoteEscape fold syn region rubyString matchgroup=rubyStringDelimiter start="\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial,@Spell fold
syn region rubyString matchgroup=rubyStringDelimiter start="`" end="`" skip="\\\\\|\\`" contains=@rubyStringSpecial 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 " Generalized Single Quoted String, Symbol and Array of Strings
syn region rubyString matchgroup=rubyStringDelimiter start="%[qwi]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold syn region rubyString matchgroup=rubyStringDelimiter start="%[qwi]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold

View File

@ -1,22 +1,40 @@
if version < 600 " Vim syntax file
syntax clear " Language: Scala
elseif exists("b:current_syntax") " Maintainer: Derek Wyatt
finish " 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 endif
scriptencoding utf-8 scriptencoding utf-8
let b:current_syntax = "scala" 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() function! s:ContainedGroup()
try try
silent syn list @scala silent syn list @scala
return '@scala' return '@scala,@NoSpell'
catch /E392/ catch /E392/
return 'TOP' return 'TOP,@Spell'
endtry endtry
endfunction endfunction
syn include @scalaHtml syntax/html.vim " Doc comment HTML
unlet! b:current_syntax
syn case match syn case match
syn sync minlines=200 maxlines=1000 syn sync minlines=200 maxlines=1000
@ -58,6 +76,9 @@ syn match scalaInstanceHash /#/ contained nextgroup=scalaInstanceDeclaration
hi link scalaInstanceDeclaration Special hi link scalaInstanceDeclaration Special
hi link scalaInstanceHash Type hi link scalaInstanceHash Type
syn match scalaUnimplemented /???/
hi link scalaUnimplemented ERROR
syn match scalaCapitalWord /\<[A-Z][A-Za-z0-9$]*\>/ syn match scalaCapitalWord /\<[A-Z][A-Za-z0-9$]*\>/
hi link scalaCapitalWord Special 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 syn keyword scalaKeywordModifier abstract override final lazy implicit implicitly private protected sealed null require super
hi link scalaKeywordModifier Function 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 keyword scalaSpecial new nextgroup=scalaInstanceDeclaration skipwhite
syn match scalaSpecial "\%(=>\|⇒\|<-\|←\|->\|→\)" syn match scalaSpecial "\%(=>\|⇒\|<-\|←\|->\|→\)"
syn match scalaSpecial /`[^`]*`/ " Backtick literals syn match scalaSpecial /`[^`]*`/ " Backtick literals
hi link scalaSpecial PreProc hi link scalaSpecial PreProc
syn keyword scalaExternal package import
hi link scalaExternal Include
syn match scalaStringEmbeddedQuote /\\"/ contained syn match scalaStringEmbeddedQuote /\\"/ contained
syn region scalaString start=/"/ end=/"/ contains=scalaStringEmbeddedQuote,scalaEscapedChar,scalaUnicodeChar syn region scalaString start=/"/ end=/"/ contains=scalaStringEmbeddedQuote,scalaEscapedChar,scalaUnicodeChar
hi link scalaString String hi link scalaString String
@ -146,7 +170,7 @@ syn match scalaTypeAnnotationParameter /@\<[`_A-Za-z0-9$]\+\>/ contained
hi link scalaTypeOperator Keyword hi link scalaTypeOperator Keyword
hi link scalaTypeAnnotationParameter Function 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 scalaCommentAnnotation "@[_A-Za-z0-9$]\+" contained
syn match scalaParameterAnnotation "@param" nextgroup=scalaParamAnnotationValue skipwhite contained syn match scalaParameterAnnotation "@param" nextgroup=scalaParamAnnotationValue skipwhite contained
syn match scalaParamAnnotationValue /[`_A-Za-z0-9$]\+/ contained syn match scalaParamAnnotationValue /[`_A-Za-z0-9$]\+/ contained
@ -162,7 +186,7 @@ hi link scalaCommentCodeBlock String
syn match scalaAnnotation /@\<[`_A-Za-z0-9$]\+\>/ syn match scalaAnnotation /@\<[`_A-Za-z0-9$]\+\>/
hi link scalaAnnotation PreProc hi link scalaAnnotation PreProc
syn match scalaTrailingComment "//.*$" syn match scalaTrailingComment "//.*$" contains=@Spell
hi link scalaTrailingComment Comment hi link scalaTrailingComment Comment
syn match scalaAkkaFSM /goto([^)]*)\_s\+\<using\>/ contains=scalaAkkaFSMGotoUsing syn match scalaAkkaFSM /goto([^)]*)\_s\+\<using\>/ contains=scalaAkkaFSMGotoUsing
@ -178,3 +202,11 @@ syn match scalaAkkaFSMGotoUsing /\<using\>/
syn match scalaAkkaFSMGotoUsing /\<goto\>/ syn match scalaAkkaFSMGotoUsing /\<goto\>/
hi link scalaAkkaFSM PreProc hi link scalaAkkaFSM PreProc
hi link scalaAkkaFSMGotoUsing 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:

View File

@ -3,6 +3,20 @@
" Maintainer: Tiago Cunha <tcunha@users.sourceforge.net> " Maintainer: Tiago Cunha <tcunha@users.sourceforge.net>
" Last Change: $Date: 2010-07-27 18:29:07 $ " Last Change: $Date: 2010-07-27 18:29:07 $
" License: This file is placed in the public domain. " 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 if version < 600
syntax clear syntax clear
@ -17,60 +31,237 @@ syn keyword tmuxAction any current none
syn keyword tmuxBoolean off on syn keyword tmuxBoolean off on
syn keyword tmuxCmds syn keyword tmuxCmds
\ attach[-session] detach[-client] has[-session] kill-server \ attach[-session]
\ kill-session lsc list-clients lscm list-commands ls list-sessions \ bind[-key]
\ lockc lock-client locks lock-session new[-session] refresh[-client] \ break-pane
\ rename[-session] showmsgs show-messages source[-file] start[-server] \ breakp
\ suspendc suspend-client switchc switch-client copy-mode \ capture-pane
\ breakp break-pane capturep capture-pane choose-client choose-session \ capturep
\ choose-tree choose-window displayp display-panes findw find-window \ choose-buffer
\ joinp join-pane killp kill-pane killw kill-window lastp last-pane \ choose-client
\ last[-window] linkw link-window lsp list-panes lsw list-windows movep \ choose-list
\ move-pane movew move-window neww new-window nextl next-layout \ choose-session
\ next[-window] pipep pipe-pane prevl previous-layout prev[ious-window] \ choose-tree
\ renamew rename-window resizep resize-pane respawnp respawn-pane \ choose-window
\ respawnw respawn-window rotatew rotate-window selectl select-layout \ clear-history
\ selectp select-pane selectw select-window splitw split-window swapp \ clearhist
\ swap-pane swapw swap-window unlinkw unlink-window \ clock-mode
\ bind[-key] lsk list-keys send[-keys] send-prefix unbind[-key] \ command-prompt
\ set[-option] setw set-window-option show[-options] showw \ confirm[-before]
\ show-window-options setenv set-environment showenv show-environment \ copy-mode
\ command-prompt confirm[-before] display[-message] \ delete-buffer
\ choose-buffer clearhist clear-history deleteb delete-buffer lsb \ deleteb
\ list-buffers loadb load-buffer pasteb paste-buffer saveb save-buffer \ detach[-client]
\ setb set-buffer showb show-buffer \ display[-message]
\ clock-mode if[-shell] lock[-server] run[-shell] [server-]info \ 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 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 \ set-clipboard
\ base-index bell-action bell-on-alert default-command default-path \ set-remain-on-exit
\ default-shell default-terminal destroy-unattached detach-on-destroy \ set-titles
\ display-panes-[active-]colour display-[panes-]time history-limit \ set-titles-string
\ lock-after-time lock-command lock-server message-[command-]attr \ status
\ message-[command-]bg message-[command-]fg message-limit \ status-interval
\ mouse-resize-pane mouse-select-pane mouse-select-window mouse-utf8 \ status-justify
\ pane-[active-]border-style prefix prefix2 \ status-keys
\ renumber-windows repeat-time set-remain-on-exit set-titles \ status-left
\ set-titles-string status status-style \ status-left-length
\ status-interval status-justify status-keys status-left \ status-left-style
\ status-left-style status-left-length status-position status-right \ status-position
\ status-right-style status-right-length status-utf8 terminal-overrides \ status-right
\ update-environment visual-activity visual-bell visual-content \ status-right-length
\ visual-silence word-separators \ status-utf8
\ staus-right-style
\ terminal-overrides
\ update-environment
\ visual-activity
\ visual-bell
\ visual-content
\ visual-silence
\ word-separators
syn keyword tmuxOptsSetw syn keyword tmuxOptsSetw
\ aggressive-resize alternate-screen automatic-rename \ aggressive-resize
\ c0-change-interval c0-change-trigger clock-mode-colour \ allow-rename
\ clock-mode-style force-height force-width layout-history-limit \ alternate-screen
\ main-pane-height main-pane-width mode-style move-keys \ automatic-rename
\ mode-mouse monitor-activity monitor-content monitor-silence \ c0-change-interval
\ other-pane-height other-pane-width pane-base-index remain-on-exit \ c0-change-trigger
\ synchronize-panes utf8 window-status-bell-style \ clock-mode-colour
\ window-status-content-style window-status-activity-style \ clock-mode-style
\ window-status-[current-]attr window-status-[current-]bg \ force-height
\ window-status-[current-]fg window-status-[current-]format \ force-width
\ window-status-separator xterm-keys wrap-search \ 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 syn keyword tmuxTodo FIXME NOTE TODO XXX contained