From 23913e0598d23ec5948b71ea78c549b39cecf764 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Sun, 8 Mar 2015 21:32:50 -0700 Subject: Update --- after/syntax/css.vim | 2 +- after/syntax/less.vim | 2 +- after/syntax/lua.vim | 6 + after/syntax/moon.vim | 6 + after/syntax/sass.vim | 2 +- after/syntax/scss.vim | 2 +- after/syntax/stylus.vim | 2 +- after/syntax/vim.vim | 2 +- autoload/css_color.vim | 79 +- autoload/xml/html5.vim | 12 +- ftdetect/polyglot.vim | 4 +- ftplugin/latex-box/motion.vim | 4 +- ftplugin/perl6.vim | 2 +- ftplugin/ruby.vim | 2 +- indent/go.vim | 80 +- indent/html.vim | 2 + indent/ruby.vim | 15 +- indent/tex.vim | 4 +- syntax/c.vim | 70 +- syntax/cpp.vim | 15 +- syntax/html.vim | 6 +- syntax/jade.vim | 2 +- syntax/perl6.vim | 1778 +++++++++++++++++------------------------ syntax/scala.vim | 31 +- 24 files changed, 962 insertions(+), 1168 deletions(-) create mode 100644 after/syntax/lua.vim create mode 100644 after/syntax/moon.vim diff --git a/after/syntax/css.vim b/after/syntax/css.vim index 1f693c9d..ffb3e43d 100644 --- a/after/syntax/css.vim +++ b/after/syntax/css.vim @@ -3,4 +3,4 @@ if !( has('gui_running') || &t_Co==256 ) | finish | endif -call css_color#init('css', 'cssMediaBlock,cssFunction,cssDefinition,cssAttrRegion,cssComment') +call css_color#init('css', 'extended', 'cssMediaBlock,cssFunction,cssDefinition,cssAttrRegion,cssComment') diff --git a/after/syntax/less.vim b/after/syntax/less.vim index e3efbff4..e6381a76 100644 --- a/after/syntax/less.vim +++ b/after/syntax/less.vim @@ -10,4 +10,4 @@ if !( has('gui_running') || &t_Co==256 ) | finish | endif " lessVariableValue | lessDefinition | cssComment | lessComment | https://github.com/groenewege/vim-less " lessVariableDefinition | cssDefinition | cssComment | lessComment | https://github.com/lunaru/vim-less -call css_color#init('css', 'lessVariableValue,lessVariableDefinition,lessDefinition,lessCssAttribute,lessAttribute,cssDefinition,cssComment,lessCssComment,lessComment') +call css_color#init('css', 'extended', 'lessVariableValue,lessVariableDefinition,lessDefinition,lessCssAttribute,lessAttribute,cssDefinition,cssComment,lessCssComment,lessComment') diff --git a/after/syntax/lua.vim b/after/syntax/lua.vim new file mode 100644 index 00000000..481c996c --- /dev/null +++ b/after/syntax/lua.vim @@ -0,0 +1,6 @@ +" Language: Colorful CSS Color Preview +" Author: Aristotle Pagaltzis + +if !( has('gui_running') || &t_Co==256 ) | finish | endif + +call css_color#init('hex', 'extended', 'luaComment,luaString') diff --git a/after/syntax/moon.vim b/after/syntax/moon.vim new file mode 100644 index 00000000..c200e64b --- /dev/null +++ b/after/syntax/moon.vim @@ -0,0 +1,6 @@ +" Language: Colorful CSS Color Preview +" Author: Aristotle Pagaltzis + +if !( has('gui_running') || &t_Co==256 ) | finish | endif + +call css_color#init('hex', 'extended', 'moonComment,moonString') diff --git a/after/syntax/sass.vim b/after/syntax/sass.vim index 7a2942f9..ce73d75a 100644 --- a/after/syntax/sass.vim +++ b/after/syntax/sass.vim @@ -3,4 +3,4 @@ if !( has('gui_running') || &t_Co==256 ) | finish | endif -call css_color#init('css', 'sassCssAttribute,sassComment,sassCssComment') +call css_color#init('css', 'extended', 'sassCssAttribute,sassComment,sassCssComment') diff --git a/after/syntax/scss.vim b/after/syntax/scss.vim index 30be7b40..15fcac7e 100644 --- a/after/syntax/scss.vim +++ b/after/syntax/scss.vim @@ -3,4 +3,4 @@ if !( has('gui_running') || &t_Co==256 ) | finish | endif -call css_color#init('css', 'scssAttribute,scssComment,scssVariableValue,sassCssAttribute,cssComment') +call css_color#init('css', 'extended', 'scssAttribute,scssComment,scssVariableValue,sassCssAttribute,cssComment') diff --git a/after/syntax/stylus.vim b/after/syntax/stylus.vim index 2c50a988..eadc95ff 100644 --- a/after/syntax/stylus.vim +++ b/after/syntax/stylus.vim @@ -3,4 +3,4 @@ if !( has('gui_running') || &t_Co==256 ) | finish | endif -call css_color#init('css', 'stylusCssAttribute,stylusComment,cssComment') +call css_color#init('css', 'extended', 'stylusCssAttribute,stylusComment,cssComment') diff --git a/after/syntax/vim.vim b/after/syntax/vim.vim index 4fdaee2e..53023d45 100644 --- a/after/syntax/vim.vim +++ b/after/syntax/vim.vim @@ -3,4 +3,4 @@ if !( has('gui_running') || &t_Co==256 ) | finish | endif -call css_color#init('any', 'vimHiGuiRgb,vimComment,vimLineComment') +call css_color#init('hex', 'none', 'vimHiGuiRgb,vimComment,vimLineComment') diff --git a/autoload/css_color.vim b/autoload/css_color.vim index e94a69cd..1b5dadf6 100644 --- a/autoload/css_color.vim +++ b/autoload/css_color.vim @@ -250,7 +250,7 @@ function! s:parse_css_screen() call s:clear_matches() call s:create_matches() endfunction -function! s:parse_any_screen() +function! s:parse_hex_screen() call substitute( join( getline('w0','w$'), "\n" ), s:_hexcolor, '\=s:create_syn_match()', 'g' ) call s:clear_matches() call s:create_matches() @@ -258,7 +258,7 @@ endfunction """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -function! css_color#init(type, groups) +function! css_color#init(type, keywords, groups) exe 'syn cluster colorableGroup contains=' . a:groups let b:has_color_hi = {} @@ -273,23 +273,58 @@ function! css_color#init(type, groups) exe 'call s:parse_'.a:type.'_screen()' - if a:type != 'css' | return | endif + if a:keywords == 'none' | return | endif + + syn case ignore + + " W3C basic colors hi BG000000 guibg=#000000 guifg=#FFFFFF ctermbg=16 ctermfg=231 + hi BGc0c0c0 guibg=#C0C0C0 guifg=#000000 ctermbg=250 ctermfg=16 + hi BG808080 guibg=#808080 guifg=#000000 ctermbg=244 ctermfg=16 + hi BGffffff guibg=#FFFFFF guifg=#000000 ctermbg=231 ctermfg=16 + hi BG800000 guibg=#800000 guifg=#FFFFFF ctermbg=88 ctermfg=231 + hi BGff0000 guibg=#FF0000 guifg=#FFFFFF ctermbg=196 ctermfg=231 + hi BG800080 guibg=#800080 guifg=#FFFFFF ctermbg=240 ctermfg=231 + hi BGff00ff guibg=#FF00FF guifg=#FFFFFF ctermbg=13 ctermfg=231 + hi BG008000 guibg=#008000 guifg=#FFFFFF ctermbg=2 ctermfg=231 + hi BG00ff00 guibg=#00FF00 guifg=#000000 ctermbg=10 ctermfg=16 + hi BG808000 guibg=#808000 guifg=#FFFFFF ctermbg=240 ctermfg=231 + hi BGffff00 guibg=#FFFF00 guifg=#000000 ctermbg=11 ctermfg=16 hi BG000080 guibg=#000080 guifg=#FFFFFF ctermbg=235 ctermfg=231 + hi BG0000ff guibg=#0000FF guifg=#FFFFFF ctermbg=4 ctermfg=231 + hi BG008080 guibg=#008080 guifg=#FFFFFF ctermbg=30 ctermfg=231 + hi BG00ffff guibg=#00FFFF guifg=#000000 ctermbg=51 ctermfg=16 + + syn keyword BG000000 black contained containedin=@colorableGroup + syn keyword BGc0c0c0 silver contained containedin=@colorableGroup + syn keyword BG808080 gray contained containedin=@colorableGroup + syn match BGffffff "\c\" contained containedin=@colorableGroup + syn keyword BG800000 maroon contained containedin=@colorableGroup + syn keyword BGff0000 red contained containedin=@colorableGroup + syn keyword BG800080 purple contained containedin=@colorableGroup + syn keyword BGff00ff fuchsia contained containedin=@colorableGroup + syn keyword BG008000 green contained containedin=@colorableGroup + syn keyword BG00ff00 lime contained containedin=@colorableGroup + syn keyword BG808000 olive contained containedin=@colorableGroup + syn keyword BGffff00 yellow contained containedin=@colorableGroup + syn keyword BG000080 navy contained containedin=@colorableGroup + syn keyword BG0000ff blue contained containedin=@colorableGroup + syn keyword BG008080 teal contained containedin=@colorableGroup + syn keyword BG00ffff aqua contained containedin=@colorableGroup + + if a:keywords == 'basic' | return | endif + + " W3C extended colors + hi BG00008b guibg=#00008B guifg=#FFFFFF ctermbg=4 ctermfg=231 hi BG0000cd guibg=#0000CD guifg=#FFFFFF ctermbg=4 ctermfg=231 - hi BG0000ff guibg=#0000FF guifg=#FFFFFF ctermbg=4 ctermfg=231 hi BG006400 guibg=#006400 guifg=#FFFFFF ctermbg=235 ctermfg=231 - hi BG008000 guibg=#008000 guifg=#FFFFFF ctermbg=2 ctermfg=231 - hi BG008080 guibg=#008080 guifg=#FFFFFF ctermbg=30 ctermfg=231 hi BG008b8b guibg=#008B8B guifg=#FFFFFF ctermbg=30 ctermfg=231 hi BG00bfff guibg=#00BFFF guifg=#000000 ctermbg=6 ctermfg=16 hi BG00ced1 guibg=#00CED1 guifg=#000000 ctermbg=6 ctermfg=16 hi BG00fa9a guibg=#00FA9A guifg=#000000 ctermbg=6 ctermfg=16 - hi BG00ff00 guibg=#00FF00 guifg=#000000 ctermbg=10 ctermfg=16 hi BG00ff7f guibg=#00FF7F guifg=#000000 ctermbg=6 ctermfg=16 - hi BG00ffff guibg=#00FFFF guifg=#000000 ctermbg=51 ctermfg=16 hi BG191970 guibg=#191970 guifg=#FFFFFF ctermbg=237 ctermfg=231 hi BG1e90ff guibg=#1E90FF guifg=#000000 ctermbg=12 ctermfg=16 hi BG20b2aa guibg=#20B2AA guifg=#000000 ctermbg=37 ctermfg=16 @@ -317,10 +352,6 @@ function! css_color#init(type, groups) hi BG7cfc00 guibg=#7CFC00 guifg=#000000 ctermbg=3 ctermfg=16 hi BG7fff00 guibg=#7FFF00 guifg=#000000 ctermbg=3 ctermfg=16 hi BG7fffd4 guibg=#7FFFD4 guifg=#000000 ctermbg=122 ctermfg=16 - hi BG800000 guibg=#800000 guifg=#FFFFFF ctermbg=88 ctermfg=231 - hi BG800080 guibg=#800080 guifg=#FFFFFF ctermbg=240 ctermfg=231 - hi BG808000 guibg=#808000 guifg=#FFFFFF ctermbg=240 ctermfg=231 - hi BG808080 guibg=#808080 guifg=#000000 ctermbg=244 ctermfg=16 hi BG87ceeb guibg=#87CEEB guifg=#000000 ctermbg=117 ctermfg=16 hi BG87cefa guibg=#87CEFA guifg=#000000 ctermbg=117 ctermfg=16 hi BG8a2be2 guibg=#8A2BE2 guifg=#FFFFFF ctermbg=12 ctermfg=231 @@ -347,7 +378,6 @@ function! css_color#init(type, groups) hi BGba55d3 guibg=#BA55D3 guifg=#000000 ctermbg=5 ctermfg=16 hi BGbc8f8f guibg=#BC8F8F guifg=#000000 ctermbg=138 ctermfg=16 hi BGbdb76b guibg=#BDB76B guifg=#000000 ctermbg=247 ctermfg=16 - hi BGc0c0c0 guibg=#C0C0C0 guifg=#000000 ctermbg=250 ctermfg=16 hi BGc71585 guibg=#C71585 guifg=#FFFFFF ctermbg=5 ctermfg=231 hi BGcd5c5c guibg=#CD5C5C guifg=#000000 ctermbg=167 ctermfg=16 hi BGcd853f guibg=#CD853F guifg=#000000 ctermbg=173 ctermfg=16 @@ -383,8 +413,6 @@ function! css_color#init(type, groups) hi BGfaf0e6 guibg=#FAF0E6 guifg=#000000 ctermbg=255 ctermfg=16 hi BGfafad2 guibg=#FAFAD2 guifg=#000000 ctermbg=255 ctermfg=16 hi BGfdf5e6 guibg=#FDF5E6 guifg=#000000 ctermbg=255 ctermfg=16 - hi BGff0000 guibg=#FF0000 guifg=#FFFFFF ctermbg=196 ctermfg=231 - hi BGff00ff guibg=#FF00FF guifg=#FFFFFF ctermbg=13 ctermfg=231 hi BGff1493 guibg=#FF1493 guifg=#FFFFFF ctermbg=5 ctermfg=231 hi BGff4500 guibg=#FF4500 guifg=#FFFFFF ctermbg=9 ctermfg=231 hi BGff6347 guibg=#FF6347 guifg=#000000 ctermbg=203 ctermfg=16 @@ -409,30 +437,9 @@ function! css_color#init(type, groups) hi BGfffacd guibg=#FFFACD guifg=#000000 ctermbg=255 ctermfg=16 hi BGfffaf0 guibg=#FFFAF0 guifg=#000000 ctermbg=15 ctermfg=16 hi BGfffafa guibg=#FFFAFA guifg=#000000 ctermbg=15 ctermfg=16 - hi BGffff00 guibg=#FFFF00 guifg=#000000 ctermbg=11 ctermfg=16 hi BGffffe0 guibg=#FFFFE0 guifg=#000000 ctermbg=255 ctermfg=16 hi BGfffff0 guibg=#FFFFF0 guifg=#000000 ctermbg=15 ctermfg=16 - hi BGffffff guibg=#FFFFFF guifg=#000000 ctermbg=231 ctermfg=16 - - " W3C Colors - syn keyword BG000000 black contained containedin=@colorableGroup - syn keyword BGc0c0c0 silver contained containedin=@colorableGroup - syn keyword BG808080 gray contained containedin=@colorableGroup - syn match BGffffff "\" contained containedin=@colorableGroup - syn keyword BG800000 maroon contained containedin=@colorableGroup - syn keyword BGff0000 red contained containedin=@colorableGroup - syn keyword BG800080 purple contained containedin=@colorableGroup - syn keyword BGff00ff fuchsia contained containedin=@colorableGroup - syn keyword BG008000 green contained containedin=@colorableGroup - syn keyword BG00ff00 lime contained containedin=@colorableGroup - syn keyword BG808000 olive contained containedin=@colorableGroup - syn keyword BGffff00 yellow contained containedin=@colorableGroup - syn keyword BG000080 navy contained containedin=@colorableGroup - syn keyword BG0000ff blue contained containedin=@colorableGroup - syn keyword BG008080 teal contained containedin=@colorableGroup - syn keyword BG00ffff aqua contained containedin=@colorableGroup - " extra colors syn keyword BGf0f8ff AliceBlue contained containedin=@colorableGroup syn keyword BGfaebd7 AntiqueWhite contained containedin=@colorableGroup syn keyword BG7fffd4 Aquamarine contained containedin=@colorableGroup diff --git a/autoload/xml/html5.vim b/autoload/xml/html5.vim index 5ec9cd7e..0d9a6a2c 100644 --- a/autoload/xml/html5.vim +++ b/autoload/xml/html5.vim @@ -545,7 +545,7 @@ let g:xmldata_html5 = { \ ], \ 'iframe': [ \ [], - \ extend(copy(global_attributes), {'src': [], 'name': [], 'width': [], 'height': [], 'sandbox': ['allow-same-origin', 'allow-forms', 'allow-scripts'], 'seamless': ['seamless', '']}) + \ extend(copy(global_attributes), {'src': [], 'srcdoc': [], 'name': [], 'width': [], 'height': [], 'sandbox': ['allow-same-origin', 'allow-forms', 'allow-scripts'], 'seamless': ['seamless', '']}) \ ], \ 'img': [ \ [], @@ -659,6 +659,10 @@ let g:xmldata_html5 = { \ phrasing_elements, \ extend(copy(global_attributes), {'cite': []}) \ ], +\ 'rb': [ + \ phrasing_elements, + \ global_attributes +\ ], \ 'rp': [ \ phrasing_elements, \ global_attributes @@ -667,10 +671,14 @@ let g:xmldata_html5 = { \ phrasing_elements, \ global_attributes \ ], -\ 'ruby': [ +\ 'rtc': [ \ phrasing_elements + ['rp', 'rt'], \ global_attributes \ ], +\ 'ruby': [ + \ phrasing_elements + ['rb', 'rp', 'rt', 'rtc'], + \ global_attributes +\ ], \ 'samp': [ \ phrasing_elements, \ global_attributes diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index 388976e6..000b1c9b 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -142,7 +142,7 @@ function! s:DetectPerl6() endwhile endfunction autocmd BufReadPost *.pl,*.pm,*.t call s:DetectPerl6() -autocmd BufNew,BufRead *.nqp setf perl6 +autocmd BufNew,BufNewFile,BufRead *.nqp setf perl6 autocmd BufNewFile,BufRead *.proto setfiletype proto au BufNewFile,BufRead *.ps1 set ft=ps1 au BufNewFile,BufRead *.psd1 set ft=ps1 @@ -180,7 +180,7 @@ au BufNewFile,BufRead Podfile,*.podspec call s:setf('ruby') au BufRead,BufNewFile *.rs set filetype=rust au BufRead,BufNewFile *.sbt set filetype=sbt.scala fun! s:DetectScala() - if getline(1) == '#!/usr/bin/env scala' + if getline(1) =~# '^#!\(/usr\)\?/bin/env\s\+scalas\?' set filetype=scala endif endfun diff --git a/ftplugin/latex-box/motion.vim b/ftplugin/latex-box/motion.vim index 7e5b0011..66b9e4fc 100644 --- a/ftplugin/latex-box/motion.vim +++ b/ftplugin/latex-box/motion.vim @@ -349,7 +349,7 @@ function! s:ReadTOC(auxfile, texfile, ...) if len(tree) > 3 && empty(tree[1]) call remove(tree, 1) endif - if len(tree) > 1 && type(tree[0]) == type("") && tree[0] =~ '^\\\(numberline\|tocsection\)' + if len(tree) > 1 && type(tree[0]) == type("") && tree[0] =~ '^\\\(\(chapter\)\?numberline\|tocsection\)' let secnum = LatexBox_TreeToTex(tree[1]) let secnum = substitute(secnum, '\\\S\+\s', '', 'g') let secnum = substitute(secnum, '\\\S\+{\(.\{-}\)}', '\1', 'g') @@ -359,7 +359,7 @@ function! s:ReadTOC(auxfile, texfile, ...) " parse section title let text = LatexBox_TreeToTex(tree) let text = substitute(text, '^{\+\|}\+$', '', 'g') - let text = substitute(text, '\m^\\\(no\)\?numberline\s*', '', '') + let text = substitute(text, '\m^\\\(no\)\?\(chapter\)\?numberline\s*', '', '') let text = substitute(text, '\*', '', 'g') " add TOC entry diff --git a/ftplugin/perl6.vim b/ftplugin/perl6.vim index ebb39555..9a21122b 100644 --- a/ftplugin/perl6.vim +++ b/ftplugin/perl6.vim @@ -43,7 +43,7 @@ setlocal define=[^A-Za-z_] " after/ftplugin/perl6.vim file that contains " set isfname-=: set isfname+=: -setlocal iskeyword=48-57,_,A-Z,a-z,:,- +setlocal iskeyword=@,48-57,_,192-255,:,-,' " Set this once, globally. if !exists("perlpath") diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index a032928c..c8c3946f 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -28,7 +28,7 @@ if exists("loaded_matchit") && !exists("b:match_words") \ ':' . \ '\<\%(else\|elsif\|ensure\|when\|rescue\|break\|redo\|next\|retry\)\>' . \ ':' . - \ '\' . + \ '\%(^\|[^.\:@$]\)\@<=\' . \ ',{:},\[:\],(:)' let b:match_skip = diff --git a/indent/go.vim b/indent/go.vim index 660aa506..a3fa2b7a 100644 --- a/indent/go.vim +++ b/indent/go.vim @@ -9,7 +9,7 @@ " - general line splits (line ends in an operator) if exists("b:did_indent") - finish + finish endif let b:did_indent = 1 @@ -21,46 +21,58 @@ setlocal indentexpr=GoIndent(v:lnum) setlocal indentkeys+=<:>,0=},0=) if exists("*GoIndent") - finish + finish +endif + +" use shiftwidth function only if it's available +if exists('*shiftwidth') + func s:sw() + return shiftwidth() + endfunc +else + func s:sw() + return &sw + endfunc endif function! GoIndent(lnum) - let prevlnum = prevnonblank(a:lnum-1) - if prevlnum == 0 - " top of file - return 0 - endif + let prevlnum = prevnonblank(a:lnum-1) + if prevlnum == 0 + " top of file + return 0 + endif - " grab the previous and current line, stripping comments. - let prevl = substitute(getline(prevlnum), '//.*$', '', '') - let thisl = substitute(getline(a:lnum), '//.*$', '', '') - let previ = indent(prevlnum) + " grab the previous and current line, stripping comments. + let prevl = substitute(getline(prevlnum), '//.*$', '', '') + let thisl = substitute(getline(a:lnum), '//.*$', '', '') + let previ = indent(prevlnum) - let ind = previ - let s:shiftwidth = shiftwidth() + let ind = previ - if prevl =~ '[({]\s*$' - " previous line opened a block - let ind += s:shiftwidth - endif - if prevl =~# '^\s*\(case .*\|default\):$' - " previous line is part of a switch statement - let ind += s:shiftwidth - endif - " TODO: handle if the previous line is a label. + if prevl =~ '[({]\s*$' + " previous line opened a block + let ind += s:sw() + endif + if prevl =~# '^\s*\(case .*\|default\):$' + " previous line is part of a switch statement + let ind += s:sw() + endif + " TODO: handle if the previous line is a label. - if thisl =~ '^\s*[)}]' - " this line closed a block - let ind -= s:shiftwidth - endif + if thisl =~ '^\s*[)}]' + " this line closed a block + let ind -= s:sw() + endif - " Colons are tricky. - " We want to outdent if it's part of a switch ("case foo:" or "default:"). - " We ignore trying to deal with jump labels because (a) they're rare, and - " (b) they're hard to disambiguate from a composite literal key. - if thisl =~# '^\s*\(case .*\|default\):$' - let ind -= s:shiftwidth - endif + " Colons are tricky. + " We want to outdent if it's part of a switch ("case foo:" or "default:"). + " We ignore trying to deal with jump labels because (a) they're rare, and + " (b) they're hard to disambiguate from a composite literal key. + if thisl =~# '^\s*\(case .*\|default\):$' + let ind -= s:sw() + endif - return ind + return ind endfunction + +" vim:ts=4:sw=4:et diff --git a/indent/html.vim b/indent/html.vim index c8fe18e0..94baa871 100644 --- a/indent/html.vim +++ b/indent/html.vim @@ -128,8 +128,10 @@ call add(s:tags, 'nav') call add(s:tags, 'output') call add(s:tags, 'progress') call add(s:tags, 'picture') +call add(s:tags, 'rb') call add(s:tags, 'rp') call add(s:tags, 'rt') +call add(s:tags, 'rtc') call add(s:tags, 'ruby') call add(s:tags, 'section') call add(s:tags, 'source') diff --git a/indent/ruby.vim b/indent/ruby.vim index 1acde808..f0dde6fa 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -440,10 +440,14 @@ function GetRubyIndent(...) if strpart(line, 0, col('.') - 1) =~ '=\s*$' && \ strpart(line, col('.') - 1, 2) !~ 'do' + " assignment to case/begin/etc, on the same line, hanging indent let ind = virtcol('.') - 1 elseif getline(msl) =~ '=\s*\(#.*\)\=$' + " in the case of assignment to the msl, align to the starting line, + " not to the msl let ind = indent(line('.')) else + " align to the msl let ind = indent(msl) endif endif @@ -508,7 +512,16 @@ function GetRubyIndent(...) " If the previous line ended with a block opening, add a level of indent. if s:Match(lnum, s:block_regex) - return indent(s:GetMSL(lnum)) + sw + let msl = s:GetMSL(lnum) + + if getline(msl) =~ '=\s*\(#.*\)\=$' + " in the case of assignment to the msl, align to the starting line, + " not to the msl + let ind = indent(lnum) + sw + else + let ind = indent(msl) + sw + endif + return ind endif " If the previous line started with a leading operator, use its MSL's level diff --git a/indent/tex.vim b/indent/tex.vim index 93f70ece..e7653d03 100644 --- a/indent/tex.vim +++ b/indent/tex.vim @@ -17,8 +17,8 @@ let s:list_envs = ['itemize', 'enumerate', 'description'] " indent on \left( and on \(, but not on ( " indent on \left[ and on \[, but not on [ " indent on \left\{ and on {, but not on \{ -let s:open_pat = '\\\@ -" Last Change: 2013 Jul 05 +" Last Change: 2015 Mar 05 " Quit when a (custom) syntax file was already loaded if exists("b:current_syntax") @@ -35,28 +35,37 @@ syn match cSpecial display contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)" if !exists("c_no_utf") syn match cSpecial display contained "\\\(u\x\{4}\|U\x\{8}\)" endif -if exists("c_no_cformat") - syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,@Spell extend - " cCppString: same as cString, but ends at end of line - if !exists("cpp_no_cpp11") " ISO C++11 - syn region cCppString start=+\(L\|u\|u8\|U\|R\|LR\|u8R\|uR\|UR\)\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell - else - syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell - endif - syn region cCppOut2 contained start="0" end="^\s*\(%:\|#\)\s*\(endif\>\|else\>\|elif\>\)" contains=cSpaceError,cCppSkip - syn region cCppSkip contained start="^\s*\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" contains=cSpaceError,cCppSkip -else + +if !exists("c_no_cformat") + " Highlight % items in strings. if !exists("c_no_c99") " ISO C99 syn match cFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlLjzt]\|ll\|hh\)\=\([aAbdiuoxXDOUfFeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained else syn match cFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([bdiuoxXDOUfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained endif syn match cFormat display "%%" contained +endif + +" cCppString: same as cString, but ends at end of line +if s:ft ==# "cpp" && !exists("cpp_no_cpp11") && !exists("c_no_cformat") + " ISO C++11 + syn region cString start=+\(L\|u\|u8\|U\|R\|LR\|u8R\|uR\|UR\)\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend + syn region cCppString start=+\(L\|u\|u8\|U\|R\|LR\|u8R\|uR\|UR\)\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell +elseif s:ft ==# "c" && !exists("c_no_c11") && !exists("c_no_cformat") + " ISO C99 + syn region cString start=+\%(L\|U\|u8\)\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend + syn region cCppString start=+\%(L\|U\|u8\)\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell +else + " older C or C++ + syn match cFormat display "%%" contained syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend - " cCppString: same as cString, but ends at end of line syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell endif +syn region cCppSkip contained start="^\s*\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" contains=cSpaceError,cCppSkip + +syn cluster cStringGroup contains=cCppString,cCppSkip + syn match cCharacter "L\='[^\\]'" syn match cCharacter "L'[^']*'" contains=cSpecial if exists("c_gnu") @@ -70,7 +79,8 @@ syn match cSpecialCharacter display "L\='\\\o\{1,3}'" syn match cSpecialCharacter display "'\\x\x\{1,2}'" syn match cSpecialCharacter display "L'\\x\x\+'" -if !exists("c_no_c11") " ISO C11 +if (s:ft ==# "c" && !exists("c_no_c11")) || (s:ft ==# "cpp" && !exists("cpp_no_cpp11")) + " ISO C11 or ISO C++ 11 if exists("c_no_cformat") syn region cString start=+\%(U\|u8\=\)"+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,@Spell extend else @@ -102,24 +112,24 @@ endif " This should be before cErrInParen to avoid problems with #define ({ xxx }) if exists("c_curly_error") syn match cCurlyError "}" - syn region cBlock start="{" end="}" contains=ALLBUT,cBadBlock,cCurlyError,@cParenGroup,cErrInParen,cCppParen,cErrInBracket,cCppBracket,cCppString,@Spell fold + syn region cBlock start="{" end="}" contains=ALLBUT,cBadBlock,cCurlyError,@cParenGroup,cErrInParen,cCppParen,cErrInBracket,cCppBracket,@cStringGroup,@Spell fold else syn region cBlock start="{" end="}" transparent fold endif -"catch errors caused by wrong parenthesis and brackets -" also accept <% for {, %> for }, <: for [ and :> for ] (C99) +" Catch errors caused by wrong parenthesis and brackets. +" Also accept <% for {, %> for }, <: for [ and :> for ] (C99) " But avoid matching <::. syn cluster cParenGroup contains=cParenError,cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserLabel,cBitField,cOctalZero,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom if exists("c_no_curly_error") if s:ft ==# 'cpp' && !exists("cpp_no_cpp11") - syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString,@Spell + syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,@cStringGroup,@Spell " cCppParen: same as cParen but ends at end-of-line; used in cDefine syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell syn match cParenError display ")" syn match cErrInParen display contained "^^<%\|^%>" else - syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,cCppString,@Spell + syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,@cStringGroup,@Spell " cCppParen: same as cParen but ends at end-of-line; used in cDefine syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell syn match cParenError display ")" @@ -127,13 +137,13 @@ if exists("c_no_curly_error") endif elseif exists("c_no_bracket_error") if s:ft ==# 'cpp' && !exists("cpp_no_cpp11") - syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString,@Spell + syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,@cStringGroup,@Spell " cCppParen: same as cParen but ends at end-of-line; used in cDefine syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell syn match cParenError display ")" syn match cErrInParen display contained "<%\|%>" else - syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,cCppString,@Spell + syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,@cStringGroup,@Spell " cCppParen: same as cParen but ends at end-of-line; used in cDefine syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell syn match cParenError display ")" @@ -141,19 +151,19 @@ elseif exists("c_no_bracket_error") endif else if s:ft ==# 'cpp' && !exists("cpp_no_cpp11") - syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,cCppString,@Spell + syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,@cStringGroup,@Spell " cCppParen: same as cParen but ends at end-of-line; used in cDefine syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cErrInBracket,cParen,cBracket,cString,@Spell syn match cParenError display "[\])]" syn match cErrInParen display contained "<%\|%>" - syn region cBracket transparent start='\[\|<::\@!' end=']\|:>' contains=ALLBUT,@cParenGroup,cErrInParen,cCppParen,cCppBracket,cCppString,@Spell + syn region cBracket transparent start='\[\|<::\@!' end=']\|:>' contains=ALLBUT,@cParenGroup,cErrInParen,cCppParen,cCppBracket,@cStringGroup,@Spell else - syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,cCppString,@Spell + syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,@cStringGroup,@Spell " cCppParen: same as cParen but ends at end-of-line; used in cDefine syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cErrInBracket,cParen,cBracket,cString,@Spell syn match cParenError display "[\])]" syn match cErrInParen display contained "[\]{}]\|<%\|%>" - syn region cBracket transparent start='\[\|<::\@!' end=']\|:>' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cErrInParen,cCppParen,cCppBracket,cCppString,@Spell + syn region cBracket transparent start='\[\|<::\@!' end=']\|:>' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cErrInParen,cCppParen,cCppBracket,@cStringGroup,@Spell endif " cCppBracket: same as cParen but ends at end-of-line; used in cDefine syn region cCppBracket transparent start='\[\|<::\@!' skip='\\$' excludenl end=']\|:>' end='$' contained contains=ALLBUT,@cParenGroup,cErrInParen,cParen,cBracket,cString,@Spell @@ -322,6 +332,11 @@ if !exists("c_no_ansi") || exists("c_ansi_constants") || exists("c_gnu") syn keyword cConstant SEEK_CUR SEEK_END SEEK_SET syn keyword cConstant TMP_MAX stderr stdin stdout syn keyword cConstant EXIT_FAILURE EXIT_SUCCESS RAND_MAX + " POSIX 2001 + syn keyword cConstant SIGBUS SIGPOLL SIGPROF SIGSYS SIGURG + syn keyword cConstant SIGVTALRM SIGXCPU SIGXFSZ + " non-POSIX signals + syn keyword cConstant SIGWINCH SIGINFO " Add POSIX errors as well syn keyword cConstant E2BIG EACCES EAGAIN EBADF EBADMSG EBUSY syn keyword cConstant ECANCELED ECHILD EDEADLK EDOM EEXIST EFAULT @@ -373,7 +388,7 @@ syn region cPreProc start="^\s*\(%:\|#\)\s*\(pragma\>\|line\>\|warning\>\|warn\> " Highlight User Labels syn cluster cMultiGroup contains=cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserCont,cUserLabel,cBitField,cOctalZero,cCppOutWrapper,cCppInWrapper,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cCppParen,cCppBracket,cCppString if s:ft ==# 'c' || exists("cpp_no_cpp11") - syn region cMulti transparent start='?' skip='::' end=':' contains=ALLBUT,@cMultiGroup,@Spell + syn region cMulti transparent start='?' skip='::' end=':' contains=ALLBUT,@cMultiGroup,@Spell,@cStringGroup endif " Avoid matching foo::bar() in C++ by requiring that the next char is not ':' syn cluster cLabelGroup contains=cUserLabel @@ -458,8 +473,7 @@ hi def link cTodo Todo hi def link cBadContinuation Error hi def link cCppOutSkip cCppOutIf2 hi def link cCppInElse2 cCppOutIf2 -hi def link cCppOutIf2 cCppOut2 " Old syntax group for #if 0 body -hi def link cCppOut2 cCppOut " Old syntax group for #if of #if 0 +hi def link cCppOutIf2 cCppOut hi def link cCppOut Comment let b:current_syntax = "c" diff --git a/syntax/cpp.vim b/syntax/cpp.vim index 62dbe118..78731d75 100644 --- a/syntax/cpp.vim +++ b/syntax/cpp.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: C++ -" Current Maintainer: vim-jp (https://github.com/vim-jp/cpp-vim) +" Current Maintainer: vim-jp (https://github.com/vim-jp/vim-cpp) " Previous Maintainer: Ken Shan -" Last Change: 2014 May 13 +" Last Change: 2015 Mar 1 " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded @@ -32,14 +32,21 @@ syn match cppCast "\<\(const\|static\|dynamic\|reinterpret\)_cast\s*$" syn keyword cppStorageClass mutable syn keyword cppStructure class typename template namespace syn keyword cppBoolean true false +syn keyword cppConstant __cplusplus " C++ 11 extensions if !exists("cpp_no_cpp11") syn keyword cppType override final syn keyword cppExceptions noexcept - syn keyword cppStorageClass constexpr decltype + syn keyword cppStorageClass constexpr decltype thread_local syn keyword cppConstant nullptr - syn region cppRawString matchgroup=cppRawDelimiter start=+\%(u8\|[uLU]\)\=R"\z([[:alnum:]_{}[\]#<>%:;.?*\+\-/\^&|~!=,"']\{,16}\)(+ end=+)\z1"+ contains=@Spell + syn keyword cppConstant ATOMIC_FLAG_INIT ATOMIC_VAR_INIT + syn keyword cppConstant ATOMIC_BOOL_LOCK_FREE ATOMIC_CHAR_LOCK_FREE + syn keyword cppConstant ATOMIC_CHAR16_T_LOCK_FREE ATOMIC_CHAR32_T_LOCK_FREE + syn keyword cppConstant ATOMIC_WCHAR_T_LOCK_FREE ATOMIC_SHORT_LOCK_FREE + syn keyword cppConstant ATOMIC_INT_LOCK_FREE ATOMIC_LONG_LOCK_FREE + syn keyword cppConstant ATOMIC_LLONG_LOCK_FREE ATOMIC_POINTER_LOCK_FREE + syn region cppRawString matchgroup=cppRawDelimiter start=+\%(u8\|[uLU]\)\=R"\z([[:alnum:]_{}[\]#<>%:;.?*\+\-/\^&|~!=,"']\{,16}\)(+ end=+)\z1"+ contains=@Spell endif " The minimum and maximum operators in GNU C++ diff --git a/syntax/html.vim b/syntax/html.vim index 3e9beea4..4e7c7c8e 100644 --- a/syntax/html.vim +++ b/syntax/html.vim @@ -21,7 +21,7 @@ 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 time track video data +syn keyword htmlTagName contained progress ruby rt rp rb rtc section source summary time track video data syn keyword htmlTagName contained template content shadow syn keyword htmlTagName contained wbr bdi syn keyword htmlTagName contained picture @@ -76,12 +76,14 @@ syn keyword htmlArg contained label icon open datetime pubdate syn keyword htmlArg contained async " syn keyword htmlArg contained select +"