mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-08 11:33:52 -05:00
Update
This commit is contained in:
@@ -61,7 +61,7 @@ let charset = [
|
||||
" }}}
|
||||
|
||||
" Attributes_and_Settings: {{{
|
||||
let core_attributes = {'accesskey': [], 'class': [], 'contenteditable': ['true', 'false', ''], 'contextmenu': [], 'dir': ['ltr', 'rtl'], 'draggable': ['true', 'false'], 'hidden': ['hidden', ''], 'id': [], 'lang': lang_tag, 'spellcheck': ['true', 'false', ''], 'style': [], 'tabindex': [], 'title': []}
|
||||
let core_attributes = {'accesskey': [], 'class': [], 'contenteditable': ['true', 'false', ''], 'contextmenu': [], 'dir': ['ltr', 'rtl'], 'draggable': ['true', 'false'], 'hidden': ['hidden', ''], 'id': [], 'is': [], 'lang': lang_tag, 'spellcheck': ['true', 'false', ''], 'style': [], 'tabindex': [], 'title': []}
|
||||
let xml_attributes = {'xml:lang': lang_tag, 'xml:space': ['preserve'], 'xml:base': [], 'xmlns': ['http://www.w3.org/1999/xhtml', 'http://www.w3.org/1998/Math/MathML', 'http://www.w3.org/2000/svg', 'http://www.w3.org/1999/xlink']}
|
||||
|
||||
let body_attributes = {}
|
||||
@@ -101,6 +101,7 @@ let attributes_value = {
|
||||
\ 'disabled': ['Bool', ''],
|
||||
\ 'draggable': ['true/false', ''],
|
||||
\ 'enctype': ['Token', ''],
|
||||
\ 'extends': ['Text', ''],
|
||||
\ 'for': ['ID', ''],
|
||||
\ 'form': ['ID', ''],
|
||||
\ 'formaction': ['URL', ''],
|
||||
@@ -152,6 +153,7 @@ let attributes_value = {
|
||||
\ 'scope': ['Token', ''],
|
||||
\ 'scoped': ['Bool', ''],
|
||||
\ 'seamless': ['Bool', ''],
|
||||
\ 'select': ['Text', ''],
|
||||
\ 'selected': ['Bool', ''],
|
||||
\ 'shape': ['Token', ''],
|
||||
\ 'size': ['Int', ''],
|
||||
@@ -322,16 +324,16 @@ endif
|
||||
|
||||
" Ref: http://dev.w3.org/html5/markup/
|
||||
" Version: Draft 05 April 2011
|
||||
let phrasing_elements = ['a', 'em', 'strong', 'small', 'mark', 'abbr', 'dfn', 'i', 'b', 'u', 'code', 'var', 'samp', 'kbd', 'sup', 'sub', 'q', 'cite', 'span', 'bdo', 'bdi', 'br', 'wbr', 'ins', 'del', 'img', 'embed', 'object', 'iframe', 'map', 'area', 'script', 'noscript', 'ruby', 'video', 'audio', 'input', 'textarea', 'select', 'button', 'label', 'output', 'datalist', 'keygen', 'progress', 'command', 'canvas', 'time', 'meter', 'data']
|
||||
let phrasing_elements = ['a', 'em', 'strong', 'small', 'mark', 'abbr', 'dfn', 'i', 'b', 'u', 'code', 'var', 'samp', 'kbd', 'sup', 'sub', 'q', 'cite', 'span', 'bdo', 'bdi', 'br', 'wbr', 'ins', 'del', 'img', 'embed', 'object', 'iframe', 'map', 'area', 'script', 'noscript', 'ruby', 'video', 'audio', 'input', 'textarea', 'select', 'button', 'label', 'output', 'datalist', 'keygen', 'progress', 'command', 'canvas', 'time', 'meter', 'data', 'content', 'shadow']
|
||||
|
||||
let metadata_elements = ['link', 'style', 'meta', 'script', 'noscript', 'command']
|
||||
|
||||
let flow_elements = phrasing_elements + ['p', 'hr', 'pre', 'ul', 'ol', 'dl', 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hgroup', 'address', 'blockquote', 'ins', 'del', 'object', 'main', 'map', 'noscript', 'section', 'nav', 'article', 'aside', 'header', 'footer', 'video', 'audio', 'figure', 'table', 'template', 'form', 'fieldset', 'menu', 'canvas', 'details']
|
||||
let flow_elements = phrasing_elements + ['p', 'hr', 'pre', 'ul', 'ol', 'dl', 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hgroup', 'address', 'blockquote', 'ins', 'del', 'element', 'object', 'main', 'map', 'noscript', 'section', 'nav', 'article', 'aside', 'header', 'footer', 'video', 'audio', 'figure', 'table', 'template', 'form', 'fieldset', 'menu', 'canvas', 'details']
|
||||
|
||||
" http://dev.w3.org/html5/spec/Overview.html#linkTypes
|
||||
let linktypes = ['alternate', 'author', 'bookmark', 'external', 'help', 'icon', 'license', 'next', 'nofollow', 'noreferrer', 'pingback', 'prefetch', 'prev', 'search', 'stylesheet', 'sidebar', 'tag']
|
||||
" http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html
|
||||
let linkreltypes = linktypes + ['canonical']
|
||||
let linkreltypes = linktypes + ['canonical', 'import']
|
||||
|
||||
" a and button are special elements for interactive, some element can't be its descendent
|
||||
let abutton_dec = 'details\\|embed\\|iframe\\|keygen\\|label\\|menu\\|select\\|textarea'
|
||||
@@ -425,6 +427,10 @@ let g:xmldata_html5 = {
|
||||
\ [],
|
||||
\ extend(copy(global_attributes), {'span': []})
|
||||
\ ],
|
||||
\ 'content': [
|
||||
\ [],
|
||||
\ extend(copy(global_attributes), {'select': []})
|
||||
\ ],
|
||||
\ 'command': [
|
||||
\ ['col'],
|
||||
\ extend(copy(global_attributes), {'type': ['command', 'radio', 'checkbox'], 'radiogroup': [], 'checked': ['checked', ''], 'label': [], 'icon': [], 'disabled': ['disabled', '']})
|
||||
@@ -677,6 +683,10 @@ let g:xmldata_html5 = {
|
||||
\ ['optgroup', 'option'],
|
||||
\ extend(copy(global_attributes), {'name': [], 'disabled': ['disabled', ''], 'form': [], 'size': [], 'multiple': ['multiple', '']})
|
||||
\ ],
|
||||
\ 'shadow': [
|
||||
\ [],
|
||||
\ global_attributes
|
||||
\ ],
|
||||
\ 'small': [
|
||||
\ phrasing_elements,
|
||||
\ global_attributes
|
||||
|
||||
@@ -56,7 +56,6 @@ endif
|
||||
autocmd BufNewFile,BufReadPost *.jade set filetype=jade
|
||||
au BufNewFile,BufRead *.js setf javascript
|
||||
au BufNewFile,BufRead *.jsm setf javascript
|
||||
au BufNewFile,BufRead *.json setf javascript
|
||||
au BufNewFile,BufRead Jakefile setf javascript
|
||||
fun! s:SelectJavascript()
|
||||
if getline(1) =~# '^#!.*/bin/env\s\+node\>'
|
||||
|
||||
188
ftplugin/csv.vim
188
ftplugin/csv.vim
@@ -136,7 +136,7 @@ fu! <sid>Init(startline, endline) "{{{3
|
||||
\ . "| unlet! b:csv_fixed_width b:csv_list b:col_width"
|
||||
\ . "| unlet! b:csv_SplitWindow b:csv_headerline"
|
||||
\ . "| unlet! b:csv_thousands_sep b:csv_decimal_sep"
|
||||
\. " | unlet! b:browsefilter b:csv_start b:csv_end"
|
||||
\. " | unlet! b:browsefilter b:csv_cmt"
|
||||
|
||||
" Delete all functions
|
||||
" disabled currently, because otherwise when switching ft
|
||||
@@ -168,6 +168,7 @@ fu! <sid>Init(startline, endline) "{{{3
|
||||
" \ delf <sid>SaveOptions | delf <sid>CheckDuplicates |
|
||||
" \ delf <sid>CompleteColumnNr | delf <sid>CSVPat | delf <sid>Transpose |
|
||||
" \ delf <sid>LocalSettings() | delf <sid>AddColumn | delf <sid>SubstituteInColumn
|
||||
" \ delf <sid>SetupQuitPre() | delf CSV_CloseBuffer
|
||||
endfu
|
||||
|
||||
fu! <sid>LocalSettings(type) "{{{3
|
||||
@@ -275,7 +276,9 @@ fu! <sid>DoAutoCommands() "{{{3
|
||||
au BufNewFile,BufNew * call <sid>Menu(0)
|
||||
augroup END
|
||||
"let b:undo_ftplugin .= '| sil! amenu disable CSV'
|
||||
let b:undo_ftplugin .= '| sil! call <sid>Menu(0)'
|
||||
"
|
||||
" b:undo_ftplugin does not support calling <sid> Functions
|
||||
"let b:undo_ftplugin .= '| sil! call <sid>Menu(0)'
|
||||
endif
|
||||
endfu
|
||||
|
||||
@@ -658,7 +661,7 @@ fu! <sid>ArrangeCol(first, last, bang) range "{{{3
|
||||
else
|
||||
let ro = 0
|
||||
endif
|
||||
exe a:first . ',' . a:last .'s/' . (b:col) .
|
||||
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
|
||||
@@ -795,16 +798,13 @@ fu! <sid>GetColPat(colnr, zs_flag) "{{{3
|
||||
return pat . (a:zs_flag ? '\zs' : '')
|
||||
endfu
|
||||
|
||||
fu! <sid>SetupQuitPre() "{{{3
|
||||
fu! <sid>SetupQuitPre(window) "{{{3
|
||||
" Setup QuitPre autocommand to quit cleanly
|
||||
if exists("##QuitPre")
|
||||
let bufnr=bufnr('')
|
||||
noa wincmd p
|
||||
augroup CSV_QuitPre
|
||||
au!
|
||||
exe "au QuitPre * ". bufnr. "bw"
|
||||
exe "au QuitPre * call CSV_CloseBuffer(".winbufnr(a:window).")"
|
||||
augroup end
|
||||
noa wincmd p
|
||||
endif
|
||||
endfu
|
||||
|
||||
@@ -839,7 +839,7 @@ fu! <sid>SplitHeaderLine(lines, bang, hor) "{{{3
|
||||
"let b:col=b
|
||||
"setl syntax=csv
|
||||
sil! doautocmd FileType csv
|
||||
1
|
||||
noa 1
|
||||
exe "resize" . lines
|
||||
setl scrollopt=hor winfixheight nowrap
|
||||
"let &l:stl=repeat(' ', winwidth(0))
|
||||
@@ -848,31 +848,31 @@ fu! <sid>SplitHeaderLine(lines, bang, hor) "{{{3
|
||||
let &l:fdc = _fdc
|
||||
else
|
||||
setl scrollopt=ver scrollbind
|
||||
0
|
||||
let a=<sid>CopyCol('',1)
|
||||
" Force recalculating columns width
|
||||
unlet! b:csv_list
|
||||
try
|
||||
let width = <sid>ColWidth(1)
|
||||
catch /ColWidth/
|
||||
call <sid>Warn("Error: getting Column Width, using default!")
|
||||
endtry
|
||||
noa 0
|
||||
let a=<sid>CopyCol('',1,a:lines)
|
||||
" Does it make sense to use the preview window?
|
||||
"vert sil! pedit |wincmd w | enew!
|
||||
above vsp +enew
|
||||
call append(0, a)
|
||||
$d _
|
||||
sil %s/.*/\=printf("%.*s", width, submatch(0))/eg
|
||||
0
|
||||
exe "vert res" width
|
||||
let b:col = b
|
||||
sil! doautocmd FileType csv
|
||||
" remove leading delimiter
|
||||
exe "sil :%s/^". b:delimiter. "//e"
|
||||
" remove trailing delimiter
|
||||
exe "sil :%s/". b:delimiter. "\s*$//e"
|
||||
syn clear
|
||||
noa 0
|
||||
let b:csv_SplitWindow = winnr()
|
||||
sil :call <sid>ArrangeCol(1,line('$'), 1)
|
||||
exe "vert res" . len(split(getline(1), '\zs'))
|
||||
call matchadd("CSVHeaderLine", b:col)
|
||||
setl scrollopt=ver winfixwidth
|
||||
endif
|
||||
call <sid>SetupQuitPre()
|
||||
call <sid>SetupQuitPre(winnr())
|
||||
let win = winnr()
|
||||
setl scrollbind buftype=nowrite bufhidden=wipe noswapfile nobuflisted
|
||||
wincmd p
|
||||
noa wincmd p
|
||||
let b:csv_SplitWindow = win
|
||||
aug CSV_Preview
|
||||
au!
|
||||
@@ -891,7 +891,12 @@ fu! <sid>SplitHeaderLine(lines, bang, hor) "{{{3
|
||||
let &sbo = _sbo
|
||||
endif
|
||||
setl noscrollbind
|
||||
try
|
||||
wincmd c
|
||||
catch /^Vim\%((\a\+)\)\=:E444/ " cannot close last window
|
||||
catch /^Vim\%((\a\+)\)\=:E517/ " buffer already wiped
|
||||
" no-op
|
||||
endtry
|
||||
"pclose!
|
||||
unlet! b:csv_SplitWindow
|
||||
aug CSV_Preview
|
||||
@@ -910,8 +915,11 @@ fu! <sid>SplitHeaderToggle(hor) "{{{3
|
||||
endfu
|
||||
|
||||
" TODO: from here on add logic for fixed-width csv files!
|
||||
fu! <sid>MoveCol(forward, line) "{{{3
|
||||
fu! <sid>MoveCol(forward, line, ...) "{{{3
|
||||
" Move cursor position upwards/downwards left/right
|
||||
" a:1 is there to have some mappings move in the same
|
||||
" direction but still stop at a different position
|
||||
" see :h csv-mapping-H
|
||||
let colnr=<SID>WColumn()
|
||||
let maxcol=<SID>MaxColumns()
|
||||
let cpos=getpos('.')[2]
|
||||
@@ -982,6 +990,17 @@ fu! <sid>MoveCol(forward, line) "{{{3
|
||||
norm! 0
|
||||
endif
|
||||
endw
|
||||
if (exists("a:1") && a:1)
|
||||
" H also stops at the beginning of the content
|
||||
" of a field.
|
||||
let epos = getpos('.')
|
||||
if getline('.')[col('.')-1] == ' '
|
||||
call search('\S', 'W', line('.'))
|
||||
if getpos('.')[2] > spos
|
||||
call setpos('.', epos)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
else
|
||||
norm! 0
|
||||
endif
|
||||
@@ -1043,13 +1062,19 @@ fu! <sid>Sort(bang, line1, line2, colnr) range "{{{3
|
||||
call winrestview(wsv)
|
||||
endfun
|
||||
|
||||
fu! <sid>CopyCol(reg, col) "{{{3
|
||||
fu! <sid>CopyCol(reg, col, cnt) "{{{3
|
||||
" Return Specified Column into register reg
|
||||
let col = a:col == "0" ? <sid>WColumn() : a:col+0
|
||||
let mcol = <sid>MaxColumns()
|
||||
if col == '$' || col > mcol
|
||||
let col = mcol
|
||||
endif
|
||||
" The number of columns to return
|
||||
" by default (value of zero, will only return that specific column)
|
||||
let cnt_cols = col - 1
|
||||
if !empty(a:cnt) && a:cnt > 0 && col + a:cnt <= mcol
|
||||
let cnt_cols = col + a:cnt - 1
|
||||
endif
|
||||
let a = []
|
||||
" Don't get lines, that are currently filtered away
|
||||
if !exists("b:csv_filter") || empty(b:csv_filter)
|
||||
@@ -1068,9 +1093,12 @@ fu! <sid>CopyCol(reg, col) "{{{3
|
||||
call filter(a, 'v:val !~ pat')
|
||||
|
||||
if !exists("b:csv_fixed_width_cols")
|
||||
call map(a, 'split(v:val, ''^'' . b:col . ''\zs'')[col-1]')
|
||||
call map(a, 'split(v:val, ''^'' . b:col . ''\zs'')[col-1:cnt_cols]')
|
||||
else
|
||||
call map(a, 'matchstr(v:val, <sid>GetColPat(col, 0))')
|
||||
call map(a, 'matchstr(v:val, <sid>GetColPat(col, 0)).*<sid>GetColPat(col+cnt_cols, 0)')
|
||||
endif
|
||||
if type(a[0]) == type([])
|
||||
call map(a, 'join(v:val, "")')
|
||||
endif
|
||||
if a:reg =~ '[-"0-9a-zA-Z*+]'
|
||||
"exe ':let @' . a:reg . ' = "' . join(a, "\n") . '"'
|
||||
@@ -1574,7 +1602,7 @@ fu! <sid>AnalyzeColumn(...) "{{{3
|
||||
|
||||
" Initialize s:fold_headerline
|
||||
call <sid>CheckHeaderLine()
|
||||
let data = <sid>CopyCol('', colnr)[s:csv_fold_headerline : -1]
|
||||
let data = <sid>CopyCol('', colnr, '')[s:csv_fold_headerline : -1]
|
||||
let qty = len(data)
|
||||
let res = {}
|
||||
for item in data
|
||||
@@ -1665,59 +1693,56 @@ fu! <sid>InitCSVFixedWidth() "{{{3
|
||||
endif
|
||||
" Turn off syntax highlighting
|
||||
syn clear
|
||||
let max_len = len(split(getline(1), '\zs'))
|
||||
let _cc = &l:cc
|
||||
let &l:cc = 1
|
||||
redraw!
|
||||
let list = []
|
||||
let Dict = {'1': 1} " first column is always the start of a new column
|
||||
let tcc = &l:cc
|
||||
let &l:cc = 1
|
||||
echo "<Cursor>, <Space>, <ESC>, <BS>, <CR>..."
|
||||
let char=getchar()
|
||||
while 1
|
||||
if char == "\<Left>" || char == "\<Right>"
|
||||
let tcc = eval('tcc'.(char=="\<Left>" ? '-' : '+').'1')
|
||||
if tcc < 0
|
||||
let tcc=0
|
||||
elseif tcc > max_len
|
||||
let tcc = max_len
|
||||
endif
|
||||
elseif char == "\<Space>" || char == 32 " Space
|
||||
call add(list, tcc)
|
||||
let Dict[tcc] = 1
|
||||
elseif char == "\<BS>" || char == 127
|
||||
call remove(list, -1)
|
||||
try
|
||||
call remove(Dict, reverse(sort(keys(Dict)))[0])
|
||||
catch /^Vim\%((\a\+)\)\=:E\(\%(716\)\|\%(684\)\)/ " Dict or List empty
|
||||
break
|
||||
endtry
|
||||
elseif char == "\<ESC>" || char == 27
|
||||
let &l:cc=_cc
|
||||
redraw!
|
||||
return
|
||||
elseif char == "\<CR>" || char == "\n" || char == "\r" " Enter
|
||||
let Dict[tcc] = 1
|
||||
break
|
||||
else
|
||||
break
|
||||
endif
|
||||
let &l:cc=tcc . (!empty(list)? ',' . join(list, ','):'')
|
||||
let &l:cc=tcc . (!empty(keys(Dict))? ',' . join(keys(Dict), ','):'')
|
||||
redraw!
|
||||
echo "<Cursor>, <Space>, <ESC>, <BS>, <CR>..."
|
||||
let char=getchar()
|
||||
endw
|
||||
if tcc > 0
|
||||
call add(list,tcc)
|
||||
endif
|
||||
let b:csv_fixed_width_cols=[]
|
||||
let tcc=0
|
||||
if !empty(list)
|
||||
call Break()
|
||||
" Remove duplicate entries
|
||||
for val in sort(list, "<sid>SortList")
|
||||
if val==tcc
|
||||
continue
|
||||
endif
|
||||
call add(b:csv_fixed_width_cols, val)
|
||||
let tcc=val
|
||||
endfor
|
||||
let b:csv_fixed_width=join(sort(b:csv_fixed_width_cols,
|
||||
\ "<sid>SortList"), ',')
|
||||
let b:csv_fixed_width_cols = sort(keys(Dict), "<sid>SortList")
|
||||
let b:csv_fixed_width = join(sort(keys(Dict), "<sid>SortList"), ',')
|
||||
call <sid>Init(1, line('$'))
|
||||
endif
|
||||
|
||||
let &l:cc=_cc
|
||||
redraw!
|
||||
endfu
|
||||
|
||||
fu! Break()
|
||||
return
|
||||
endfu
|
||||
|
||||
fu! <sid>NewRecord(line1, line2, count) "{{{3
|
||||
if a:count =~ "\D"
|
||||
call <sid>WarningMsg("Invalid count specified")
|
||||
@@ -1757,22 +1782,35 @@ fu! <sid>MoveOver(outer) "{{{3
|
||||
" Move over a field
|
||||
" a:outer means include the delimiter
|
||||
let last = 0
|
||||
let mode = a:outer
|
||||
let outer_field = a:outer
|
||||
let cur_field = <sid>WColumn()
|
||||
let _wsv = winsaveview()
|
||||
|
||||
if <sid>WColumn() == <sid>MaxColumns()
|
||||
if cur_field == <sid>MaxColumns()
|
||||
let last = 1
|
||||
if !mode && getline('.')[-1:] != b:delimiter
|
||||
if !outer_field && getline('.')[-1:] != b:delimiter
|
||||
" No trailing delimiter, so inner == outer
|
||||
let mode = 1
|
||||
let outer_field = 1
|
||||
endif
|
||||
endif
|
||||
call <sid>MoveCol(-1, line("."))
|
||||
" Move 1 column backwards, unless the cursor is in the first column
|
||||
" or in front of a delimiter
|
||||
if matchstr(getline('.'), '.\%'.virtcol('.').'v') != b:delimiter && virtcol('.') > 1
|
||||
call <sid>MoveCol(-1, line('.'))
|
||||
endif
|
||||
" if cur_field != <sid>WColumn()
|
||||
" cursor was at the beginning of the field, and moved back to the
|
||||
" previous field, move back to original position
|
||||
" call cursor(_wsv.lnum, _wsv.col)
|
||||
" endif
|
||||
let _s = @/
|
||||
if last
|
||||
exe "sil! norm! /" . b:col . "\<cr>v$h" . (mode ? "" : "\<Left>")
|
||||
exe "sil! norm! v$h" . (outer_field ? "" : "h") . (&sel ==# 'exclusive' ? "l" : '')
|
||||
else
|
||||
exe "sil! norm! /" . b:col . "\<cr>vn\<Left>" . (mode ? "" : "\<Left>")
|
||||
exe "sil! norm! v/." . b:col . "\<cr>h" . (outer_field ? "" : "h") . (&sel ==# 'exclusive' ? "l" : '')
|
||||
endif
|
||||
let _wsv.col = col('.')-1
|
||||
call winrestview(_wsv)
|
||||
let @/ = _s
|
||||
endfu
|
||||
|
||||
@@ -1782,7 +1820,7 @@ fu! <sid>CSVMappings() "{{{3
|
||||
call <sid>Map('noremap', 'L', ':<C-U>call <SID>MoveCol(1, line("."))<CR>')
|
||||
call <sid>Map('noremap', 'E', ':<C-U>call <SID>MoveCol(-1, line("."))<CR>')
|
||||
call <sid>Map('noremap', '<C-Left>', ':<C-U>call <SID>MoveCol(-1, line("."))<CR>')
|
||||
call <sid>Map('noremap', 'H', ':<C-U>call <SID>MoveCol(-1, line("."))<CR>')
|
||||
call <sid>Map('noremap', 'H', ':<C-U>call <SID>MoveCol(-1, line("."), 1)<CR>')
|
||||
call <sid>Map('noremap', 'K', ':<C-U>call <SID>MoveCol(0,
|
||||
\ line(".")-v:count1)<CR>')
|
||||
call <sid>Map('noremap', '<Up>', ':<C-U>call <SID>MoveCol(0,
|
||||
@@ -1846,8 +1884,8 @@ fu! <sid>CommandDefinitions() "{{{3
|
||||
\ ':call <sid>Sort(<bang>0, <line1>,<line2>,<q-args>)',
|
||||
\ '-nargs=* -bang -range=% -complete=custom,<sid>SortComplete')
|
||||
call <sid>LocalCmd("Column",
|
||||
\ ':call <sid>CopyCol(empty(<q-reg>)?''"'':<q-reg>,<q-count>)',
|
||||
\ '-count -register')
|
||||
\ ':call <sid>CopyCol(empty(<q-reg>)?''"'':<q-reg>,<q-count>,<q-args>)',
|
||||
\ '-count -register -nargs=?')
|
||||
call <sid>LocalCmd("MoveColumn",
|
||||
\ ':call <sid>MoveColumn(<line1>,<line2>,<f-args>)',
|
||||
\ '-range=% -nargs=* -complete=custom,<sid>SortComplete')
|
||||
@@ -2328,6 +2366,11 @@ endfu
|
||||
|
||||
" Global functions "{{{2
|
||||
fu! csv#EvalColumn(nr, func, first, last) range "{{{3
|
||||
" Make sure, the function is called for the correct filetype.
|
||||
if match(split(&ft, '\.'), 'csv') == -1
|
||||
call <sid>Warn("File is no CSV file!")
|
||||
return
|
||||
endif
|
||||
let save = winsaveview()
|
||||
call <sid>CheckHeaderLine()
|
||||
let nr = matchstr(a:nr, '^\d\+')
|
||||
@@ -2336,7 +2379,7 @@ fu! csv#EvalColumn(nr, func, first, last) range "{{{3
|
||||
let start = a:first - 1 + s:csv_fold_headerline
|
||||
let stop = a:last - 1 + s:csv_fold_headerline
|
||||
|
||||
let column = <sid>CopyCol('', col)[start : stop]
|
||||
let column = <sid>CopyCol('', col, '')[start : stop]
|
||||
" Delete delimiter
|
||||
call map(column, 'substitute(v:val, b:delimiter . "$", "", "g")')
|
||||
" Revmoe trailing whitespace
|
||||
@@ -2396,7 +2439,7 @@ fu! CSVField(x, y, ...) "{{{3
|
||||
let orig = !empty(a:0)
|
||||
let y = (y < 0 ? 0 : y)
|
||||
let x = (x > (<sid>MaxColumns()) ? (<sid>MaxColumns()) : x)
|
||||
let col = <sid>CopyCol('',x)
|
||||
let col = <sid>CopyCol('',x,'')
|
||||
if !orig
|
||||
" remove leading and trainling whitespace and the delimiter
|
||||
return matchstr(col[y], '^\s*\zs.\{-}\ze\s*'.b:delimiter.'\?$')
|
||||
@@ -2435,6 +2478,23 @@ fu! CSV_WCol(...) "{{{3
|
||||
endtry
|
||||
endfun
|
||||
|
||||
fu! CSV_CloseBuffer(buffer) "{{{3
|
||||
" Setup by SetupQuitPre autocommand
|
||||
try
|
||||
if bufnr((a:buffer)+0) > -1
|
||||
exe a:buffer. "bw"
|
||||
endif
|
||||
catch /^Vim\%((\a\+)\)\=:E517/ " buffer already wiped
|
||||
" no-op
|
||||
finally
|
||||
augroup CSV_QuitPre
|
||||
au!
|
||||
augroup END
|
||||
augroup! CSV_QuitPre
|
||||
endtry
|
||||
endfu
|
||||
|
||||
|
||||
" Initialize Plugin "{{{2
|
||||
let b:csv_start = exists("b:csv_start") ? b:csv_start : 1
|
||||
let b:csv_end = exists("b:csv_end") ? b:csv_end : line('$')
|
||||
|
||||
@@ -18,15 +18,21 @@
|
||||
"
|
||||
" Flag to indicate whether to enable the commands listed above.
|
||||
"
|
||||
" g:gofmt_command [default="gofmt"]
|
||||
"
|
||||
" Flag naming the gofmt executable to use.
|
||||
"
|
||||
if exists("b:did_ftplugin_go_fmt")
|
||||
finish
|
||||
endif
|
||||
|
||||
|
||||
if !exists("g:go_fmt_commands")
|
||||
let g:go_fmt_commands = 1
|
||||
endif
|
||||
|
||||
if !exists("g:gofmt_command")
|
||||
let g:gofmt_command = "gofmt"
|
||||
endif
|
||||
|
||||
if g:go_fmt_commands
|
||||
command! -buffer Fmt call s:GoFormat()
|
||||
@@ -34,7 +40,7 @@ endif
|
||||
|
||||
function! s:GoFormat()
|
||||
let view = winsaveview()
|
||||
silent %!gofmt
|
||||
silent execute "%!" . g:gofmt_command
|
||||
if v:shell_error
|
||||
let errors = []
|
||||
for line in getline(1, line('$'))
|
||||
@@ -51,7 +57,7 @@ function! s:GoFormat()
|
||||
endif
|
||||
undo
|
||||
if !empty(errors)
|
||||
call setloclist(0, errors, 'r')
|
||||
call setqflist(errors, 'r')
|
||||
endif
|
||||
echohl Error | echomsg "Gofmt returned error" | echohl None
|
||||
endif
|
||||
|
||||
@@ -45,7 +45,7 @@ endif
|
||||
|
||||
setlocal comments=://-,:// commentstring=//\ %s
|
||||
|
||||
setlocal suffixesadd=.jade
|
||||
setlocal suffixesadd+=.jade
|
||||
|
||||
let b:undo_ftplugin = "setl cms< com< "
|
||||
\ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin
|
||||
|
||||
@@ -291,7 +291,7 @@ function! LatexBox_BibSearch(regexp)
|
||||
|
||||
" Find data from 'thebibliography' environments
|
||||
let lines = readfile(LatexBox_GetMainTexFile())
|
||||
if match(lines, '\C\\begin{thebibliography}')
|
||||
if match(lines, '\C\\begin{thebibliography}') >= 0
|
||||
for line in filter(filter(lines, 'v:val =~ ''\C\\bibitem'''),
|
||||
\ 'v:val =~ a:regexp')
|
||||
let match = matchlist(line, '\\bibitem{\([^}]*\)')[1]
|
||||
|
||||
@@ -92,8 +92,8 @@ function! s:LatexmkCallback(basename, status)
|
||||
" Only remove the pid if not in continuous mode
|
||||
if !g:LatexBox_latexmk_preview_continuously
|
||||
call remove(g:latexmk_running_pids, a:basename)
|
||||
call LatexBox_LatexErrors(a:status, a:basename)
|
||||
endif
|
||||
call LatexBox_LatexErrors(a:status, a:basename)
|
||||
endfunction
|
||||
|
||||
function! s:setup_vim_server()
|
||||
@@ -104,7 +104,7 @@ function! s:setup_vim_server()
|
||||
if has('win32')
|
||||
" Just drop through to the default for windows
|
||||
else
|
||||
if match(&shell, '/\(bash\|zsh\)$') >= 0
|
||||
if match(&shell, '\(bash\|zsh\)$') >= 0
|
||||
let ppid = '$PPID'
|
||||
else
|
||||
let ppid = '$$'
|
||||
@@ -188,6 +188,10 @@ function! LatexBox_Latexmk(force)
|
||||
endif
|
||||
let cmd .= ' -e ' . shellescape('$pdflatex =~ s/ / -file-line-error /')
|
||||
let cmd .= ' -e ' . shellescape('$latex =~ s/ / -file-line-error /')
|
||||
if g:LatexBox_latexmk_preview_continuously
|
||||
let cmd .= ' -e ' . shellescape('$success_cmd = $ENV{SUCCESSCMD}')
|
||||
let cmd .= ' -e ' . shellescape('$failure_cmd = $ENV{FAILURECMD}')
|
||||
endif
|
||||
let cmd .= ' ' . mainfile
|
||||
|
||||
" Redirect output to null
|
||||
@@ -223,8 +227,27 @@ function! LatexBox_Latexmk(force)
|
||||
let callback = callbackfunc . '(''' . basepath . ''', %LATEXERR%)'
|
||||
let vimcmd = vim_program . ' --servername ' . v:servername
|
||||
\ . ' --remote-expr ' . shellescape(callback)
|
||||
let scallback = callbackfunc . '(''' . basepath . ''', 0)'
|
||||
let svimcmd = vim_program . ' --servername ' . v:servername
|
||||
\ . ' --remote-expr ' . shellescape(scallback)
|
||||
let fcallback = callbackfunc . '(''' . basepath . ''', 1)'
|
||||
let fvimcmd = vim_program . ' --servername ' . v:servername
|
||||
\ . ' --remote-expr ' . shellescape(fcallback)
|
||||
|
||||
let asyncbat = tempname() . '.bat'
|
||||
if g:LatexBox_latexmk_preview_continuously
|
||||
call writefile(['setlocal',
|
||||
\ 'set T=%TEMP%\sthUnique.tmp',
|
||||
\ 'wmic process where (Name="WMIC.exe" AND CommandLine LIKE "%%%TIME%%%") '
|
||||
\ . 'get ParentProcessId /value | find "ParentProcessId" >%T%',
|
||||
\ 'set /P A=<%T%',
|
||||
\ 'set CMDPID=%A:~16% & del %T%',
|
||||
\ vimsetpid,
|
||||
\ 'set SUCCESSCMD='.svimcmd,
|
||||
\ 'set FAILURECMD='.fvimcmd,
|
||||
\ cmd,
|
||||
\ 'endlocal'], asyncbat)
|
||||
else
|
||||
call writefile(['setlocal',
|
||||
\ 'set T=%TEMP%\sthUnique.tmp',
|
||||
\ 'wmic process where (Name="WMIC.exe" AND CommandLine LIKE "%%%TIME%%%") '
|
||||
@@ -236,6 +259,7 @@ function! LatexBox_Latexmk(force)
|
||||
\ 'set LATEXERR=%ERRORLEVEL%',
|
||||
\ vimcmd,
|
||||
\ 'endlocal'], asyncbat)
|
||||
endif
|
||||
|
||||
" Define command
|
||||
let cmd = '!start /b ' . asyncbat . ' & del ' . asyncbat
|
||||
@@ -249,12 +273,25 @@ function! LatexBox_Latexmk(force)
|
||||
let callback = shellescape(callbackfunc).'"(\"'.basepath.'\",$?)"'
|
||||
let vimcmd = g:vim_program . ' --servername ' . v:servername
|
||||
\ . ' --remote-expr ' . callback
|
||||
let scallback = shellescape(callbackfunc).'"(\"'.basepath.'\",0)"'
|
||||
let svimcmd = g:vim_program . ' --servername ' . v:servername
|
||||
\ . ' --remote-expr ' . scallback
|
||||
let fcallback = shellescape(callbackfunc).'"(\"'.basepath.'\",1)"'
|
||||
let fvimcmd = g:vim_program . ' --servername ' . v:servername
|
||||
\ . ' --remote-expr ' . fcallback
|
||||
|
||||
" Define command
|
||||
" Note: Here we escape '%' because it may be given as a user option
|
||||
" through g:LatexBox_latexmk_options, for instance with
|
||||
" g:Latex..._options = "-pdflatex='pdflatex -synctex=1 \%O \%S'"
|
||||
if g:LatexBox_latexmk_preview_continuously
|
||||
let cmd = vimsetpid . ' ; '
|
||||
\ . 'export SUCCESSCMD=' . shellescape(svimcmd) . ' '
|
||||
\ . ' FAILURECMD=' . shellescape(fvimcmd) . ' ; '
|
||||
\ . escape(cmd, '%')
|
||||
else
|
||||
let cmd = vimsetpid . ' ; ' . escape(cmd, '%') . ' ; ' . vimcmd
|
||||
endif
|
||||
let cmd = '! (' . cmd . ') >/dev/null &'
|
||||
endif
|
||||
|
||||
|
||||
@@ -117,16 +117,21 @@ if globpath(&rtp, 'plugin/fuf.vim') != ''
|
||||
return scala#GetDirForFuzzyFinder(a:from, 'src/../')
|
||||
endfunction
|
||||
|
||||
nnoremap <buffer> <silent> ,ft :FufFile <c-r>=scala#GetTestDirForFuzzyFinder('%:p:h')<cr><cr>
|
||||
nnoremap <buffer> <silent> ,fs :FufFile <c-r>=scala#GetMainDirForFuzzyFinder('%:p:h')<cr><cr>
|
||||
nnoremap <buffer> <silent> ,fr :FufFile <c-r>=scala#GetRootDirForFuzzyFinder('%:p:h')<cr><cr>
|
||||
" 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> <silent> <Leader>ft :FufFile <c-r>=scala#GetTestDirForFuzzyFinder('%:p:h')<cr><cr>
|
||||
nnoremap <buffer> <silent> <Leader>fs :FufFile <c-r>=scala#GetMainDirForFuzzyFinder('%:p:h')<cr><cr>
|
||||
nnoremap <buffer> <silent> <Leader>fr :FufFile <c-r>=scala#GetRootDirForFuzzyFinder('%:p:h')<cr><cr>
|
||||
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> ,jt :call JustifyCurrentLine()<cr>
|
||||
nnoremap <buffer> <Leader>jt :call JustifyCurrentLine()<cr>
|
||||
endif
|
||||
|
||||
"
|
||||
|
||||
@@ -130,12 +130,14 @@ call add(s:tags, 'rt')
|
||||
call add(s:tags, 'ruby')
|
||||
call add(s:tags, 'section')
|
||||
call add(s:tags, 'summary')
|
||||
call add(s:tags, 'template')
|
||||
call add(s:tags, 'time')
|
||||
call add(s:tags, 'video')
|
||||
call add(s:tags, 'bdi')
|
||||
call add(s:tags, 'data')
|
||||
|
||||
" Web Component
|
||||
call add(s:tags, 'template')
|
||||
|
||||
" Common inline used SVG elements
|
||||
call add(s:tags, 'clipPath')
|
||||
call add(s:tags, 'defs')
|
||||
|
||||
@@ -6,6 +6,36 @@
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal autoindent sw=2 et
|
||||
setlocal indentexpr=GetLessIndent()
|
||||
setlocal indentkeys=o,O,*<Return>,<:>,!^F
|
||||
|
||||
" Only define the function once.
|
||||
if exists("*GetLessIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:property = '^\s*:\|^\s*[[:alnum:]#{}-]\+\%(:\|\s*=\)'
|
||||
|
||||
function! GetLessIndent()
|
||||
let lnum = prevnonblank(v:lnum-1)
|
||||
let line = substitute(getline(lnum),'\s\+$','','')
|
||||
let cline = substitute(substitute(getline(v:lnum),'\s\+$','',''),'^\s\+','','')
|
||||
let lastcol = strlen(line)
|
||||
let line = substitute(line,'^\s\+','','')
|
||||
let indent = indent(lnum)
|
||||
let cindent = indent(v:lnum)
|
||||
if line !~ s:property && cline =~ s:property
|
||||
return indent + &sw
|
||||
"elseif line =~ s:property && cline !~ s:property
|
||||
"return indent - &sw
|
||||
else
|
||||
return -1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" vim:set sw=2:
|
||||
|
||||
runtime! indent/css.vim
|
||||
|
||||
|
||||
@@ -18,10 +18,10 @@ syn keyword elixirTodo FIXME NOTE TODO OPTIMIZE XXX HACK contained
|
||||
syn keyword elixirKeyword is_atom is_binary is_bitstring is_boolean is_float is_function is_integer is_list is_number is_pid is_port is_record is_reference is_tuple is_exception
|
||||
syn keyword elixirKeyword case cond bc lc inlist inbits if unless try receive function
|
||||
syn keyword elixirKeyword exit raise throw after rescue catch else
|
||||
syn keyword elixirKeyword use quote unquote super alias
|
||||
syn keyword elixirKeyword quote unquote super
|
||||
syn match elixirKeyword '\<\%(->\)\>\s*'
|
||||
|
||||
syn keyword elixirInclude import require
|
||||
syn keyword elixirInclude import require alias use
|
||||
|
||||
syn keyword elixirOperator and not or when xor in
|
||||
syn match elixirOperator '%=\|\*=\|\*\*=\|+=\|-=\|\^=\|||='
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
syn keyword htmlTagName contained article aside audio canvas command
|
||||
syn keyword htmlTagName contained datalist details dialog embed figcaption figure footer
|
||||
syn keyword htmlTagName contained header hgroup keygen main mark meter menu nav output
|
||||
syn keyword htmlTagName contained progress ruby rt rp section source summary template time track video data
|
||||
syn keyword htmlTagName contained progress ruby rt rp section source summary time track video data
|
||||
syn keyword htmlTagName contained template content shadow
|
||||
syn keyword htmlTagName contained wbr bdi
|
||||
|
||||
" SVG tags
|
||||
@@ -40,10 +41,12 @@ syn keyword htmlTagName contained linearGradient marker mask pattern radialGradi
|
||||
syn keyword htmlTagName contained missing-glyph mpath
|
||||
syn keyword htmlTagName contained text textPath tref tspan vkern
|
||||
|
||||
syn match htmlTagName contained "\<[a-z_]\+\(\-[a-z_]\+\)\+\>"
|
||||
|
||||
" HTML 5 arguments
|
||||
" Core Attributes
|
||||
syn keyword htmlArg contained accesskey class contenteditable contextmenu dir
|
||||
syn keyword htmlArg contained draggable hidden id lang spellcheck style tabindex title translate
|
||||
syn keyword htmlArg contained draggable hidden id is lang spellcheck style tabindex title translate
|
||||
" Event-handler Attributes
|
||||
syn keyword htmlArg contained onabort onblur oncanplay oncanplaythrough onchange
|
||||
syn keyword htmlArg contained onclick oncontextmenu ondblclick ondrag ondragend ondragenter ondragleave ondragover
|
||||
@@ -69,6 +72,8 @@ syn keyword htmlArg contained required placeholder
|
||||
syn keyword htmlArg contained label icon open datetime pubdate
|
||||
" <script>
|
||||
syn keyword htmlArg contained async
|
||||
" <content>
|
||||
syn keyword htmlArg contained select
|
||||
|
||||
" Custom Data Attributes
|
||||
" http://dev.w3.org/html5/spec/elements.html#embedding-custom-non-visible-data
|
||||
|
||||
@@ -35,7 +35,7 @@ syn match lessClass "[[:alnum:]_-]\+" contained
|
||||
" string functions
|
||||
syn keyword lessFunction escape e % containedin=cssDefinition contained
|
||||
" misc functions
|
||||
syn keyword lessFunction color unit containedin=cssDefinition contained
|
||||
syn keyword lessFunction unit containedin=cssDefinition contained
|
||||
" math functions
|
||||
syn keyword lessFunction ceil floor percentage round containedin=cssDefinition contained
|
||||
" color definition
|
||||
|
||||
@@ -54,12 +54,13 @@ endif
|
||||
" them. If you have any suggestions, please let me know.
|
||||
"
|
||||
syn region masonPod start="^=[a-z]" end="^=cut" keepend contained contains=@podTop
|
||||
syn region masonPerlBraces start="{" end="}" contained
|
||||
syn region masonLine matchgroup=Delimiter start="^%" end="$" keepend contains=@perlTop,masonPerlBraces
|
||||
syn region masonExpr matchgroup=Delimiter start="<%" end="%>" contains=@perlTop
|
||||
syn cluster perlTop remove=perlBraces
|
||||
syn region masonLine matchgroup=Delimiter start="^%" end="$" keepend contains=@perlTop
|
||||
syn region masonPerlComment start="#" end="\%(%>\)\@=\|$" contained contains=perlTodo,@Spell
|
||||
syn region masonExpr matchgroup=Delimiter start="<%" end="%>" contains=@perlTop,masonPerlComment
|
||||
syn region masonPerl matchgroup=Delimiter start="<%perl>" end="</%perl>" contains=masonPod,@perlTop
|
||||
syn region masonComp keepend matchgroup=Delimiter start="<&\s*\%(\a\+:\)\?[._/[:alnum:]]*" end="&>" contains=@perlTop
|
||||
syn region masonComp keepend matchgroup=Delimiter skipnl start="<&|\s*\%(\a\+:\)\?[._/[:alnum:]]*" end="&>" contains=@perlTop nextgroup=masonCompContent
|
||||
syn region masonComp keepend matchgroup=Delimiter start="<&\s*\%([-._/[:alnum:]]\+:\)\?[-._/[:alnum:]]*" end="&>" contains=@perlTop
|
||||
syn region masonComp keepend matchgroup=Delimiter skipnl start="<&|\s*\%([-._/[:alnum:]]\+:\)\?[-._/[:alnum:]]*" end="&>" contains=@perlTop nextgroup=masonCompContent
|
||||
syn region masonCompContent matchgroup=Delimiter start="" end="</&>" contained contains=@masonTop
|
||||
|
||||
syn region masonArgs matchgroup=Delimiter start="<%args>" end="</%args>" contains=masonPod,@perlTop
|
||||
@@ -70,8 +71,8 @@ syn region masonOnce matchgroup=Delimiter start="<%once>" end="</%once>" contain
|
||||
syn region masonClass matchgroup=Delimiter start="<%class>" end="</%class>" contains=masonPod,@perlTop
|
||||
syn region masonShared matchgroup=Delimiter start="<%shared>" end="</%shared>" contains=masonPod,@perlTop
|
||||
|
||||
syn region masonDef matchgroup=Delimiter start="<%def\s*[._/[:alnum:]]\+\s*>" end="</%def>" contains=@htmlTop
|
||||
syn region masonMethod matchgroup=Delimiter start="<%method\s*[._/[:alnum:]]\+\s*>" end="</%method>" contains=@htmlTop
|
||||
syn region masonDef matchgroup=Delimiter start="<%def\s*[-._/[:alnum:]]\+\s*>" end="</%def>" contains=@htmlTop
|
||||
syn region masonMethod matchgroup=Delimiter start="<%method\s*[-._/[:alnum:]]\+\s*>" end="</%method>" contains=@htmlTop
|
||||
|
||||
syn region masonFlags matchgroup=Delimiter start="<%flags>" end="</%flags>" contains=masonPod,@perlTop
|
||||
syn region masonAttr matchgroup=Delimiter start="<%attr>" end="</%attr>" contains=masonPod,@perlTop
|
||||
@@ -96,6 +97,7 @@ if version >= 508 || !exists("did_mason_syn_inits")
|
||||
|
||||
HiLink masonDoc Comment
|
||||
HiLink masonPod Comment
|
||||
HiLink masonPerlComment perlComment
|
||||
|
||||
delc HiLink
|
||||
endif
|
||||
|
||||
@@ -108,7 +108,7 @@ syn match perlStatementMisc "\<\%(warn\|format\|formline\|reset\|scalar\|protot
|
||||
|
||||
syn keyword perlTodo TODO TODO: TBD TBD: FIXME FIXME: XXX XXX: NOTE NOTE: contained
|
||||
|
||||
syn region perlStatementIndirObjWrap matchgroup=perlStatementIndirObj start="\<\%(map\|grep\|sort\|printf\=\|say\|system\|exec\)\>\s*{" end="}" contains=@perlTop,perlBraces extend
|
||||
syn region perlStatementIndirObjWrap matchgroup=perlStatementIndirObj start="\%(\<\%(map\|grep\|sort\|printf\=\|say\|system\|exec\)\>\s*\)\@<={" end="}" transparent extend
|
||||
|
||||
syn match perlLabel "^\s*\h\w*\s*::\@!\%(\<v\d\+\s*:\)\@<!"
|
||||
|
||||
@@ -125,7 +125,7 @@ syn match perlLabel "^\s*\h\w*\s*::\@!\%(\<v\d\+\s*:\)\@<!"
|
||||
" Special variables first ($^A, ...) and ($|, $', ...)
|
||||
syn match perlVarPlain "$^[ACDEFHILMNOPRSTVWX]\="
|
||||
syn match perlVarPlain "$[\\\"\[\]'&`+*.,;=%~!?@#$<>(-]"
|
||||
syn match perlVarPlain "%+"
|
||||
syn match perlVarPlain "@[-+]"
|
||||
syn match perlVarPlain "$\%(0\|[1-9]\d*\)"
|
||||
" Same as above, but avoids confusion in $::foo (equivalent to $main::foo)
|
||||
syn match perlVarPlain "$::\@!"
|
||||
@@ -152,6 +152,8 @@ else
|
||||
syn match perlFunctionName "&\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod
|
||||
endif
|
||||
|
||||
syn match perlVarPlain2 "%[-+]"
|
||||
|
||||
if !exists("perl_no_extended_vars")
|
||||
syn cluster perlExpr contains=perlStatementIndirObjWrap,perlStatementScalar,perlStatementRegexp,perlStatementNumeric,perlStatementList,perlStatementHash,perlStatementFiles,perlStatementTime,perlStatementMisc,perlVarPlain,perlVarPlain2,perlVarNotInMatches,perlVarSlash,perlVarBlock,perlVarBlock2,perlShellCommand,perlFloat,perlNumber,perlStringUnexpanded,perlString,perlQQ,perlArrow,perlBraces
|
||||
syn region perlArrow matchgroup=perlArrow start="->\s*(" end=")" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod contained
|
||||
@@ -246,11 +248,9 @@ syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m#+
|
||||
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*'+ end=+'[msixpodualgc]*+ contains=@perlInterpSQ keepend extend
|
||||
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*/+ end=+/[msixpodualgc]*+ contains=@perlInterpSlash keepend extend
|
||||
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*(+ end=+)[msixpodualgc]*+ contains=@perlInterpMatch,perlParensDQ keepend extend
|
||||
|
||||
" A special case for m{}, m<> and m[] which allows for comments and extra whitespace in the pattern
|
||||
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*{+ end=+}[msixpodualgc]*+ contains=@perlInterpMatch,perlComment,perlBracesDQ extend
|
||||
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*{+ end=+}[msixpodualgc]*+ contains=@perlInterpMatch,perlBracesDQ extend
|
||||
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*<+ end=+>[msixpodualgc]*+ contains=@perlInterpMatch,perlAnglesDQ keepend extend
|
||||
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*\[+ end=+\][msixpodualgc]*+ contains=@perlInterpMatch,perlComment,perlBracketsDQ keepend extend
|
||||
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*\[+ end=+\][msixpodualgc]*+ contains=@perlInterpMatch,perlBracketsDQ keepend extend
|
||||
|
||||
" Below some hacks to recognise the // variant. This is virtually impossible to catch in all
|
||||
" cases as the / is used in so many other ways, but these should be the most obvious ones.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
" Maintainer: Patrick Walton <pcwalton@mozilla.com>
|
||||
" Maintainer: Ben Blum <bblum@cs.cmu.edu>
|
||||
" Maintainer: Chris Morgan <me@chrismorgan.info>
|
||||
" Last Change: 2013 Oct 29
|
||||
" Last Change: 2013 Dec 10
|
||||
|
||||
if version < 600
|
||||
syntax clear
|
||||
@@ -19,22 +19,23 @@ syn keyword rustOperator as
|
||||
syn match rustAssert "\<assert\(\w\)*!" contained
|
||||
syn match rustFail "\<fail\(\w\)*!" contained
|
||||
syn keyword rustKeyword break continue do extern
|
||||
syn keyword rustKeyword in if impl let log
|
||||
syn keyword rustKeyword for impl let log
|
||||
syn keyword rustKeyword loop mod once priv pub
|
||||
syn keyword rustKeyword for in if impl let
|
||||
syn keyword rustKeyword loop once priv pub
|
||||
syn keyword rustKeyword return
|
||||
syn keyword rustKeyword unsafe while
|
||||
syn keyword rustKeyword use nextgroup=rustModPath skipwhite
|
||||
" FIXME: Scoped impl's name is also fallen in this category
|
||||
syn keyword rustKeyword mod trait struct enum type nextgroup=rustIdentifier skipwhite
|
||||
syn keyword rustKeyword fn nextgroup=rustFuncName skipwhite
|
||||
syn keyword rustStorage const mut ref static
|
||||
syn keyword rustKeyword proc
|
||||
syn keyword rustStorage mut ref static
|
||||
syn keyword rustObsoleteStorage const
|
||||
|
||||
syn match rustIdentifier contains=rustIdentifierPrime "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained
|
||||
syn match rustFuncName "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained
|
||||
|
||||
" Reserved (but not yet used) keywords {{{2
|
||||
syn keyword rustKeyword alignof be offsetof pure sizeof typeof yield
|
||||
syn keyword rustReservedKeyword alignof be offsetof pure sizeof typeof yield
|
||||
|
||||
" Built-in types {{{2
|
||||
syn keyword rustType int uint float char bool u8 u16 u32 u64 f32
|
||||
@@ -89,6 +90,7 @@ syn keyword rustTrait Orderable Signed Unsigned Round
|
||||
syn keyword rustTrait Primitive Int Float ToStrRadix ToPrimitive FromPrimitive
|
||||
syn keyword rustTrait GenericPath Path PosixPath WindowsPath
|
||||
syn keyword rustTrait RawPtr
|
||||
syn keyword rustTrait Buffer Writer Reader Seek
|
||||
syn keyword rustTrait SendStr SendStrOwned SendStrStatic IntoSendStr
|
||||
syn keyword rustTrait Str StrVector StrSlice OwnedStr
|
||||
syn keyword rustTrait IterBytes
|
||||
@@ -143,38 +145,30 @@ syn match rustOperator display "&&\|||"
|
||||
syn match rustMacro '\w\(\w\)*!' contains=rustAssert,rustFail
|
||||
syn match rustMacro '#\w\(\w\)*' contains=rustAssert,rustFail
|
||||
|
||||
syn match rustFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlLjzt]\|ll\|hh\)\=\([aAbdiuoxXDOUfFeEgGcCsSpn?]\|\[\^\=.[^]]*\]\)" contained
|
||||
syn match rustFormat display "%%" contained
|
||||
syn match rustSpecialError display contained /\\./
|
||||
syn match rustSpecial display contained /\\\([nrt0\\'"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)/
|
||||
syn match rustStringContinuation display contained /\\\n\s*/
|
||||
syn region rustString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustTodo,rustFormat,rustSpecial,rustStringContinuation
|
||||
syn region rustString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustSpecial,rustSpecialError,rustStringContinuation
|
||||
syn region rustString start='r\z(#*\)"' end='"\z1'
|
||||
|
||||
syn region rustAttribute start="#\[" end="\]" contains=rustString,rustDeriving
|
||||
syn region rustDeriving start="deriving(" end=")" contained contains=rustTrait
|
||||
|
||||
" Number literals
|
||||
syn match rustNumber display "\<[0-9][0-9_]*\>"
|
||||
syn match rustNumber display "\<[0-9][0-9_]*\(u\|u8\|u16\|u32\|u64\)\>"
|
||||
syn match rustNumber display "\<[0-9][0-9_]*\(i\|i8\|i16\|i32\|i64\)\>"
|
||||
syn match rustDecNumber display "\<[0-9][0-9_]*\%([iu]\%(8\|16\|32\|64\)\=\)\="
|
||||
syn match rustHexNumber display "\<0x[a-fA-F0-9_]\+\%([iu]\%(8\|16\|32\|64\)\=\)\="
|
||||
syn match rustOctNumber display "\<0o[0-7_]\+\%([iu]\%(8\|16\|32\|64\)\=\)\="
|
||||
syn match rustBinNumber display "\<0b[01_]\+\%([iu]\%(8\|16\|32\|64\)\=\)\="
|
||||
|
||||
syn match rustHexNumber display "\<0x[a-fA-F0-9_]\+\>"
|
||||
syn match rustHexNumber display "\<0x[a-fA-F0-9_]\+\(u\|u8\|u16\|u32\|u64\)\>"
|
||||
syn match rustHexNumber display "\<0x[a-fA-F0-9_]\+\(i8\|i16\|i32\|i64\)\>"
|
||||
syn match rustOctNumber display "\<0o[0-7_]\+\>"
|
||||
syn match rustOctNumber display "\<0o[0-7_]\+\(u\|u8\|u16\|u32\|u64\)\>"
|
||||
syn match rustOctNumber display "\<0o[0-7_]\+\(i8\|i16\|i32\|i64\)\>"
|
||||
syn match rustBinNumber display "\<0b[01_]\+\>"
|
||||
syn match rustBinNumber display "\<0b[01_]\+\(u\|u8\|u16\|u32\|u64\)\>"
|
||||
syn match rustBinNumber display "\<0b[01_]\+\(i8\|i16\|i32\|i64\)\>"
|
||||
|
||||
syn match rustFloat display "\<[0-9][0-9_]*\(f\|f32\|f64\)\>"
|
||||
syn match rustFloat display "\<[0-9][0-9_]*\([eE][+-]\=[0-9_]\+\)\>"
|
||||
syn match rustFloat display "\<[0-9][0-9_]*\([eE][+-]\=[0-9_]\+\)\(f\|f32\|f64\)\>"
|
||||
syn match rustFloat display "\<[0-9][0-9_]*\.[0-9_]\+\>"
|
||||
syn match rustFloat display "\<[0-9][0-9_]*\.[0-9_]\+\(f\|f32\|f64\)\>"
|
||||
syn match rustFloat display "\<[0-9][0-9_]*\.[0-9_]\+\%([eE][+-]\=[0-9_]\+\)\>"
|
||||
syn match rustFloat display "\<[0-9][0-9_]*\.[0-9_]\+\%([eE][+-]\=[0-9_]\+\)\(f\|f32\|f64\)\>"
|
||||
" Special case for numbers of the form "1." which are float literals, unless followed by
|
||||
" an identifier, which makes them integer literals with a method call or field access.
|
||||
" (This must go first so the others take precedence.)
|
||||
syn match rustFloat display "\<[0-9][0-9_]*\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\@!"
|
||||
" To mark a number as a normal float, it must have at least one of the three things integral values don't have:
|
||||
" a decimal point and more numbers; an exponent; and a type suffix.
|
||||
syn match rustFloat display "\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\%([eE][+-]\=[0-9_]\+\)\=\(f32\|f64\)\="
|
||||
syn match rustFloat display "\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\=\%([eE][+-]\=[0-9_]\+\)\(f32\|f64\)\="
|
||||
syn match rustFloat display "\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\=\%([eE][+-]\=[0-9_]\+\)\=\(f32\|f64\)"
|
||||
|
||||
" For the benefit of delimitMate
|
||||
syn region rustLifetimeCandidate display start=/&'\%(\([^'\\]\|\\\(['nrt0\\\"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'\)\@!/ end=/[[:cntrl:][:space:][:punct:]]\@=\|$/ contains=rustSigil,rustLifetime
|
||||
@@ -183,12 +177,24 @@ syn region rustGenericLifetimeCandidate display start=/\%(<\|,\s*\)\@<='/ end=/[
|
||||
|
||||
"rustLifetime must appear before rustCharacter, or chars will get the lifetime highlighting
|
||||
syn match rustLifetime display "\'\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*"
|
||||
syn match rustCharacter /'\([^'\\]\|\\\([nrt0\\'"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'/ contains=rustSpecial
|
||||
syn match rustCharacter /'\([^'\\]\|\\\(.\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'/ contains=rustSpecial,rustSpecialError
|
||||
|
||||
syn region rustCommentML start="/\*" end="\*/" contains=rustTodo
|
||||
syn region rustComment start="//" end="$" contains=rustTodo keepend
|
||||
syn region rustCommentMLDoc start="/\*\%(!\|\*/\@!\)" end="\*/" contains=rustTodo
|
||||
syn region rustCommentDoc start="//[/!]" end="$" contains=rustTodo keepend
|
||||
syn cluster rustComment contains=rustCommentLine,rustCommentLineDoc,rustCommentBlock,rustCommentBlockDoc
|
||||
syn region rustCommentLine start="//" end="$" contains=rustTodo
|
||||
syn region rustCommentLineDoc start="//\%(//\@!\|!\)" end="$" contains=rustTodo
|
||||
syn region rustCommentBlock matchgroup=rustCommentBlock start="/\*\%(!\|\*[*/]\@!\)\@!" end="\*/" contains=rustTodo,@rustComment keepend extend
|
||||
syn region rustCommentBlockDoc matchgroup=rustCommentBlockDoc start="/\*\%(!\|\*[*/]\@!\)" end="\*/" contains=rustTodo,@rustComment keepend extend
|
||||
" FIXME: this is a really ugly and not fully correct implementation. Most
|
||||
" importantly, a case like ``/* */*`` should have the final ``*`` not being in
|
||||
" a comment, but in practice at present it leaves comments open two levels
|
||||
" deep. But as long as you stay away from that particular case, I *believe*
|
||||
" the highlighting is correct. Due to the way Vim's syntax engine works
|
||||
" (greedy for start matches, unlike Rust's tokeniser which is searching for
|
||||
" the earliest-starting match, start or end), I believe this cannot be solved.
|
||||
" Oh you who would fix it, don't bother with things like duplicating the Block
|
||||
" rules and putting ``\*\@<!`` at the start of them; it makes it worse, as
|
||||
" then you must deal with cases like ``/*/**/*/``. And don't try making it
|
||||
" worse with ``\%(/\@<!\*\)\@<!``, either...
|
||||
|
||||
syn keyword rustTodo contained TODO FIXME XXX NB NOTE
|
||||
|
||||
@@ -200,6 +206,7 @@ syn region rustFoldBraces start="{" end="}" transparent fold
|
||||
" It's not enabled by default as it would drive some people mad.
|
||||
|
||||
" Default highlighting {{{1
|
||||
hi def link rustDecNumber rustNumber
|
||||
hi def link rustHexNumber rustNumber
|
||||
hi def link rustOctNumber rustNumber
|
||||
hi def link rustBinNumber rustNumber
|
||||
@@ -207,8 +214,8 @@ hi def link rustIdentifierPrime rustIdentifier
|
||||
hi def link rustTrait rustType
|
||||
|
||||
hi def link rustSigil StorageClass
|
||||
hi def link rustFormat Special
|
||||
hi def link rustSpecial Special
|
||||
hi def link rustSpecialError Error
|
||||
hi def link rustStringContinuation Special
|
||||
hi def link rustString String
|
||||
hi def link rustCharacter Character
|
||||
@@ -221,6 +228,7 @@ hi def link rustSelf Constant
|
||||
hi def link rustFloat Float
|
||||
hi def link rustOperator Operator
|
||||
hi def link rustKeyword Keyword
|
||||
hi def link rustReservedKeyword Error
|
||||
hi def link rustConditional Conditional
|
||||
hi def link rustIdentifier Identifier
|
||||
hi def link rustCapsIdent rustIdentifier
|
||||
@@ -229,10 +237,10 @@ hi def link rustModPathSep Delimiter
|
||||
hi def link rustFunction Function
|
||||
hi def link rustFuncName Function
|
||||
hi def link rustFuncCall Function
|
||||
hi def link rustCommentMLDoc rustCommentDoc
|
||||
hi def link rustCommentDoc SpecialComment
|
||||
hi def link rustCommentML rustComment
|
||||
hi def link rustComment Comment
|
||||
hi def link rustCommentLine Comment
|
||||
hi def link rustCommentLineDoc SpecialComment
|
||||
hi def link rustCommentBlock rustCommentLine
|
||||
hi def link rustCommentBlockDoc rustCommentLineDoc
|
||||
hi def link rustAssert PreCondit
|
||||
hi def link rustFail PreCondit
|
||||
hi def link rustMacro Macro
|
||||
@@ -241,6 +249,7 @@ hi def link rustTodo Todo
|
||||
hi def link rustAttribute PreProc
|
||||
hi def link rustDeriving PreProc
|
||||
hi def link rustStorage StorageClass
|
||||
hi def link rustObsoleteStorage Error
|
||||
hi def link rustLifetime Special
|
||||
|
||||
" Other Suggestions:
|
||||
|
||||
280
syntax/scala.vim
280
syntax/scala.vim
@@ -1,192 +1,104 @@
|
||||
" Vim syntax file
|
||||
" Language : Scala (http://scala-lang.org/)
|
||||
" Maintainers: Stefan Matthias Aust, Julien Wetterwald
|
||||
" Last Change: 2007 June 13
|
||||
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
syn case match
|
||||
syn sync minlines=50 maxlines=100
|
||||
|
||||
" most Scala keywords
|
||||
syn keyword scalaKeyword case
|
||||
syn keyword scalaKeyword catch
|
||||
syn keyword scalaKeyword do
|
||||
syn keyword scalaKeyword else
|
||||
syn keyword scalaKeyword extends
|
||||
syn keyword scalaKeyword final
|
||||
syn keyword scalaKeyword finally
|
||||
syn keyword scalaKeyword for
|
||||
syn keyword scalaKeyword forSome
|
||||
syn keyword scalaKeyword if
|
||||
syn keyword scalaKeyword match
|
||||
syn keyword scalaKeyword new
|
||||
syn keyword scalaKeyword null
|
||||
syn keyword scalaKeyword require
|
||||
syn keyword scalaKeyword return
|
||||
syn keyword scalaKeyword super
|
||||
syn keyword scalaKeyword this
|
||||
syn keyword scalaKeyword throw
|
||||
syn keyword scalaKeyword try
|
||||
syn keyword scalaKeyword type
|
||||
syn keyword scalaKeyword while
|
||||
syn keyword scalaKeyword with
|
||||
syn keyword scalaKeyword yield
|
||||
syn keyword scalaKeywordModifier abstract
|
||||
syn keyword scalaKeywordModifier override
|
||||
syn keyword scalaKeywordModifier final
|
||||
syn keyword scalaKeywordModifier implicit
|
||||
syn keyword scalaKeywordModifier lazy
|
||||
syn keyword scalaKeywordModifier private
|
||||
syn keyword scalaKeywordModifier protected
|
||||
syn keyword scalaKeywordModifier sealed
|
||||
syn match scalaKeyword "=>"
|
||||
syn match scalaKeyword "<-"
|
||||
syn match scalaKeyword "\<_\>"
|
||||
|
||||
syn match scalaOperator ":\{2,\}" "this is not a type
|
||||
|
||||
" package and import statements
|
||||
syn keyword scalaPackage package nextgroup=scalaFqn skipwhite
|
||||
syn keyword scalaImport import nextgroup=scalaFqn skipwhite
|
||||
syn match scalaFqn "\<[._$a-zA-Z0-9,]*" contained nextgroup=scalaFqnSet
|
||||
syn region scalaFqnSet start="{" end="}" contained
|
||||
|
||||
" boolean literals
|
||||
syn keyword scalaBoolean true false
|
||||
|
||||
" definitions
|
||||
syn keyword scalaDef def nextgroup=scalaDefName skipwhite
|
||||
syn keyword scalaVal val nextgroup=scalaValName skipwhite
|
||||
syn keyword scalaVar var nextgroup=scalaVarName skipwhite
|
||||
syn keyword scalaClass class nextgroup=scalaClassName skipwhite
|
||||
syn keyword scalaObject object nextgroup=scalaClassName skipwhite
|
||||
syn keyword scalaTrait trait nextgroup=scalaClassName skipwhite
|
||||
syn match scalaDefName "[^ =:;([]\+" contained nextgroup=scalaDefSpecializer skipwhite
|
||||
syn match scalaValName "[^ =:;([]\+" contained
|
||||
syn match scalaVarName "[^ =:;([]\+" contained
|
||||
syn match scalaClassName "[^ =:;(\[]\+" contained nextgroup=scalaClassSpecializer skipwhite
|
||||
syn region scalaDefSpecializer start="\[" end="\]" contained contains=scalaDefSpecializer
|
||||
syn region scalaClassSpecializer start="\[" end="\]" contained contains=scalaClassSpecializer
|
||||
syn match scalaBackTick "`[^`]\+`"
|
||||
|
||||
" type constructor (actually anything with an uppercase letter)
|
||||
syn match scalaConstructor "\<[A-Z][_$a-zA-Z0-9]*\>" nextgroup=scalaConstructorSpecializer
|
||||
syn region scalaConstructorSpecializer start="\[" end="\]" contained contains=scalaConstructorSpecializer
|
||||
|
||||
" method call
|
||||
syn match scalaRoot "\<[a-zA-Z][_$a-zA-Z0-9]*\."me=e-1
|
||||
syn match scalaMethodCall "\.[a-z][_$a-zA-Z0-9]*"ms=s+1
|
||||
|
||||
" type declarations in val/var/def
|
||||
syn match scalaType ":\s*\%(=>\s*\)\?\%([\._$a-zA-Z0-9]\+\|([^)]\{-1,})\)\%(\[[^\]]\{-1,}\]\+\%([^)]*)\]\+\)\?\)\?\%(\s*\%(<:\|>:\|#\|=>\|⇒\)\s*\%([\._$a-zA-Z0-9]\+\|([^)]\{-1,})\)\%(\[[^\]]\{-1,}\]\+\%([^)]*)\]\+\)\?\)*\)*"ms=s+1
|
||||
" type declarations in case statements
|
||||
syn match scalaCaseType "\(case\s\+[_a-zA-Z0-9]\+\)\@<=:\s*[\._$a-zA-Z0-9]\+\(\[[^:]\{-1,}\]\+\)\?"ms=s+1
|
||||
|
||||
" comments
|
||||
syn match scalaTodo "[tT][oO][dD][oO]" contained
|
||||
syn match scalaLineComment "//.*" contains=scalaTodo
|
||||
syn region scalaComment start="/\*" end="\*/" contains=scalaTodo
|
||||
syn case ignore
|
||||
syn include @scalaHtml syntax/html.vim
|
||||
syn case match
|
||||
syn region scalaDocComment start="/\*\*" end="\*/" contains=scalaDocTags,scalaTodo,@scalaHtml keepend
|
||||
syn region scalaDocTags start="{@\(link\|linkplain\|inherit[Dd]oc\|doc[rR]oot\|value\)" end="}" contained
|
||||
syn match scalaDocTags "@[a-z]\+" contained
|
||||
|
||||
" annotations
|
||||
syn match scalaAnnotation "@[a-zA-Z]\+"
|
||||
|
||||
syn match scalaEmptyString "\"\""
|
||||
|
||||
" multi-line string literals
|
||||
syn region scalaMultiLineString start="\"\"\"" end="\"\"\"\"\@!" contains=scalaUnicode
|
||||
syn match scalaUnicode "\\u[0-9a-fA-F]\{4}" contained
|
||||
|
||||
" string literals with escapes
|
||||
syn region scalaString start="\"[^"]" skip="\\\"" end="\"" contains=scalaStringEscape " TODO end \n or not?
|
||||
syn match scalaStringEscape "\\u[0-9a-fA-F]\{4}" contained
|
||||
syn match scalaStringEscape "\\[nrfvb\\\"]" contained
|
||||
|
||||
" symbol and character literals
|
||||
syn match scalaSymbol "'[_a-zA-Z0-9][_a-zA-Z0-9]*\>"
|
||||
syn match scalaChar "'[^'\\]'\|'\\.'\|'\\u[0-9a-fA-F]\{4}'"
|
||||
|
||||
" number literals
|
||||
syn match scalaNumber "\<\(0[0-7]*\|0[xX]\x\+\|\d\+\)[lL]\=\>"
|
||||
syn match scalaNumber "\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[fFdD]\="
|
||||
syn match scalaNumber "\<\d\+[eE][-+]\=\d\+[fFdD]\=\>"
|
||||
syn match scalaNumber "\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>"
|
||||
|
||||
" xml literals
|
||||
syn match scalaXmlTag "<[a-zA-Z]\_[^>]*/>" contains=scalaXmlQuote,scalaXmlEscape,scalaXmlString
|
||||
syn region scalaXmlString start="\"" end="\"" contained
|
||||
syn match scalaXmlStart "<[a-zA-Z]\_[^>]*>" contained contains=scalaXmlQuote,scalaXmlEscape,scalaXmlString
|
||||
syn region scalaXml start="<\([a-zA-Z]\_[^>]*\_[^/]\|[a-zA-Z]\)>" matchgroup=scalaXmlStart end="</\_[^>]\+>" contains=scalaXmlEscape,scalaXmlQuote,scalaXml,scalaXmlStart,scalaXmlComment
|
||||
syn region scalaXmlEscape matchgroup=scalaXmlEscapeSpecial start="{" matchgroup=scalaXmlEscapeSpecial end="}" contained contains=TOP
|
||||
syn match scalaXmlQuote "&[^;]\+;" contained
|
||||
syn match scalaXmlComment "<!--\_[^>]*-->" contained
|
||||
|
||||
" REPL
|
||||
syn match scalaREPLCmdLine "\<scala>\>"
|
||||
|
||||
" map Scala groups to standard groups
|
||||
hi link scalaKeyword Keyword
|
||||
hi link scalaKeywordModifier Function
|
||||
hi link scalaAnnotation Include
|
||||
hi link scalaPackage Include
|
||||
hi link scalaImport Include
|
||||
hi link scalaREPLCmdLine Include
|
||||
hi link scalaDocTags Include
|
||||
hi link scalaBackTick Include
|
||||
hi link scalaBoolean Boolean
|
||||
hi link scalaOperator Normal
|
||||
hi link scalaNumber Number
|
||||
hi link scalaEmptyString String
|
||||
hi link scalaString String
|
||||
hi link scalaChar String
|
||||
hi link scalaMultiLineString String
|
||||
hi link scalaStringEscape Special
|
||||
hi link scalaSymbol Special
|
||||
hi link scalaUnicode Special
|
||||
hi link scalaComment Comment
|
||||
hi link scalaLineComment Comment
|
||||
hi link scalaDocComment Comment
|
||||
hi link scalaTodo Todo
|
||||
hi link scalaType Type
|
||||
hi link scalaCaseType Type
|
||||
hi link scalaTypeSpecializer scalaType
|
||||
hi link scalaXml String
|
||||
hi link scalaXmlTag Include
|
||||
hi link scalaXmlString String
|
||||
hi link scalaXmlStart Include
|
||||
hi link scalaXmlEscape Normal
|
||||
hi link scalaXmlEscapeSpecial Special
|
||||
hi link scalaXmlQuote Special
|
||||
hi link scalaXmlComment Comment
|
||||
hi link scalaDef Keyword
|
||||
hi link scalaVar Keyword
|
||||
hi link scalaVal Keyword
|
||||
hi link scalaClass Keyword
|
||||
hi link scalaObject Keyword
|
||||
hi link scalaTrait Keyword
|
||||
hi link scalaDefName Function
|
||||
hi link scalaDefSpecializer Function
|
||||
hi link scalaClassName Special
|
||||
hi link scalaClassSpecializer Special
|
||||
hi link scalaConstructor Special
|
||||
hi link scalaConstructorSpecializer scalaConstructor
|
||||
|
||||
let b:current_syntax = "scala"
|
||||
|
||||
" you might like to put these lines in your .vimrc
|
||||
"
|
||||
" customize colors a little bit (should be a different file)
|
||||
" hi scalaNew gui=underline
|
||||
" hi scalaMethodCall gui=italic
|
||||
" hi scalaValName gui=underline
|
||||
" hi scalaVarName gui=underline
|
||||
syn case match
|
||||
syn sync minlines=200 maxlines=1000
|
||||
|
||||
syn keyword scalaKeyword catch do else final finally for forSome if
|
||||
syn keyword scalaKeyword match return throw try while yield
|
||||
syn keyword scalaKeyword class trait object extends with type nextgroup=scalaInstanceDeclaration skipwhite
|
||||
syn keyword scalaKeyword case nextgroup=scalaCaseFollowing skipwhite
|
||||
syn keyword scalaKeyword val nextgroup=scalaNameDefinition,scalaQuasiQuotes skipwhite
|
||||
syn keyword scalaKeyword def var nextgroup=scalaNameDefinition skipwhite
|
||||
hi link scalaKeyword Keyword
|
||||
|
||||
syn match scalaNameDefinition /\<[_A-Za-z0-9$]\+\>/ contained
|
||||
syn match scalaNameDefinition /`[^`]\+`/ contained
|
||||
hi link scalaNameDefinition Function
|
||||
|
||||
syn match scalaInstanceDeclaration /\<[_\.A-Za-z0-9$]\+\>/ contained
|
||||
syn match scalaInstanceDeclaration /`[^`]\+`/ contained
|
||||
hi link scalaInstanceDeclaration Special
|
||||
|
||||
syn match scalaCaseFollowing /\<[_\.A-Za-z0-9$]*\>/ contained
|
||||
syn match scalaCaseFollowing /`[^`]\+`/ contained
|
||||
hi link scalaCaseFollowing Special
|
||||
|
||||
syn keyword scalaKeywordModifier abstract override final implicit lazy private protected sealed null require super
|
||||
hi link scalaKeywordModifier Function
|
||||
|
||||
syn keyword scalaSpecial this true false package import
|
||||
syn keyword scalaSpecial new nextgroup=scalaInstanceDeclaration skipwhite
|
||||
syn match scalaSpecial "\%(=>\|⇒\|<-\|←\|->\|→\)"
|
||||
syn match scalaSpecial /`[^`]*`/ " Backtick literals
|
||||
hi link scalaSpecial PreProc
|
||||
|
||||
syn region scalaString start=/"/ skip=/\\"/ end=/"/
|
||||
hi link scalaString String
|
||||
|
||||
syn region scalaSString matchgroup=Special start=/s"/ skip=/\\"/ end=/"/ contains=scalaInterpolation
|
||||
syn match scalaInterpolation /\$[a-zA-Z0-9_$]\+/ contained
|
||||
syn match scalaInterpolation /\${[^}]\+}/ contained
|
||||
hi link scalaSString String
|
||||
hi link scalaInterpolation Function
|
||||
|
||||
syn region scalaFString matchgroup=Special start=/f"/ skip=/\\"/ end=/"/ contains=scalaInterpolation,scalaFInterpolation
|
||||
syn match scalaFInterpolation /\$[a-zA-Z0-9_$]\+%[-A-Za-z0-9\.]\+/ contained
|
||||
syn match scalaFInterpolation /\${[^}]\+}%[-A-Za-z0-9\.]\+/ contained
|
||||
hi link scalaFString String
|
||||
hi link scalaFInterpolation Function
|
||||
|
||||
syn region scalaQuasiQuotes matchgroup=Type start=/\<q"/ skip=/\\"/ end=/"/ contains=scalaInterpolation
|
||||
syn region scalaQuasiQuotes matchgroup=Type start=/\<[tcp]q"/ skip=/\\"/ end=/"/ contains=scalaInterpolation
|
||||
hi link scalaQuasiQuotes String
|
||||
|
||||
syn region scalaTripleQuasiQuotes matchgroup=Type start=/\<q"""/ end=/"""/ contains=scalaInterpolation
|
||||
syn region scalaTripleQuasiQuotes matchgroup=Type start=/\<[tcp]q"""/ end=/"""/ contains=scalaInterpolation
|
||||
hi link scalaTripleQuasiQuotes String
|
||||
|
||||
syn region scalaTripleString start=/"""/ end=/"""/
|
||||
syn region scalaTripleSString matchgroup=PreProc start=/s"""/ end=/"""/
|
||||
syn region scalaTripleFString matchgroup=PreProc start=/f"""/ end=/"""/
|
||||
hi link scalaTripleString String
|
||||
hi link scalaTripleSString String
|
||||
hi link scalaTripleFString String
|
||||
|
||||
syn match scalaNumber /\<0[dDfFlL]\?\>/
|
||||
syn match scalaNumber /\<[1-9]\d*[dDfFlL]\?\>/
|
||||
syn match scalaNumber /\<0[xX][0-9a-fA-F]\+[dDfFlL]\?\>/
|
||||
syn match scalaNumber "\%(\<\d\+\.\d*\|\.\d\+\)\%([eE][-+]\=\d\+\)\=[fFdD]\="
|
||||
syn match scalaNumber "\<\d\+[eE][-+]\=\d\+[fFdD]\=\>"
|
||||
syn match scalaNumber "\<\d\+\%([eE][-+]\=\d\+\)\=[fFdD]\>"
|
||||
hi link scalaNumber Number
|
||||
|
||||
syn region scalaSquareBrackets matchgroup=Type start="\[" end="\]" contains=scalaSpecial,scalaTypeParameter,scalaSquareBrackets,scalaTypeOperator
|
||||
syn match scalaTypeAnnotation /\%(:\s*\)\@<=[_\.A-Za-z0-9$]\+/
|
||||
syn match scalaTypeParameter /[_\.A-Za-z0-9$]\+/ contained
|
||||
syn match scalaTypeOperator /[=:<>]\+/ contained
|
||||
hi link scalaTypeAnnotation Type
|
||||
hi link scalaTypeParameter Type
|
||||
hi link scalaTypeOperator Type
|
||||
|
||||
syn region scalaMultilineComment start="/\*" end="\*/" contains=scalaMultilineComment,scalaDocLinks,scalaParameterAnnotation,scalaCommentAnnotation,scalaCommentCodeBlock,@scalaHtml 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
|
||||
syn region scalaDocLinks start="\[\[" end="\]\]" contained
|
||||
syn region scalaCommentCodeBlock matchgroup=Keyword start="{{{" end="}}}" contained
|
||||
hi link scalaMultilineComment Comment
|
||||
hi link scalaDocLinks Function
|
||||
hi link scalaParameterAnnotation Function
|
||||
hi link scalaParamAnnotationValue Keyword
|
||||
hi link scalaCommentAnnotation Function
|
||||
hi link scalaCommentCodeBlock String
|
||||
|
||||
syn match scalaAnnotation /@\<[`_A-Za-z0-9$]\+\>/
|
||||
hi link scalaAnnotation PreProc
|
||||
|
||||
syn match scalaTrailingComment "//.*$"
|
||||
hi link scalaTrailingComment Comment
|
||||
|
||||
Reference in New Issue
Block a user