From 7a329911b9ae2b97453fd995bc3a6523cf3aab53 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar <Bram@vim.org> Date: Fri, 21 May 2010 12:05:36 +0200 Subject: [PATCH] Updated runtime files. --- runtime/doc/todo.txt | 1 + runtime/doc/version7.txt | 15 +++- runtime/filetype.vim | 6 ++ runtime/ftplugin/cucumber.vim | 1 + runtime/ftplugin/git.vim | 32 ++++---- runtime/ftplugin/gitcommit.vim | 62 +++++++-------- runtime/ftplugin/gitrebase.vim | 13 +-- runtime/ftplugin/haml.vim | 5 +- runtime/ftplugin/liquid.vim | 61 ++++++++++++++ runtime/ftplugin/markdown.vim | 19 +++++ runtime/ftplugin/sass.vim | 3 +- runtime/indent/cucumber.vim | 1 + runtime/indent/gitconfig.vim | 30 +++---- runtime/indent/haml.vim | 14 ++-- runtime/indent/liquid.vim | 63 +++++++++++++++ runtime/indent/sass.vim | 8 +- runtime/syntax/cucumber.vim | 25 ++++-- runtime/syntax/git.vim | 4 +- runtime/syntax/gitcommit.vim | 8 +- runtime/syntax/gitconfig.vim | 4 +- runtime/syntax/gitrebase.vim | 12 +-- runtime/syntax/gitsendemail.vim | 4 +- runtime/syntax/haml.vim | 66 +++++++++------ runtime/syntax/liquid.vim | 137 ++++++++++++++++++++++++++++++++ runtime/syntax/markdown.vim | 105 ++++++++++++++++++++++++ runtime/syntax/sass.vim | 13 ++- 26 files changed, 578 insertions(+), 134 deletions(-) create mode 100644 runtime/ftplugin/liquid.vim create mode 100644 runtime/ftplugin/markdown.vim create mode 100644 runtime/indent/liquid.vim create mode 100644 runtime/syntax/liquid.vim create mode 100644 runtime/syntax/markdown.vim diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index fcc4f9b87f..cd89dba7e9 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1102,6 +1102,7 @@ Patches to include: - Patch for Lisp support with ECL (Mikael Jansson, 2008 Oct 25) - Minor patches from Dominique Pelle, 2010 May 15 - Gvimext patch to support wide file names. (Szabolcs Horvat 2008 Sep 10) +- More float functions. - Patch to support netbeans for Mac. (Kazuki Sakamoto, 2009 Jun 25) - Patch to support clipboard for Mac terminal. (Jjgod Jiang, 2009 Aug 1) - Patch to support :browse for more commands. (Lech Lorens, 2009 Jul 18) diff --git a/runtime/doc/version7.txt b/runtime/doc/version7.txt index a49eae7635..1a59616c6a 100644 --- a/runtime/doc/version7.txt +++ b/runtime/doc/version7.txt @@ -3,7 +3,7 @@ VIM REFERENCE MANUAL by Bram Moolenaar - *vim7* + *vim7* *version-7.0* *version7.0* Welcome to Vim 7! A large number of features has been added. This file mentions all the new items, changes to existing features and bug fixes since Vim 6.x. Use this command to see the version you are using: > @@ -2984,7 +2984,7 @@ CTRL-N or a printable character while still searching for matches. ============================================================================== -VERSION 7.1 *version-7.1* +VERSION 7.1 *version-7.1* *version7.1* This section is about improvements made between version 7.0 and 7.1. @@ -4626,7 +4626,7 @@ Solution: Use the same mechanism as in mch_total_mem(): first reduce the Files: src/memfile.c ============================================================================== -VERSION 7.2 *version-7.2* +VERSION 7.2 *version-7.2* *version7.2* This section is about improvements made between version 7.1 and 7.2. @@ -7148,7 +7148,7 @@ Pelle) Mac: Could not build with Perl interface. ============================================================================== -VERSION 7.3 *version-7.3* +VERSION 7.3 *version-7.3* *version7.3* This section is about improvements made between version 7.2 and 7.3. @@ -7188,6 +7188,13 @@ Support GDK_SUPER_MASK for GTK on Mac. (Stephan Schulz) Fixed *fixed-7.3* ----- +When writing a file, switching tab pages and selecting a word the file write +message would be displayed again. This in Insert mode and with 'cmdheight' +set to 2. + +When using ":lang" to set a locale that uses a comma for decimal separator and +using GTK floating point numbers stop working. Use gtk_disable_setlocale(). +(James Vega) vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 1705fdc544..1e62d8561f 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -981,6 +981,9 @@ endif " SBCL implementation of Common Lisp au BufNewFile,BufRead sbclrc,.sbclrc setf lisp +" Liquid +au BufNewFile,BufRead *.liquid setf liquid + " Lite au BufNewFile,BufRead *.lite,*.lt setf lite @@ -1045,6 +1048,9 @@ au BufNewFile,BufRead *.mv,*.mpl,*.mws setf maple " Map (UMN mapserver config file) au BufNewFile,BufRead *.map setf map +" Markdown +au BufNewFile,BufRead *.markdown,*.mdown,*.mkd,*.mkdn,README.md setf markdown + " Mason au BufNewFile,BufRead *.mason,*.mhtml setf mason diff --git a/runtime/ftplugin/cucumber.vim b/runtime/ftplugin/cucumber.vim index 8ef8c2399b..63cfbcf336 100644 --- a/runtime/ftplugin/cucumber.vim +++ b/runtime/ftplugin/cucumber.vim @@ -1,6 +1,7 @@ " Vim filetype plugin " Language: Cucumber " Maintainer: Tim Pope <vimNOSPAM@tpope.org> +" Last Change: 2010 May 21 " Only do this when not done yet for this buffer if (exists("b:did_ftplugin")) diff --git a/runtime/ftplugin/git.vim b/runtime/ftplugin/git.vim index 63d4f338ed..e043c7587e 100644 --- a/runtime/ftplugin/git.vim +++ b/runtime/ftplugin/git.vim @@ -1,33 +1,33 @@ " Vim filetype plugin " Language: generic git output " Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2009 Dec 24 +" Last Change: 2010 May 21 " Only do this when not done yet for this buffer if (exists("b:did_ftplugin")) - finish + finish endif let b:did_ftplugin = 1 if !exists('b:git_dir') - if expand('%:p') =~# '\.git\>' - let b:git_dir = matchstr(expand('%:p'),'.*\.git\>') - elseif $GIT_DIR != '' - let b:git_dir = $GIT_DIR - endif - if (has('win32') || has('win64')) && exists('b:git_dir') - let b:git_dir = substitute(b:git_dir,'\\','/','g') - endif + if expand('%:p') =~# '\.git\>' + let b:git_dir = matchstr(expand('%:p'),'.*\.git\>') + elseif $GIT_DIR != '' + let b:git_dir = $GIT_DIR + endif + if (has('win32') || has('win64')) && exists('b:git_dir') + let b:git_dir = substitute(b:git_dir,'\\','/','g') + endif endif if exists('*shellescape') && exists('b:git_dir') && b:git_dir != '' - if b:git_dir =~# '/\.git$' " Not a bare repository - let &l:path = escape(fnamemodify(b:git_dir,':h'),'\, ').','.&l:path - endif - let &l:path = escape(b:git_dir,'\, ').','.&l:path - let &l:keywordprg = 'git --git-dir='.shellescape(b:git_dir).' show' + if b:git_dir =~# '/\.git$' " Not a bare repository + let &l:path = escape(fnamemodify(b:git_dir,':h'),'\, ').','.&l:path + endif + let &l:path = escape(b:git_dir,'\, ').','.&l:path + let &l:keywordprg = 'git --git-dir='.shellescape(b:git_dir).' show' else - setlocal keywordprg=git\ show + setlocal keywordprg=git\ show endif if has('gui_running') let &l:keywordprg = substitute(&l:keywordprg,'^git\>','git --no-pager','') diff --git a/runtime/ftplugin/gitcommit.vim b/runtime/ftplugin/gitcommit.vim index f8788c8444..94d635c5dd 100644 --- a/runtime/ftplugin/gitcommit.vim +++ b/runtime/ftplugin/gitcommit.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: git commit file " Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2009 Dec 24 +" Last Change: 2010 May 21 " Only do this when not done yet for this buffer if (exists("b:did_ftplugin")) @@ -15,7 +15,7 @@ if &textwidth == 0 " make sure that log messages play nice with git-log on standard terminals setlocal textwidth=72 if !exists("b:undo_ftplugin") - let b:undo_ftplugin = "" + let b:undo_ftplugin = "" endif let b:undo_ftplugin = b:undo_ftplugin . "|setl tw<" endif @@ -25,7 +25,7 @@ if exists("g:no_gitcommit_commands") || v:version < 700 endif if !exists("b:git_dir") - let b:git_dir = expand("%:p:h") + let b:git_dir = expand("%:p:h") endif " Automatically diffing can be done with: @@ -33,36 +33,36 @@ endif command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0,b:git_dir,<f-args>) function! s:diffcomplete(A,L,P) - let args = "" - if a:P <= match(a:L." -- "," -- ")+3 - let args = args . "-p\n--stat\n--shortstat\n--summary\n--patch-with-stat\n--no-renames\n-B\n-M\n-C\n" - end - if exists("b:git_dir") && a:A !~ '^-' - let tree = fnamemodify(b:git_dir,':h') - if strpart(getcwd(),0,strlen(tree)) == tree - let args = args."\n".system("git diff --cached --name-only") - endif + let args = "" + if a:P <= match(a:L." -- "," -- ")+3 + let args = args . "-p\n--stat\n--shortstat\n--summary\n--patch-with-stat\n--no-renames\n-B\n-M\n-C\n" + end + if exists("b:git_dir") && a:A !~ '^-' + let tree = fnamemodify(b:git_dir,':h') + if strpart(getcwd(),0,strlen(tree)) == tree + let args = args."\n".system("git diff --cached --name-only") endif - return args + endif + return args endfunction function! s:gitdiffcached(bang,gitdir,...) - let tree = fnamemodify(a:gitdir,':h') - let name = tempname() - let git = "git" - if strpart(getcwd(),0,strlen(tree)) != tree - let git .= " --git-dir=".(exists("*shellescape") ? shellescape(a:gitdir) : '"'.a:gitdir.'"') - endif - if a:0 - let extra = join(map(copy(a:000),exists("*shellescape") ? 'shellescape(v:val)' : "'\"'.v:val.'\"'")) - else - let extra = "-p --stat=".&columns - endif - call system(git." diff --cached --no-color ".extra." > ".(exists("*shellescape") ? shellescape(name) : name)) - exe "pedit ".(exists("*fnameescape") ? fnameescape(name) : name) - wincmd P - let b:git_dir = a:gitdir - command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0,b:git_dir,<f-args>) - nnoremap <silent> q :q<CR> - setlocal buftype=nowrite nobuflisted noswapfile nomodifiable filetype=git + let tree = fnamemodify(a:gitdir,':h') + let name = tempname() + let git = "git" + if strpart(getcwd(),0,strlen(tree)) != tree + let git .= " --git-dir=".(exists("*shellescape") ? shellescape(a:gitdir) : '"'.a:gitdir.'"') + endif + if a:0 + let extra = join(map(copy(a:000),exists("*shellescape") ? 'shellescape(v:val)' : "'\"'.v:val.'\"'")) + else + let extra = "-p --stat=".&columns + endif + call system(git." diff --cached --no-color ".extra." > ".(exists("*shellescape") ? shellescape(name) : name)) + exe "pedit ".(exists("*fnameescape") ? fnameescape(name) : name) + wincmd P + let b:git_dir = a:gitdir + command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0,b:git_dir,<f-args>) + nnoremap <silent> q :q<CR> + setlocal buftype=nowrite nobuflisted noswapfile nomodifiable filetype=git endfunction diff --git a/runtime/ftplugin/gitrebase.vim b/runtime/ftplugin/gitrebase.vim index 4680d285e7..0200ba1acc 100644 --- a/runtime/ftplugin/gitrebase.vim +++ b/runtime/ftplugin/gitrebase.vim @@ -1,11 +1,11 @@ " Vim filetype plugin " Language: git rebase --interactive " Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2009 Dec 24 +" Last Change: 2010 May 21 " Only do this when not done yet for this buffer if (exists("b:did_ftplugin")) - finish + finish endif runtime! ftplugin/git.vim @@ -13,28 +13,29 @@ let b:did_ftplugin = 1 setlocal comments=:# commentstring=#\ %s formatoptions-=t if !exists("b:undo_ftplugin") - let b:undo_ftplugin = "" + let b:undo_ftplugin = "" endif let b:undo_ftplugin = b:undo_ftplugin."|setl com< cms< fo<" function! s:choose(word) - s/^\(\w\+\>\)\=\(\s*\)\ze\x\{4,40\}\>/\=(strlen(submatch(1)) == 1 ? a:word[0] : a:word) . substitute(submatch(2),'^$',' ','')/e + s/^\(\w\+\>\)\=\(\s*\)\ze\x\{4,40\}\>/\=(strlen(submatch(1)) == 1 ? a:word[0] : a:word) . substitute(submatch(2),'^$',' ','')/e endfunction function! s:cycle() - call s:choose(get({'s':'edit','p':'squash','e':'reword'},getline('.')[0],'pick')) + call s:choose(get({'s':'edit','p':'squash','e':'reword','r':'fixup'},getline('.')[0],'pick')) endfunction command! -buffer -bar Pick :call s:choose('pick') command! -buffer -bar Squash :call s:choose('squash') command! -buffer -bar Edit :call s:choose('edit') command! -buffer -bar Reword :call s:choose('reword') +command! -buffer -bar Fixup :call s:choose('fixup') command! -buffer -bar Cycle :call s:cycle() " The above are more useful when they are mapped; for example: "nnoremap <buffer> <silent> S :Cycle<CR> if exists("g:no_plugin_maps") || exists("g:no_gitrebase_maps") - finish + finish endif nnoremap <buffer> <expr> K col('.') < 7 && expand('<Lt>cword>') =~ '\X' && getline('.') =~ '^\w\+\s\+\x\+\>' ? 'wK' : 'K' diff --git a/runtime/ftplugin/haml.vim b/runtime/ftplugin/haml.vim index 0a39d5ef3a..b2c1eca3fc 100644 --- a/runtime/ftplugin/haml.vim +++ b/runtime/ftplugin/haml.vim @@ -1,6 +1,7 @@ " Vim filetype plugin " Language: Haml -" Maintainer: Tim Pope <vimNOSPAM@tpope.info> +" Maintainer: Tim Pope <vimNOSPAM@tpope.org> +" Last Change: 2010 May 21 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -56,7 +57,7 @@ if exists("loaded_matchit") let b:match_words = s:match_words endif -setlocal commentstring=-#\ %s +setlocal comments= commentstring=-#\ %s let b:undo_ftplugin = "setl cms< com< " \ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin diff --git a/runtime/ftplugin/liquid.vim b/runtime/ftplugin/liquid.vim new file mode 100644 index 0000000000..b211a884c6 --- /dev/null +++ b/runtime/ftplugin/liquid.vim @@ -0,0 +1,61 @@ +" Vim filetype plugin +" Language: Liquid +" Maintainer: Tim Pope <vimNOSPAM@tpope.org> +" Last Change: 2010 May 21 + +if exists('b:did_ftplugin') + finish +endif + +if !exists('g:liquid_default_subtype') + let g:liquid_default_subtype = 'html' +endif + +if !exists('b:liquid_subtype') + let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$") + let b:liquid_subtype = matchstr(s:lines,'liquid_subtype=\zs\w\+') + if b:liquid_subtype == '' + let b:liquid_subtype = matchstr(&filetype,'^liquid\.\zs\w\+') + endif + if b:liquid_subtype == '' + let b:liquid_subtype = matchstr(substitute(expand('%:t'),'\c\%(\.liquid\)\+$','',''),'\.\zs\w\+$') + endif + if b:liquid_subtype == '' + let b:liquid_subtype = g:liquid_default_subtype + endif +endif + +if exists('b:liquid_subtype') && b:liquid_subtype != '' + exe 'runtime! ftplugin/'.b:liquid_subtype.'.vim ftplugin/'.b:liquid_subtype.'_*.vim ftplugin/'.b:liquid_subtype.'/*.vim' +else + runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim +endif +let b:did_ftplugin = 1 + +if exists('b:undo_ftplugin') + let b:undo_ftplugin .= '|' +else + let b:undo_ftplugin = '' +endif +if exists('b:browsefilter') + let b:browsefilter = "\n".b:browsefilter +else + let b:browsefilter = '' +endif +if exists('b:match_words') + let b:match_words .= ',' +elseif exists('loaded_matchit') + let b:match_words = '' +endif + +if has('gui_win32') + let b:browsefilter="Liquid Files (*.liquid)\t*.liquid" . b:browsefilter +endif + +if exists('loaded_matchit') + let b:match_words .= '\<\%(if\w*\|unless\|case\)\>:\<\%(elsif\|else\|when\)\>:\<end\%(if\w*\|unless\|case\)\>,\<\%(for\|tablerow\)\>:\%({%\s*\)\@<=empty\>:\<end\%(for\|tablerow\)\>,<\(capture\|comment\|highlight\)\>:\<end\1\>' +endif + +setlocal commentstring={%\ comment\ %}%s{%\ endcomment\ %} + +let b:undo_ftplugin .= 'setl cms< | unlet! b:browsefilter b:match_words' diff --git a/runtime/ftplugin/markdown.vim b/runtime/ftplugin/markdown.vim new file mode 100644 index 0000000000..946208203c --- /dev/null +++ b/runtime/ftplugin/markdown.vim @@ -0,0 +1,19 @@ +" Vim filetype plugin +" Language: Markdown +" Maintainer: Tim Pope <vimNOSPAM@tpope.org> +" Last Change: 2010 May 21 + +if exists("b:did_ftplugin") + finish +endif + +runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim +unlet! b:did_ftplugin + +setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=>\ %s +setlocal formatoptions+=tcqln +setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^[-*+]\\s\\+ + +let b:undo_ftplugin .= "|setl cms< com< fo<" + +" vim:set sw=2: diff --git a/runtime/ftplugin/sass.vim b/runtime/ftplugin/sass.vim index ad039772ad..9a99931731 100644 --- a/runtime/ftplugin/sass.vim +++ b/runtime/ftplugin/sass.vim @@ -1,6 +1,7 @@ " Vim filetype plugin " Language: Sass -" Maintainer: Tim Pope <vimNOSPAM@tpope.info> +" Maintainer: Tim Pope <vimNOSPAM@tpope.org> +" Last Change: 2010 May 21 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") diff --git a/runtime/indent/cucumber.vim b/runtime/indent/cucumber.vim index 8cbbc39743..a19d123f7e 100644 --- a/runtime/indent/cucumber.vim +++ b/runtime/indent/cucumber.vim @@ -1,6 +1,7 @@ " Vim indent file " Language: Cucumber " Maintainer: Tim Pope <vimNOSPAM@tpope.org> +" Last Change: 2010 May 21 if exists("b:did_indent") finish diff --git a/runtime/indent/gitconfig.vim b/runtime/indent/gitconfig.vim index 28d95b7cd2..fa57e56ab6 100644 --- a/runtime/indent/gitconfig.vim +++ b/runtime/indent/gitconfig.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: git config file " Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2009 Dec 24 +" Last Change: 2010 May 21 if exists("b:did_indent") finish @@ -18,18 +18,18 @@ if exists("*GetGitconfigIndent") endif function! GetGitconfigIndent() - let line = getline(prevnonblank(v:lnum-1)) - let cline = getline(v:lnum) - if line =~ '\\\@<!\%(\\\\\)*\\$' - " odd number of slashes, in a line continuation - return 2 * &sw - elseif cline =~ '^\s*\[' - return 0 - elseif cline =~ '^\s*\a' - return &sw - elseif cline == '' && line =~ '^\[' - return &sw - else - return -1 - endif + let line = getline(prevnonblank(v:lnum-1)) + let cline = getline(v:lnum) + if line =~ '\\\@<!\%(\\\\\)*\\$' + " odd number of slashes, in a line continuation + return 2 * &sw + elseif cline =~ '^\s*\[' + return 0 + elseif cline =~ '^\s*\a' + return &sw + elseif cline == '' && line =~ '^\[' + return &sw + else + return -1 + endif endfunction diff --git a/runtime/indent/haml.vim b/runtime/indent/haml.vim index c1feee09a9..079bd0513b 100644 --- a/runtime/indent/haml.vim +++ b/runtime/indent/haml.vim @@ -1,7 +1,7 @@ " Vim indent file -" Language: HAML -" Maintainer: Tim Pope <vimNOSPAM@tpope.info> -" Last Change: 2007 Dec 16 +" Language: Haml +" Maintainer: Tim Pope <vimNOSPAM@tpope.org> +" Last Change: 2008 Sep 11 if exists("b:did_indent") finish @@ -44,8 +44,6 @@ function! GetHamlIndent() if indent == indent(lnum) let indent = cindent <= indent ? -1 : increase endif - "let indent = indent == indent(lnum) ? -1 : indent - "let indent = indent > indent(lnum) + &sw ? indent(lnum) + &sw : indent let group = synIDattr(synID(lnum,lastcol,1),'name') @@ -53,9 +51,11 @@ function! GetHamlIndent() return indent elseif line =~ '^/\%(\[[^]]*\]\)\=$' return increase - elseif line =~ '^:' + elseif group == 'hamlFilter' return increase - elseif line =~ '^'.s:tag.'[=~-]\s*\%(\%(if\|else\|elsif\|unless\|case\|when\|while\|until\|for\|begin\|module\|class\|def\)\>\%(.*\<end\>\)\@!\|.*do |[^|]*|\s*$\)' + elseif line =~ '^'.s:tag.'[&!]\=[=~-]\s*\%(\%(if\|else\|elsif\|unless\|case\|when\|while\|until\|for\|begin\|module\|class\|def\)\>\%(.*\<end\>\)\@!\|.*do\%(\s*|[^|]*|\)\=\s*$\)' + return increase + elseif line =~ '^'.s:tag.'[&!]\=[=~-].*,\s*$' return increase elseif line == '-#' return increase diff --git a/runtime/indent/liquid.vim b/runtime/indent/liquid.vim new file mode 100644 index 0000000000..08341b04f6 --- /dev/null +++ b/runtime/indent/liquid.vim @@ -0,0 +1,63 @@ +" Vim indent file +" Language: Liquid +" Maintainer: Tim Pope <vimNOSPAM@tpope.org> +" Last Change: 2010 May 21 + +if exists('b:did_indent') + finish +endif + +set indentexpr= +if exists('b:liquid_subtype') + exe 'runtime! indent/'.b:liquid_subtype.'.vim' +else + runtime! indent/html.vim +endif +unlet! b:did_indent + +if &l:indentexpr == '' + if &l:cindent + let &l:indentexpr = 'cindent(v:lnum)' + else + let &l:indentexpr = 'indent(prevnonblank(v:lnum-1))' + endif +endif +let b:liquid_subtype_indentexpr = &l:indentexpr + +let b:did_indent = 1 + +setlocal indentexpr=GetLiquidIndent() +setlocal indentkeys=o,O,*<Return>,<>>,{,},0),0],o,O,!^F,=end,=endif,=endunless,=endifchanged,=endcase,=endfor,=endtablerow,=endcapture,=else,=elsif,=when,=empty + +" Only define the function once. +if exists('*GetLiquidIndent') + finish +endif + +function! s:count(string,pattern) + let string = substitute(a:string,'\C'.a:pattern,"\n",'g') + return strlen(substitute(string,"[^\n]",'','g')) +endfunction + +function! GetLiquidIndent(...) + if a:0 && a:1 == '.' + let v:lnum = line('.') + elseif a:0 && a:1 =~ '^\d' + let v:lnum = a:1 + endif + let vcol = col('.') + call cursor(v:lnum,1) + exe "let ind = ".b:liquid_subtype_indentexpr + let lnum = prevnonblank(v:lnum-1) + let line = getline(lnum) + let cline = getline(v:lnum) + let line = substitute(line,'\C^\%(\s*{%\s*end\w*\s*%}\)\+','','') + let line .= matchstr(cline,'\C^\%(\s*{%\s*end\w*\s*%}\)\+') + let cline = substitute(cline,'\C^\%(\s*{%\s*end\w*\s*%}\)\+','','') + let ind += &sw * s:count(line,'{%\s*\%(if\|elsif\|else\|unless\|ifchanged\|case\|when\|for\|tablerow\|capture\)\>') + let ind -= &sw * s:count(line,'{%\s*end\%(if\|unless\|ifchanged\|case\|for\|tablerow\|capture\)\>') + let ind += &sw * s:count(line,'{%\s*\%(elsif\|else\|when\|empty\)\>') + let ind -= &sw * s:count(cline,'{%\s*\%(elsif\|else\|when\|empty\)\>') + let ind -= &sw * s:count(cline,'{%\s*end\w*$') + return ind +endfunction diff --git a/runtime/indent/sass.vim b/runtime/indent/sass.vim index 45ca50f689..4622f00ff8 100644 --- a/runtime/indent/sass.vim +++ b/runtime/indent/sass.vim @@ -1,7 +1,7 @@ " Vim indent file -" Language: SASS -" Maintainer: Tim Pope <vimNOSPAM@tpope.info> -" Last Change: 2007 Dec 16 +" Language: Sass +" Maintainer: Tim Pope <vimNOSPAM@tpope.org> +" Last Change: 2010 May 21 if exists("b:did_indent") finish @@ -17,7 +17,7 @@ if exists("*GetSassIndent") finish endif -let s:property = '^\s*:\|^\s*[[:alnum:]-]\+:' +let s:property = '^\s*:\|^\s*[[:alnum:]-]\+\%(:\|\s*=\)' function! GetSassIndent() let lnum = prevnonblank(v:lnum-1) diff --git a/runtime/syntax/cucumber.vim b/runtime/syntax/cucumber.vim index 258471a5b7..d85268143c 100644 --- a/runtime/syntax/cucumber.vim +++ b/runtime/syntax/cucumber.vim @@ -2,6 +2,7 @@ " Language: Cucumber " Maintainer: Tim Pope <vimNOSPAM@tpope.org> " Filenames: *.feature +" Last Change: 2010 May 21 if exists("b:current_syntax") finish @@ -14,13 +15,16 @@ let g:cucumber_languages = { \"en": {"and": "And\\>", "background": "Background\\>", "but": "But\\>", "examples": "Scenarios\\>\\|Examples\\>", "feature": "Feature\\>", "given": "Given\\>", "scenario": "Scenario\\>", "scenario_outline": "Scenario Outline\\>", "then": "Then\\>", "when": "When\\>"}, \"ar": {"and": "\\%u0648\\>", "background": "\\%u0627\\%u0644\\%u062e\\%u0644\\%u0641\\%u064a\\%u0629\\>", "but": "\\%u0644\\%u0643\\%u0646\\>", "examples": "\\%u0627\\%u0645\\%u062b\\%u0644\\%u0629\\>", "feature": "\\%u062e\\%u0627\\%u0635\\%u064a\\%u0629\\>", "given": "\\%u0628\\%u0641\\%u0631\\%u0636\\>", "scenario": "\\%u0633\\%u064a\\%u0646\\%u0627\\%u0631\\%u064a\\%u0648\\>", "scenario_outline": "\\%u0633\\%u064a\\%u0646\\%u0627\\%u0631\\%u064a\\%u0648 \\%u0645\\%u062e\\%u0637\\%u0637\\>", "then": "\\%u0627\\%u0630\\%u0627\\%u064b\\>\\|\\%u062b\\%u0645\\>", "when": "\\%u0639\\%u0646\\%u062f\\%u0645\\%u0627\\>\\|\\%u0645\\%u062a\\%u0649\\>"}, \"bg": {"and": "\\%u0418\\>", "background": "\\%u041f\\%u0440\\%u0435\\%u0434\\%u0438\\%u0441\\%u0442\\%u043e\\%u0440\\%u0438\\%u044f\\>", "but": "\\%u041d\\%u043e\\>", "examples": "\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440\\%u0438\\>", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b\\%u043d\\%u043e\\%u0441\\%u0442\\>", "given": "\\%u0414\\%u0430\\%u0434\\%u0435\\%u043d\\%u043e\\>", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439\\>", "scenario_outline": "\\%u0420\\%u0430\\%u043c\\%u043a\\%u0430 \\%u043d\\%u0430 \\%u0441\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439\\>", "then": "\\%u0422\\%u043e\\>", "when": "\\%u041a\\%u043e\\%u0433\\%u0430\\%u0442\\%u043e\\>"}, - \"cat": {"and": "I\\>", "background": "Antecedents\\>\\|Rerefons\\>", "but": "Per\\%u00f2\\>", "examples": "Exemples\\>", "feature": "Caracter\\%u00edstica\\>", "given": "Donada\\>\\|Donat\\>", "scenario": "Escenari\\>", "scenario_outline": "Esquema de l'escenari\\>", "then": "Aleshores\\>", "when": "Quan\\>"}, + \"ca": {"and": "I\\>", "background": "Antecedents\\>\\|Rerefons\\>", "but": "Per\\%u00f2\\>", "examples": "Exemples\\>", "feature": "Caracter\\%u00edstica\\>\\|Funcionalitat\\>", "given": "At\\%u00e8s\\>\\|Donada\\>\\|Donat\\>\\|Atesa\\>", "scenario": "Escenari\\>", "scenario_outline": "Esquema de l'escenari\\>", "then": "Aleshores\\>\\|Cal\\>", "when": "Quan\\>"}, \"cs": {"and": "A tak\\%u00e9\\>\\|A\\>", "background": "Pozad\\%u00ed\\>\\|Kontext\\>", "but": "Ale\\>", "examples": "P\\%u0159\\%u00edklady\\>", "feature": "Po\\%u017eadavek\\>", "given": "Pokud\\>", "scenario": "Sc\\%u00e9n\\%u00e1\\%u0159\\>", "scenario_outline": "N\\%u00e1\\%u010drt Sc\\%u00e9n\\%u00e1\\%u0159e\\>\\|Osnova sc\\%u00e9n\\%u00e1\\%u0159e\\>", "then": "Pak\\>", "when": "Kdy\\%u017e\\>"}, - \"cy": {"and": "A\\>", "background": "Cefndir\\>", "but": "Ond\\>", "examples": "Enghreifftiau\\>", "feature": "Arwedd\\>", "given": "anrhegedig a\\>", "scenario": "Scenario\\>", "scenario_outline": "Scenario Amlinellol\\>", "then": "Yna\\>", "when": "Pryd\\>"}, + \"cy-GB": {"and": "A\\>", "background": "Cefndir\\>", "but": "Ond\\>", "examples": "Enghreifftiau\\>", "feature": "Arwedd\\>", "given": "Anrhegedig a\\>", "scenario": "Scenario\\>", "scenario_outline": "Scenario Amlinellol\\>", "then": "Yna\\>", "when": "Pryd\\>"}, \"da": {"and": "Og\\>", "background": "Baggrund\\>", "but": "Men\\>", "examples": "Eksempler\\>", "feature": "Egenskab\\>", "given": "Givet\\>", "scenario": "Scenarie\\>", "scenario_outline": "Abstrakt Scenario\\>", "then": "S\\%u00e5\\>", "when": "N\\%u00e5r\\>"}, - \"de": {"and": "Und\\>", "background": "Grundlage\\>", "but": "Aber\\>", "examples": "Beispiele\\>", "feature": "Funktionalit\\%u00e4t\\>", "given": "Gegeben sei\\>", "scenario": "Szenario\\>", "scenario_outline": "Szenariogrundriss\\>", "then": "Dann\\>", "when": "Wenn\\>"}, + \"de": {"and": "Und\\>", "background": "Grundlage\\>", "but": "Aber\\>", "examples": "Beispiele\\>", "feature": "Funktionalit\\%u00e4t\\>", "given": "Gegeben sei\\>\\|Angenommen\\>", "scenario": "Szenario\\>", "scenario_outline": "Szenariogrundriss\\>", "then": "Dann\\>", "when": "Wenn\\>"}, + \"en-Scouse": {"and": "An\\>", "background": "Dis is what went down\\>", "but": "Buh\\>", "examples": "Examples\\>", "feature": "Feature\\>", "given": "Youse know when youse got\\>\\|Givun\\>", "scenario": "The thing of it is\\>", "scenario_outline": "Wharrimean is\\>", "then": "Den youse gotta\\>\\|Dun\\>", "when": "Youse know like when\\>\\|Wun\\>"}, \"en-au": {"and": "N\\>", "background": "Background\\>", "but": "Cept\\>", "examples": "Cobber\\>", "feature": "Crikey\\>", "given": "Ya know how\\>", "scenario": "Mate\\>", "scenario_outline": "Blokes\\>", "then": "Ya gotta\\>", "when": "When\\>"}, \"en-lol": {"and": "AN\\>", "background": "B4\\>", "but": "BUT\\>", "examples": "EXAMPLZ\\>", "feature": "OH HAI\\>", "given": "I CAN HAZ\\>", "scenario": "MISHUN\\>", "scenario_outline": "MISHUN SRSLY\\>", "then": "DEN\\>", "when": "WEN\\>"}, + \"en-tx": {"and": "And y'all\\>", "background": "Background\\>", "but": "But y'all\\>", "examples": "Examples\\>", "feature": "Feature\\>", "given": "Given y'all\\>", "scenario": "Scenario\\>", "scenario_outline": "All y'all\\>", "then": "Then y'all\\>", "when": "When y'all\\>"}, + \"eo": {"and": "Kaj\\>", "background": "Fono\\>", "but": "Sed\\>", "examples": "Ekzemploj\\>", "feature": "Trajto\\>", "given": "Donita\\%u0135o\\>", "scenario": "Scenaro\\>", "scenario_outline": "Konturo de la scenaro\\>", "then": "Do\\>", "when": "Se\\>"}, \"es": {"and": "Y\\>", "background": "Antecedentes\\>", "but": "Pero\\>", "examples": "Ejemplos\\>", "feature": "Caracter\\%u00edstica\\>", "given": "Dado\\>", "scenario": "Escenario\\>", "scenario_outline": "Esquema del escenario\\>", "then": "Entonces\\>", "when": "Cuando\\>"}, \"et": {"and": "Ja\\>", "background": "Taust\\>", "but": "Kuid\\>", "examples": "Juhtumid\\>", "feature": "Omadus\\>", "given": "Eeldades\\>", "scenario": "Stsenaarium\\>", "scenario_outline": "Raamstsenaarium\\>", "then": "Siis\\>", "when": "Kui\\>"}, \"fi": {"and": "Ja\\>", "background": "Tausta\\>", "but": "Mutta\\>", "examples": "Tapaukset\\>", "feature": "Ominaisuus\\>", "given": "Oletetaan\\>", "scenario": "Tapaus\\>", "scenario_outline": "Tapausaihio\\>", "then": "Niin\\>", "when": "Kun\\>"}, @@ -31,21 +35,23 @@ let g:cucumber_languages = { \"id": {"and": "Dan\\>", "background": "Dasar\\>", "but": "Tapi\\>", "examples": "Contoh\\>", "feature": "Fitur\\>", "given": "Dengan\\>", "scenario": "Skenario\\>", "scenario_outline": "Skenario konsep\\>", "then": "Maka\\>", "when": "Ketika\\>"}, \"it": {"and": "E\\>", "background": "Contesto\\>", "but": "Ma\\>", "examples": "Esempi\\>", "feature": "Funzionalit\\%u00e0\\>", "given": "Dato\\>", "scenario": "Scenario\\>", "scenario_outline": "Schema dello scenario\\>", "then": "Allora\\>", "when": "Quando\\>"}, \"ja": {"and": "\\%u304b\\%u3064", "background": "\\%u80cc\\%u666f\\>", "but": "\\%u3057\\%u304b\\%u3057\\|\\%u305f\\%u3060\\%u3057\\|\\%u4f46\\%u3057", "examples": "\\%u30b5\\%u30f3\\%u30d7\\%u30eb\\>\\|\\%u4f8b\\>", "feature": "\\%u30d5\\%u30a3\\%u30fc\\%u30c1\\%u30e3\\>\\|\\%u6a5f\\%u80fd\\>", "given": "\\%u524d\\%u63d0", "scenario": "\\%u30b7\\%u30ca\\%u30ea\\%u30aa\\>", "scenario_outline": "\\%u30b7\\%u30ca\\%u30ea\\%u30aa\\%u30a2\\%u30a6\\%u30c8\\%u30e9\\%u30a4\\%u30f3\\>\\|\\%u30b7\\%u30ca\\%u30ea\\%u30aa\\%u30c6\\%u30f3\\%u30d7\\%u30ec\\%u30fc\\%u30c8\\>\\|\\%u30b7\\%u30ca\\%u30ea\\%u30aa\\%u30c6\\%u30f3\\%u30d7\\%u30ec\\>\\|\\%u30c6\\%u30f3\\%u30d7\\%u30ec\\>", "then": "\\%u306a\\%u3089\\%u3070", "when": "\\%u3082\\%u3057"}, - \"ko": {"and": "\\%uadf8\\%ub9ac\\%uace0", "background": "\\%ubc30\\%uacbd\\>", "but": "\\%ud558\\%uc9c0\\%ub9cc", "examples": "\\%uc608\\>", "feature": "\\%uae30\\%ub2a5\\>", "given": "\\%uc870\\%uac74", "scenario": "\\%uc2dc\\%ub098\\%ub9ac\\%uc624\\>", "scenario_outline": "\\%uc2dc\\%ub098\\%ub9ac\\%uc624 \\%uac1c\\%uc694\\>", "then": "\\%uadf8\\%ub7ec\\%uba74", "when": "\\%ub9cc\\%uc77c"}, + \"ko": {"and": "\\%uadf8\\%ub9ac\\%uace0", "background": "\\%ubc30\\%uacbd\\>", "but": "\\%ud558\\%uc9c0\\%ub9cc\\|\\%ub2e8", "examples": "\\%uc608\\>", "feature": "\\%uae30\\%ub2a5\\>", "given": "\\%uc870\\%uac74\\|\\%uba3c\\%uc800", "scenario": "\\%uc2dc\\%ub098\\%ub9ac\\%uc624\\>", "scenario_outline": "\\%uc2dc\\%ub098\\%ub9ac\\%uc624 \\%uac1c\\%uc694\\>", "then": "\\%uadf8\\%ub7ec\\%uba74", "when": "\\%ub9cc\\%uc77c\\|\\%ub9cc\\%uc57d"}, \"lt": {"and": "Ir\\>", "background": "Kontekstas\\>", "but": "Bet\\>", "examples": "Pavyzd\\%u017eiai\\>\\|Scenarijai\\>\\|Variantai\\>", "feature": "Savyb\\%u0117\\>", "given": "Duota\\>", "scenario": "Scenarijus\\>", "scenario_outline": "Scenarijaus \\%u0161ablonas\\>", "then": "Tada\\>", "when": "Kai\\>"}, + \"lu": {"and": "an\\>\\|a\\>", "background": "Hannergrond\\>", "but": "m\\%u00e4\\>\\|awer\\>", "examples": "Beispiller\\>", "feature": "Funktionalit\\%u00e9it\\>", "given": "ugeholl\\>", "scenario": "Szenario\\>", "scenario_outline": "Plang vum Szenario\\>", "then": "dann\\>", "when": "wann\\>"}, \"lv": {"and": "Un\\>", "background": "Situ\\%u0101cija\\>\\|Konteksts\\>", "but": "Bet\\>", "examples": "Piem\\%u0113ri\\>\\|Paraugs\\>", "feature": "Funkcionalit\\%u0101te\\>\\|F\\%u012b\\%u010da\\>", "given": "Kad\\>", "scenario": "Scen\\%u0101rijs\\>", "scenario_outline": "Scen\\%u0101rijs p\\%u0113c parauga\\>", "then": "Tad\\>", "when": "Ja\\>"}, \"nl": {"and": "En\\>", "background": "Achtergrond\\>", "but": "Maar\\>", "examples": "Voorbeelden\\>", "feature": "Functionaliteit\\>", "given": "Gegeven\\>\\|Stel\\>", "scenario": "Scenario\\>", "scenario_outline": "Abstract Scenario\\>", "then": "Dan\\>", "when": "Als\\>"}, \"no": {"and": "Og\\>", "background": "Bakgrunn\\>", "but": "Men\\>", "examples": "Eksempler\\>", "feature": "Egenskap\\>", "given": "Gitt\\>", "scenario": "Scenario\\>", "scenario_outline": "Abstrakt Scenario\\>", "then": "S\\%u00e5\\>", "when": "N\\%u00e5r\\>"}, \"pl": {"and": "Oraz\\>", "background": "Za\\%u0142o\\%u017cenia\\>", "but": "Ale\\>", "examples": "Przyk\\%u0142ady\\>", "feature": "W\\%u0142a\\%u015bciwo\\%u015b\\%u0107\\>", "given": "Zak\\%u0142adaj\\%u0105c\\>", "scenario": "Scenariusz\\>", "scenario_outline": "Szablon scenariusza\\>", "then": "Wtedy\\>", "when": "Je\\%u017celi\\>"}, \"pt": {"and": "E\\>", "background": "Contexto\\>", "but": "Mas\\>", "examples": "Exemplos\\>", "feature": "Funcionalidade\\>", "given": "Dado\\>", "scenario": "Cen\\%u00e1rio\\>\\|Cenario\\>", "scenario_outline": "Esquema do Cen\\%u00e1rio\\>\\|Esquema do Cenario\\>", "then": "Ent\\%u00e3o\\>\\|Entao\\>", "when": "Quando\\>"}, \"ro": {"and": "Si\\>", "background": "Conditii\\>", "but": "Dar\\>", "examples": "Exemplele\\>", "feature": "Functionalitate\\>", "given": "Daca\\>", "scenario": "Scenariu\\>", "scenario_outline": "Scenariul de sablon\\>", "then": "Atunci\\>", "when": "Cand\\>"}, - \"ro2": {"and": "\\%u0218i\\>", "background": "Condi\\%u0163ii\\>", "but": "Dar\\>", "examples": "Exemplele\\>", "feature": "Func\\%u021bionalitate\\>", "given": "Dac\\%u0103\\>", "scenario": "Scenariu\\>", "scenario_outline": "Scenariul de \\%u015fablon\\>", "then": "Atunci\\>", "when": "C\\%u00e2nd\\>"}, - \"ru": {"and": "\\%u041a \\%u0442\\%u043e\\%u043c\\%u0443 \\%u0436\\%u0435\\>\\|\\%u0418\\>", "background": "\\%u041f\\%u0440\\%u0435\\%u0434\\%u044b\\%u0441\\%u0442\\%u043e\\%u0440\\%u0438\\%u044f\\>", "but": "\\%u041d\\%u043e\\>\\|\\%u0410\\>", "examples": "\\%u0417\\%u043d\\%u0430\\%u0447\\%u0435\\%u043d\\%u0438\\%u044f\\>", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b\\>", "given": "\\%u0414\\%u043e\\%u043f\\%u0443\\%u0441\\%u0442\\%u0438\\%u043c\\>", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439\\>", "scenario_outline": "\\%u0421\\%u0442\\%u0440\\%u0443\\%u043a\\%u0442\\%u0443\\%u0440\\%u0430 \\%u0441\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u044f\\>", "then": "\\%u0422\\%u043e\\>", "when": "\\%u0415\\%u0441\\%u043b\\%u0438\\>"}, - \"se": {"and": "Och\\>", "background": "Bakgrund\\>", "but": "Men\\>", "examples": "Exempel\\>", "feature": "Egenskap\\>", "given": "Givet\\>", "scenario": "Scenario\\>", "scenario_outline": "Abstrakt Scenario\\>", "then": "S\\%u00e5\\>", "when": "N\\%u00e4r\\>"}, + \"ro-RO": {"and": "\\%u0218i\\>", "background": "Condi\\%u0163ii\\>", "but": "Dar\\>", "examples": "Exemplele\\>", "feature": "Func\\%u021bionalitate\\>", "given": "Dac\\%u0103\\>", "scenario": "Scenariu\\>", "scenario_outline": "Scenariul de \\%u015fablon\\>", "then": "Atunci\\>", "when": "C\\%u00e2nd\\>"}, + \"ru": {"and": "\\%u041a \\%u0442\\%u043e\\%u043c\\%u0443 \\%u0436\\%u0435\\>\\|\\%u0418\\>", "background": "\\%u041f\\%u0440\\%u0435\\%u0434\\%u044b\\%u0441\\%u0442\\%u043e\\%u0440\\%u0438\\%u044f\\>", "but": "\\%u041d\\%u043e\\>\\|\\%u0410\\>", "examples": "\\%u0417\\%u043d\\%u0430\\%u0447\\%u0435\\%u043d\\%u0438\\%u044f\\>", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b\\>\\|\\%u0424\\%u0438\\%u0447\\%u0430\\>", "given": "\\%u0414\\%u043e\\%u043f\\%u0443\\%u0441\\%u0442\\%u0438\\%u043c\\>", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439\\>", "scenario_outline": "\\%u0421\\%u0442\\%u0440\\%u0443\\%u043a\\%u0442\\%u0443\\%u0440\\%u0430 \\%u0441\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u044f\\>", "then": "\\%u0422\\%u043e\\>", "when": "\\%u0415\\%u0441\\%u043b\\%u0438\\>"}, \"sk": {"and": "A\\>", "background": "Pozadie\\>", "but": "Ale\\>", "examples": "Pr\\%u00edklady\\>", "feature": "Po\\%u017eiadavka\\>", "given": "Pokia\\%u013e\\>", "scenario": "Scen\\%u00e1r\\>", "scenario_outline": "N\\%u00e1\\%u010drt Scen\\%u00e1ru\\>", "then": "Tak\\>", "when": "Ke\\%u010f\\>"}, - \"sr": {"and": "\\%u0418\\>", "background": "\\%u041a\\%u043e\\%u043d\\%u0442\\%u0435\\%u043a\\%u0441\\%u0442\\>\\|\\%u041f\\%u043e\\%u0437\\%u0430\\%u0434\\%u0438\\%u043d\\%u0430\\>\\|\\%u041e\\%u0441\\%u043d\\%u043e\\%u0432\\%u0430\\>", "but": "\\%u0410\\%u043b\\%u0438\\>", "examples": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0458\\%u0438\\>\\|\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440\\%u0438\\>", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b\\%u043d\\%u043e\\%u0441\\%u0442\\>\\|\\%u041c\\%u043e\\%u0433\\%u0443\\%u045b\\%u043d\\%u043e\\%u0441\\%u0442\\>\\|\\%u041e\\%u0441\\%u043e\\%u0431\\%u0438\\%u043d\\%u0430\\>", "given": "\\%u0417\\%u0430\\%u0434\\%u0430\\%u0442\\%u043e\\>\\|\\%u0417\\%u0430\\%u0434\\%u0430\\%u0442\\%u0435\\>\\|\\%u0417\\%u0430\\%u0434\\%u0430\\%u0442\\%u0438\\>", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u043e\\>\\|\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440\\>", "scenario_outline": "\\%u0421\\%u0442\\%u0440\\%u0443\\%u043a\\%u0442\\%u0443\\%u0440\\%u0430 \\%u0441\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0458\\%u0430\\>\\|\\%u041a\\%u043e\\%u043d\\%u0446\\%u0435\\%u043f\\%u0442\\>\\|\\%u0421\\%u043a\\%u0438\\%u0446\\%u0430\\>", "then": "\\%u041e\\%u043d\\%u0434\\%u0430\\>", "when": "\\%u041a\\%u0430\\%u0434\\%u0430\\>\\|\\%u041a\\%u0430\\%u0434\\>"}, + \"sr-Cyrl": {"and": "\\%u0418\\>", "background": "\\%u041a\\%u043e\\%u043d\\%u0442\\%u0435\\%u043a\\%u0441\\%u0442\\>\\|\\%u041f\\%u043e\\%u0437\\%u0430\\%u0434\\%u0438\\%u043d\\%u0430\\>\\|\\%u041e\\%u0441\\%u043d\\%u043e\\%u0432\\%u0430\\>", "but": "\\%u0410\\%u043b\\%u0438\\>", "examples": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0458\\%u0438\\>\\|\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440\\%u0438\\>", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b\\%u043d\\%u043e\\%u0441\\%u0442\\>\\|\\%u041c\\%u043e\\%u0433\\%u0443\\%u045b\\%u043d\\%u043e\\%u0441\\%u0442\\>\\|\\%u041e\\%u0441\\%u043e\\%u0431\\%u0438\\%u043d\\%u0430\\>", "given": "\\%u0417\\%u0430\\%u0434\\%u0430\\%u0442\\%u043e\\>\\|\\%u0417\\%u0430\\%u0434\\%u0430\\%u0442\\%u0435\\>\\|\\%u0417\\%u0430\\%u0434\\%u0430\\%u0442\\%u0438\\>", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u043e\\>\\|\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440\\>", "scenario_outline": "\\%u0421\\%u0442\\%u0440\\%u0443\\%u043a\\%u0442\\%u0443\\%u0440\\%u0430 \\%u0441\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0458\\%u0430\\>\\|\\%u041a\\%u043e\\%u043d\\%u0446\\%u0435\\%u043f\\%u0442\\>\\|\\%u0421\\%u043a\\%u0438\\%u0446\\%u0430\\>", "then": "\\%u041e\\%u043d\\%u0434\\%u0430\\>", "when": "\\%u041a\\%u0430\\%u0434\\%u0430\\>\\|\\%u041a\\%u0430\\%u0434\\>"}, \"sr-Latn": {"and": "I\\>", "background": "Kontekst\\>\\|Pozadina\\>\\|Osnova\\>", "but": "Ali\\>", "examples": "Scenariji\\>\\|Primeri\\>", "feature": "Mogu\\%u0107nost\\>\\|Funkcionalnost\\>\\|Mogucnost\\>\\|Osobina\\>", "given": "Zadato\\>\\|Zadate\\>\\|Zatati\\>", "scenario": "Scenario\\>\\|Primer\\>", "scenario_outline": "Struktura scenarija\\>\\|Koncept\\>\\|Skica\\>", "then": "Onda\\>", "when": "Kada\\>\\|Kad\\>"}, + \"sv": {"and": "Och\\>", "background": "Bakgrund\\>", "but": "Men\\>", "examples": "Exempel\\>", "feature": "Egenskap\\>", "given": "Givet\\>", "scenario": "Scenario\\>", "scenario_outline": "Abstrakt Scenario\\>", "then": "S\\%u00e5\\>", "when": "N\\%u00e4r\\>"}, \"tr": {"and": "Ve\\>", "background": "Ge\\%u00e7mi\\%u015f\\>", "but": "Fakat\\>\\|Ama\\>", "examples": "\\%u00d6rnekler\\>", "feature": "\\%u00d6zellik\\>", "given": "Diyelim ki\\>", "scenario": "Senaryo\\>", "scenario_outline": "Senaryo tasla\\%u011f\\%u0131\\>", "then": "O zaman\\>", "when": "E\\%u011fer ki\\>"}, + \"uk": {"and": "\\%u0406\\>", "background": "\\%u041f\\%u0435\\%u0440\\%u0435\\%u0434\\%u0443\\%u043c\\%u043e\\%u0432\\%u0430\\>", "but": "\\%u0410\\%u043b\\%u0435\\>", "examples": "\\%u041f\\%u0440\\%u0438\\%u043a\\%u043b\\%u0430\\%u0434\\%u0438\\>", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0456\\%u043e\\%u043d\\%u0430\\%u043b\\>", "given": "\\%u041f\\%u0440\\%u0438\\%u043f\\%u0443\\%u0441\\%u0442\\%u0438\\%u043c\\%u043e, \\%u0449\\%u043e\\>\\|\\%u041f\\%u0440\\%u0438\\%u043f\\%u0443\\%u0441\\%u0442\\%u0438\\%u043c\\%u043e\\>\\|\\%u041d\\%u0435\\%u0445\\%u0430\\%u0439\\>", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0456\\%u0439\\>", "scenario_outline": "\\%u0421\\%u0442\\%u0440\\%u0443\\%u043a\\%u0442\\%u0443\\%u0440\\%u0430 \\%u0441\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0456\\%u044e\\>", "then": "\\%u0422\\%u043e\\>", "when": "\\%u042f\\%u043a\\%u0449\\%u043e\\>"}, \"uz": {"and": "\\%u0412\\%u0430\\>", "background": "\\%u0422\\%u0430\\%u0440\\%u0438\\%u0445\\>", "but": "\\%u041b\\%u0435\\%u043a\\%u0438\\%u043d\\>\\|\\%u0411\\%u0438\\%u0440\\%u043e\\%u043a\\>\\|\\%u0410\\%u043c\\%u043c\\%u043e\\>", "examples": "\\%u041c\\%u0438\\%u0441\\%u043e\\%u043b\\%u043b\\%u0430\\%u0440\\>", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b\\>", "given": "\\%u0410\\%u0433\\%u0430\\%u0440\\>", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439\\>", "scenario_outline": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439 \\%u0441\\%u0442\\%u0440\\%u0443\\%u043a\\%u0442\\%u0443\\%u0440\\%u0430\\%u0441\\%u0438\\>", "then": "\\%u0423\\%u043d\\%u0434\\%u0430\\>", "when": "\\%u0410\\%u0433\\%u0430\\%u0440\\>"}, \"vi": {"and": "V\\%u00e0\\>", "background": "B\\%u1ed1i c\\%u1ea3nh\\>", "but": "Nh\\%u01b0ng\\>", "examples": "D\\%u1eef li\\%u1ec7u\\>", "feature": "T\\%u00ednh n\\%u0103ng\\>", "given": "Bi\\%u1ebft\\>\\|Cho\\>", "scenario": "T\\%u00ecnh hu\\%u1ed1ng\\>\\|K\\%u1ecbch b\\%u1ea3n\\>", "scenario_outline": "Khung t\\%u00ecnh hu\\%u1ed1ng\\>\\|Khung k\\%u1ecbch b\\%u1ea3n\\>", "then": "Th\\%u00ec\\>", "when": "Khi\\>"}, \"zh-CN": {"and": "\\%u800c\\%u4e14", "background": "\\%u80cc\\%u666f\\>", "but": "\\%u4f46\\%u662f", "examples": "\\%u4f8b\\%u5b50\\>", "feature": "\\%u529f\\%u80fd\\>", "given": "\\%u5047\\%u5982", "scenario": "\\%u573a\\%u666f\\>", "scenario_outline": "\\%u573a\\%u666f\\%u5927\\%u7eb2\\>", "then": "\\%u90a3\\%u4e48", "when": "\\%u5f53"}, @@ -53,6 +59,9 @@ let g:cucumber_languages = { function! s:pattern(key) let language = matchstr(getline(1),'#\s*language:\s*\zs\S\+') + if &fileencoding == 'latin1' && language == '' + let language = 'en' + endif if has_key(g:cucumber_languages, language) let languages = [g:cucumber_languages[language]] else diff --git a/runtime/syntax/git.vim b/runtime/syntax/git.vim index feb70848a8..48264c7bf2 100644 --- a/runtime/syntax/git.vim +++ b/runtime/syntax/git.vim @@ -1,10 +1,10 @@ " Vim syntax file " Language: generic git output " Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2009 Dec 24 +" Last Change: 2010 May 21 if exists("b:current_syntax") - finish + finish endif syn case match diff --git a/runtime/syntax/gitcommit.vim b/runtime/syntax/gitcommit.vim index 12db0a42a0..07447ca5e4 100644 --- a/runtime/syntax/gitcommit.vim +++ b/runtime/syntax/gitcommit.vim @@ -2,17 +2,17 @@ " Language: git commit file " Maintainer: Tim Pope <vimNOSPAM@tpope.org> " Filenames: *.git/COMMIT_EDITMSG -" Last Change: 2009 Dec 24 +" Last Change: 2010 May 21 if exists("b:current_syntax") - finish + finish endif syn case match syn sync minlines=50 if has("spell") - syn spell toplevel + syn spell toplevel endif syn include @gitcommitDiff syntax/diff.vim @@ -29,7 +29,7 @@ syn match gitcommitOnBranch "\%(^# \)\@<=Your branch .\{-\} '" contained conta syn match gitcommitBranch "[^ \t']\+" contained syn match gitcommitNoBranch "\%(^# \)\@<=Not currently on any branch." contained containedin=gitcommitComment syn match gitcommitHeader "\%(^# \)\@<=.*:$" contained containedin=gitcommitComment -syn region gitcommitAuthor matchgroup=gitCommitHeader start=/\%(^# \)\@<=Author:/ end=/$/ keepend oneline contained containedin=gitcommitComment transparent +syn region gitcommitAuthor matchgroup=gitCommitHeader start=/\%(^# \)\@<=\%(Author\|Committer\):/ end=/$/ keepend oneline contained containedin=gitcommitComment transparent syn match gitcommitNoChanges "\%(^# \)\@<=No changes$" contained containedin=gitcommitComment syn region gitcommitUntracked start=/^# Untracked files:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitUntrackedFile fold diff --git a/runtime/syntax/gitconfig.vim b/runtime/syntax/gitconfig.vim index dc14adc108..c6c56f77b6 100644 --- a/runtime/syntax/gitconfig.vim +++ b/runtime/syntax/gitconfig.vim @@ -2,10 +2,10 @@ " Language: git config file " Maintainer: Tim Pope <vimNOSPAM@tpope.org> " Filenames: gitconfig, .gitconfig, *.git/config -" Last Change: 2009 Dec 24 +" Last Change: 2010 May 21 if exists("b:current_syntax") - finish + finish endif setlocal iskeyword+=- diff --git a/runtime/syntax/gitrebase.vim b/runtime/syntax/gitrebase.vim index 94361c17c0..ba1745d01f 100644 --- a/runtime/syntax/gitrebase.vim +++ b/runtime/syntax/gitrebase.vim @@ -2,10 +2,10 @@ " Language: git rebase --interactive " Maintainer: Tim Pope <vimNOSPAM@tpope.org> " Filenames: git-rebase-todo -" Last Change: 2009 Dec 24 +" Last Change: 2010 May 21 if exists("b:current_syntax") - finish + finish endif syn case match @@ -13,19 +13,21 @@ syn case match syn match gitrebaseHash "\v<\x{7,40}>" contained syn match gitrebaseCommit "\v<\x{7,40}>" nextgroup=gitrebaseSummary skipwhite syn match gitrebasePick "\v^p%(ick)=>" nextgroup=gitrebaseCommit skipwhite -syn match gitrebaseEdit "\v^e%(dit)=>" nextgroup=gitrebaseCommit skipwhite syn match gitrebaseReword "\v^r%(eword)=>" nextgroup=gitrebaseCommit skipwhite +syn match gitrebaseEdit "\v^e%(dit)=>" nextgroup=gitrebaseCommit skipwhite syn match gitrebaseSquash "\v^s%(quash)=>" nextgroup=gitrebaseCommit skipwhite +syn match gitrebaseFixup "\v^f%(ixup)=>" nextgroup=gitrebaseCommit skipwhite syn match gitrebaseSummary ".*" contains=gitrebaseHash contained syn match gitrebaseComment "^#.*" contains=gitrebaseHash -syn match gitrebaseSquashError "\v%^s%(quash)=>" nextgroup=gitrebaseCommit skipwhite +syn match gitrebaseSquashError "\v%^%(s%(quash)=>|f%(ixup)=>)" nextgroup=gitrebaseCommit skipwhite hi def link gitrebaseCommit gitrebaseHash hi def link gitrebaseHash Identifier hi def link gitrebasePick Statement +hi def link gitrebaseReword Number hi def link gitrebaseEdit PreProc -hi def link gitrebaseReword Special hi def link gitrebaseSquash Type +hi def link gitrebaseFixup Special hi def link gitrebaseSummary String hi def link gitrebaseComment Comment hi def link gitrebaseSquashError Error diff --git a/runtime/syntax/gitsendemail.vim b/runtime/syntax/gitsendemail.vim index d247cdabab..8b938116fa 100644 --- a/runtime/syntax/gitsendemail.vim +++ b/runtime/syntax/gitsendemail.vim @@ -2,10 +2,10 @@ " Language: git send-email message " Maintainer: Tim Pope " Filenames: *.msg.[0-9]* (first line is "From ... # This line is ignored.") -" Last Change: 2007 Dec 16 +" Last Change: 2010 May 21 if exists("b:current_syntax") - finish + finish endif runtime! syntax/mail.vim diff --git a/runtime/syntax/haml.vim b/runtime/syntax/haml.vim index 395600a70c..bb144bad00 100644 --- a/runtime/syntax/haml.vim +++ b/runtime/syntax/haml.vim @@ -1,7 +1,8 @@ " Vim syntax file " Language: Haml -" Maintainer: Tim Pope <vimNOSPAM@tpope.info> +" Maintainer: Tim Pope <vimNOSPAM@tpope.org> " Filenames: *.haml +" Last Change: 2010 May 21 if exists("b:current_syntax") finish @@ -20,46 +21,58 @@ syn include @hamlRubyTop syntax/ruby.vim syn case match -syn cluster hamlComponent contains=hamlAttributes,hamlClassChar,hamlIdChar,hamlObject,hamlDespacer,hamlSelfCloser,hamlRuby,hamlPlainChar,hamlInterpolatable -syn cluster hamlEmbeddedRuby contains=hamlAttributes,hamlObject,hamlRuby,hamlRubyFilter +syn region rubyCurlyBlock start="{" end="}" contains=@hamlRubyTop contained containedin=rubyInterpolation +syn cluster hamlRubyTop add=rubyCurlyBlock + +syn cluster hamlComponent contains=hamlAttributes,hamlAttributesHash,hamlClassChar,hamlIdChar,hamlObject,hamlDespacer,hamlSelfCloser,hamlRuby,hamlPlainChar,hamlInterpolatable +syn cluster hamlEmbeddedRuby contains=hamlAttributesHash,hamlObject,hamlRuby,hamlRubyFilter syn cluster hamlTop contains=hamlBegin,hamlPlainFilter,hamlRubyFilter,hamlSassFilter,hamlComment,hamlHtmlComment -syn match hamlBegin "^\s*[<>&]\@!" nextgroup=hamlTag,hamlAttributes,hamlClassChar,hamlIdChar,hamlObject,hamlRuby,hamlPlainChar,hamlInterpolatable +syn match hamlBegin "^\s*\%([<>]\|&[^=~ ]\)\@!" nextgroup=hamlTag,hamlClassChar,hamlIdChar,hamlRuby,hamlPlainChar,hamlInterpolatable syn match hamlTag "%\w\+" contained contains=htmlTagName,htmlSpecialTagName nextgroup=@hamlComponent -syn region hamlAttributes matchgroup=hamlAttributesDelimiter start="{" end="}" contained contains=@hamlRubyTop nextgroup=@hamlComponent -syn region hamlObject matchgroup=hamlObjectDelimiter start="\[" end="\]" contained contains=@hamlRubyTop nextgroup=@hamlComponent +syn region hamlAttributes matchgroup=hamlAttributesDelimiter start="(" end=")" contained contains=htmlArg,hamlAttributeString,hamlAttributeVariable,htmlEvent,htmlCssDefinition nextgroup=@hamlComponent +syn region hamlAttributesHash matchgroup=hamlAttributesDelimiter start="{" end="}" contained contains=@hamlRubyTop nextgroup=@hamlComponent +syn region hamlObject matchgroup=hamlObjectDelimiter start="\[" end="\]" contained contains=@hamlRubyTop nextgroup=@hamlComponent syn match hamlDespacer "[<>]" contained nextgroup=hamlDespacer,hamlSelfCloser,hamlRuby,hamlPlainChar,hamlInterpolatable syn match hamlSelfCloser "/" contained syn match hamlClassChar "\." contained nextgroup=hamlClass -syn match hamlIdChar "#" contained nextgroup=hamlId +syn match hamlIdChar "#{\@!" contained nextgroup=hamlId syn match hamlClass "\%(\w\|-\)\+" contained nextgroup=@hamlComponent syn match hamlId "\%(\w\|-\)\+" contained nextgroup=@hamlComponent syn region hamlDocType start="^\s*!!!" end="$" -syn region hamlRuby matchgroup=hamlRubyOutputChar start="[=~]" end="$" contained contains=@hamlRubyTop keepend -syn region hamlRuby matchgroup=hamlRubyChar start="-" end="$" contained contains=@hamlRubyTop keepend +syn region hamlRuby matchgroup=hamlRubyOutputChar start="[!&]\==\|\~" skip=",\s*$" end="$" contained contains=@hamlRubyTop keepend +syn region hamlRuby matchgroup=hamlRubyChar start="-" skip=",\s*$" end="$" contained contains=@hamlRubyTop keepend syn match hamlPlainChar "\\" contained -syn region hamlInterpolatable matchgroup=hamlInterpolatableChar start="==" end="$" keepend contained contains=hamlInterpolation -syn region hamlInterpolation matchgroup=hamlInterpolationDelimiter start="#{" end="}" contained contains=@hamlRubyTop +syn region hamlInterpolatable matchgroup=hamlInterpolatableChar start="!\===\|!=\@!" end="$" keepend contained contains=hamlInterpolation,hamlInterpolationEscape,@hamlHtmlTop +syn region hamlInterpolatable matchgroup=hamlInterpolatableChar start="&==\|&=\@!" end="$" keepend contained contains=hamlInterpolation,hamlInterpolationEscape +syn region hamlInterpolation matchgroup=hamlInterpolationDelimiter start="#{" end="}" contains=@hamlRubyTop +syn match hamlInterpolationEscape "\\\@<!\%(\\\\\)*\\\%(\\\ze#{\|#\ze{\)" syn region hamlErbInterpolation matchgroup=hamlInterpolationDelimiter start="<%[=-]\=" end="-\=%>" contained contains=@hamlRubyTop -syn match hamlHelper "\<action_view?\|\.\@<!\<\%(flatten\|open\|puts\)" contained containedin=@hamlEmbeddedRuby,@hamlRubyTop,rubyInterpolation -syn keyword hamlHelper capture_haml find_and_preserve html_attrs init_haml_helpers list_of preced preserve succeed surround tab_down tab_up page_class contained containedin=@hamlEmbeddedRuby,@hamlRubyTop,rubyInterpolation +syn region hamlAttributeString start=+\%(=\s*\)\@<='+ skip=+\%(\\\\\)*\\'+ end=+'+ contains=hamlInterpolation,hamlInterpolationEscape +syn region hamlAttributeString start=+\%(=\s*\)\@<="+ skip=+\%(\\\\\)*\\"+ end=+"+ contains=hamlInterpolation,hamlInterpolationEscape +syn match hamlAttributeVariable "\%(=\s*\)\@<=\%(@@\=\|\$\)\=\w\+" contained + +syn match hamlHelper "\<action_view?\|\<block_is_haml?\|\<is_haml?\|\.\@<!\<flatten" contained containedin=@hamlEmbeddedRuby,@hamlRubyTop,rubyInterpolation +syn keyword hamlHelper capture_haml escape_once find_and_preserve haml_concat haml_indent haml_tag html_attrs html_esape init_haml_helpers list_of non_haml precede preserve succeed surround tab_down tab_up page_class contained containedin=@hamlEmbeddedRuby,@hamlRubyTop,rubyInterpolation syn cluster hamlHtmlTop contains=@htmlTop,htmlBold,htmlItalic,htmlUnderline -syn region hamlPlainFilter matchgroup=hamlFilter start="^\z(\s*\):\%(plain\|preserve\|erb\|redcloth\|textile\|markdown\)\s*$" end="^\%(\z1 \)\@!" contains=@hamlHtmlTop,rubyInterpolation -syn region hamlEscapedFilter matchgroup=hamlFilter start="^\z(\s*\):\%(escaped\)\s*$" end="^\%(\z1 \)\@!" contains=rubyInterpolation -syn region hamlErbFilter matchgroup=hamlFilter start="^\z(\s*\):erb\s*$" end="^\%(\z1 \)\@!" contains=@hamlHtmlTop,hamlErbInterpolation -syn region hamlRubyFilter matchgroup=hamlFilter start="^\z(\s*\):ruby\s*$" end="^\%(\z1 \)\@!" contains=@hamlRubyTop -syn region hamlSassFilter matchgroup=hamlFilter start="^\z(\s*\):sass\s*$" end="^\%(\z1 \)\@!" contains=@hamlSassTop - -syn region hamlJavascriptBlock start="^\z(\s*\)%script" nextgroup=@hamlComponent,hamlError end="^\%(\z1 \)\@!" contains=@hamlTop,@htmlJavaScript keepend -syn region hamlCssBlock start="^\z(\s*\)%style" nextgroup=@hamlComponent,hamlError end="^\%(\z1 \)\@!" contains=@hamlTop,@htmlCss keepend +syn region hamlPlainFilter matchgroup=hamlFilter start="^\z(\s*\):\%(plain\|preserve\|redcloth\|textile\|markdown\|maruku\)\s*$" end="^\%(\z1 \| *$\)\@!" contains=@hamlHtmlTop,rubyInterpolation +syn region hamlEscapedFilter matchgroup=hamlFilter start="^\z(\s*\):\%(escaped\|cdata\)\s*$" end="^\%(\z1 \| *$\)\@!" contains=rubyInterpolation +syn region hamlErbFilter matchgroup=hamlFilter start="^\z(\s*\):erb\s*$" end="^\%(\z1 \| *$\)\@!" contains=@hamlHtmlTop,hamlErbInterpolation +syn region hamlRubyFilter matchgroup=hamlFilter start="^\z(\s*\):ruby\s*$" end="^\%(\z1 \| *$\)\@!" contains=@hamlRubyTop +syn region hamlJavascriptFilter matchgroup=hamlFilter start="^\z(\s*\):javascript\s*$" end="^\%(\z1 \| *$\)\@!" contains=@htmlJavaScript,rubyInterpolation keepend +syn region hamlCSSFilter matchgroup=hamlFilter start="^\z(\s*\):css\s*$" end="^\%(\z1 \| *$\)\@!" contains=@htmlCss,rubyInterpolation keepend +syn region hamlSassFilter matchgroup=hamlFilter start="^\z(\s*\):sass\s*$" end="^\%(\z1 \| *$\)\@!" contains=@hamlSassTop + +syn region hamlJavascriptBlock start="^\z(\s*\)%script" nextgroup=@hamlComponent,hamlError end="^\%(\z1 \| *$\)\@!" contains=@hamlTop,@htmlJavaScript keepend +syn region hamlCssBlock start="^\z(\s*\)%style" nextgroup=@hamlComponent,hamlError end="^\%(\z1 \| *$\)\@!" contains=@hamlTop,@htmlCss keepend syn match hamlError "\$" contained -syn region hamlComment start="^\z(\s*\)-#" end="^\%(\z1 \)\@!" contains=rubyTodo -syn region hamlHtmlComment start="^\z(\s*\)/" end="^\%(\z1 \)\@!" contains=@hamlTop,rubyTodo +syn region hamlComment start="^\z(\s*\)-#" end="^\%(\z1 \| *$\)\@!" contains=rubyTodo +syn region hamlHtmlComment start="^\z(\s*\)/" end="^\%(\z1 \| *$\)\@!" contains=@hamlTop,rubyTodo syn match hamlIEConditional "\%(^\s*/\)\@<=\[if\>[^]]*]" contained containedin=hamlHtmlComment hi def link hamlSelfCloser Special @@ -74,6 +87,9 @@ hi def link hamlInterpolatableChar hamlRubyChar hi def link hamlRubyOutputChar hamlRubyChar hi def link hamlRubyChar Special hi def link hamlInterpolationDelimiter Delimiter +hi def link hamlInterpolationEscape Special +hi def link hamlAttributeString String +hi def link hamlAttributeVariable Identifier hi def link hamlDocType PreProc hi def link hamlFilter PreProc hi def link hamlAttributesDelimiter Delimiter @@ -86,4 +102,8 @@ hi def link hamlError Error let b:current_syntax = "haml" +if main_syntax == "haml" + unlet main_syntax +endif + " vim:set sw=2: diff --git a/runtime/syntax/liquid.vim b/runtime/syntax/liquid.vim new file mode 100644 index 0000000000..20e5f38837 --- /dev/null +++ b/runtime/syntax/liquid.vim @@ -0,0 +1,137 @@ +" Vim syntax file +" Language: Liquid +" Maintainer: Tim Pope <vimNOSPAM@tpope.org> +" Filenames: *.liquid +" Last Change: 2010 May 21 + +if exists('b:current_syntax') + finish +endif + +if !exists('main_syntax') + let main_syntax = 'liquid' +endif + +if !exists('g:liquid_default_subtype') + let g:liquid_default_subtype = 'html' +endif + +if !exists('b:liquid_subtype') && main_syntax == 'liquid' + let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$") + let b:liquid_subtype = matchstr(s:lines,'liquid_subtype=\zs\w\+') + if b:liquid_subtype == '' + let b:liquid_subtype = matchstr(&filetype,'^liquid\.\zs\w\+') + endif + if b:liquid_subtype == '' + let b:liquid_subtype = matchstr(substitute(expand('%:t'),'\c\%(\.liquid\)\+$','',''),'\.\zs\w\+$') + endif + if b:liquid_subtype == '' + let b:liquid_subtype = g:liquid_default_subtype + endif +endif + +if exists('b:liquid_subtype') && b:liquid_subtype != '' + exe 'runtime! syntax/'.b:liquid_subtype.'.vim' + unlet! b:current_syntax +endif + +syn case match + +if exists('b:liquid_subtype') && b:liquid_subtype != 'yaml' + " YAML Front Matter + syn include @liquidYamlTop syntax/yaml.vim + unlet! b:current_syntax + syn region liquidYamlHead start="\%^---$" end="^---\s*$" keepend contains=@liquidYamlTop,@Spell +endif + +if !exists('g:liquid_highlight_types') + let g:liquid_highlight_types = [] +endif + +if !exists('s:subtype') + let s:subtype = exists('b:liquid_subtype') ? b:liquid_subtype : '' + + for s:type in map(copy(g:liquid_highlight_types),'matchstr(v:val,"[^=]*$")') + if s:type =~ '\.' + let b:{matchstr(s:type,'[^.]*')}_subtype = matchstr(s:type,'\.\zs.*') + endif + exe 'syn include @liquidHighlight'.substitute(s:type,'\.','','g').' syntax/'.matchstr(s:type,'[^.]*').'.vim' + unlet! b:current_syntax + endfor + unlet! s:type + + if s:subtype == '' + unlet! b:liquid_subtype + else + let b:liquid_subtype = s:subtype + endif + unlet s:subtype +endif + +syn region liquidStatement matchgroup=liquidDelimiter start="{%" end="%}" contains=@liquidStatement containedin=ALLBUT,@liquidExempt keepend +syn region liquidExpression matchgroup=liquidDelimiter start="{{" end="}}" contains=@liquidExpression containedin=ALLBUT,@liquidExempt keepend +syn region liquidComment matchgroup=liquidDelimiter start="{%\s*comment\s*%}" end="{%\s*endcomment\s*%}" contains=liquidTodo,@Spell containedin=ALLBUT,@liquidExempt keepend + +syn cluster liquidExempt contains=liquidStatement,liquidExpression,liquidComment,@liquidStatement,liquidYamlHead +syn cluster liquidStatement contains=liquidConditional,liquidRepeat,liquidKeyword,@liquidExpression +syn cluster liquidExpression contains=liquidOperator,liquidString,liquidNumber,liquidFloat,liquidBoolean,liquidNull,liquidEmpty,liquidPipe,liquidForloop + +syn keyword liquidKeyword highlight nextgroup=liquidTypeHighlight skipwhite contained +syn keyword liquidKeyword endhighlight contained +syn region liquidHighlight start="{%\s*highlight\s\+\w\+\s*%}" end="{% endhighlight %}" keepend + +for s:type in g:liquid_highlight_types + exe 'syn match liquidTypeHighlight "\<'.matchstr(s:type,'[^=]*').'\>" contained' + exe 'syn region liquidHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' start="{%\s*highlight\s\+'.matchstr(s:type,'[^=]*').'\s*%}" end="{% endhighlight %}" keepend contains=@liquidHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\.','','g') +endfor +unlet! s:type + +syn region liquidString matchgroup=liquidQuote start=+"+ end=+"+ contained +syn region liquidString matchgroup=liquidQuote start=+'+ end=+'+ contained +syn match liquidNumber "-\=\<\d\+\>" contained +syn match liquidFloat "-\=\<\d\+\>\.\.\@!\%(\d\+\>\)\=" contained +syn keyword liquidBoolean true false contained +syn keyword liquidNull null nil contained +syn match liquidEmpty "\<empty\>" contained + +syn keyword liquidOperator and or not contained +syn match liquidPipe '|' contained skipwhite nextgroup=liquidFilter + +syn keyword liquidFilter date capitalize downcase upcase first last join sort size strip_html strip_newlines newline_to_br replace replace_first remove remove_first truncate truncatewords prepend append minus plus times divided_by contained + +syn keyword liquidConditional if elsif else endif unless endunless case when endcase ifchanged endifchanged contained +syn keyword liquidRepeat for endfor tablerow endtablerow in contained +syn match liquidRepeat "\%({%\s*\)\@<=empty\>" contained +syn keyword liquidKeyword assign cycle include with contained + +syn keyword liquidForloop forloop nextgroup=liquidForloopDot contained +syn match liquidForloopDot "\." nextgroup=liquidForloopAttribute contained +syn keyword liquidForloopAttribute length index index0 rindex rindex0 first last contained + +syn keyword liquidTablerowloop tablerowloop nextgroup=liquidTablerowloopDot contained +syn match liquidTablerowloopDot "\." nextgroup=liquidTableForloopAttribute contained +syn keyword liquidTablerowloopAttribute length index index0 col col0 index0 rindex rindex0 first last col_first col_last contained + +hi def link liquidDelimiter PreProc +hi def link liquidComment Comment +hi def link liquidTypeHighlight Type +hi def link liquidConditional Conditional +hi def link liquidRepeat Repeat +hi def link liquidKeyword Keyword +hi def link liquidOperator Operator +hi def link liquidString String +hi def link liquidQuote Delimiter +hi def link liquidNumber Number +hi def link liquidFloat Float +hi def link liquidEmpty liquidNull +hi def link liquidNull liquidBoolean +hi def link liquidBoolean Boolean +hi def link liquidFilter Function +hi def link liquidForloop Identifier +hi def link liquidForloopAttribute Identifier + +let b:current_syntax = 'liquid' + +if exists('main_syntax') && main_syntax == 'liquid' + unlet main_syntax +endif diff --git a/runtime/syntax/markdown.vim b/runtime/syntax/markdown.vim new file mode 100644 index 0000000000..4ec5dd5448 --- /dev/null +++ b/runtime/syntax/markdown.vim @@ -0,0 +1,105 @@ +" Vim syntax file +" Language: Markdown +" Maintainer: Tim Pope <vimNOSPAM@tpope.org> +" Filenames: *.markdown +" Last Change: 2010 May 21 + +if exists("b:current_syntax") + finish +endif + +runtime! syntax/html.vim +unlet! b:current_syntax + +syn sync minlines=10 +syn case ignore + +syn match markdownValid '[<>]\S\@!' +syn match markdownValid '&\%(#\=\w*;\)\@!' + +syn match markdownLineStart "^[<@]\@!" nextgroup=@markdownBlock + +syn cluster markdownBlock contains=markdownH1,markdownH2,markdownH3,markdownH4,markdownH5,markdownH6,markdownBlockquote,markdownListMarker,markdownOrderedListMarker,markdownCodeBlock,markdownRule +syn cluster markdownInline contains=markdownLineBreak,markdownLinkText,markdownItalic,markdownBold,markdownCode,markdownEscape,@htmlTop + +syn match markdownH1 ".\+\n=\+$" contained contains=@markdownInline,markdownHeadingRule +syn match markdownH2 ".\+\n-\+$" contained contains=@markdownInline,markdownHeadingRule + +syn match markdownHeadingRule "^[=-]\+$" contained + +syn region markdownH1 matchgroup=markdownHeadingDelimiter start="##\@!" end="#*\s*$" keepend oneline contains=@markdownInline contained +syn region markdownH2 matchgroup=markdownHeadingDelimiter start="###\@!" end="#*\s*$" keepend oneline contains=@markdownInline contained +syn region markdownH3 matchgroup=markdownHeadingDelimiter start="####\@!" end="#*\s*$" keepend oneline contains=@markdownInline contained +syn region markdownH4 matchgroup=markdownHeadingDelimiter start="#####\@!" end="#*\s*$" keepend oneline contains=@markdownInline contained +syn region markdownH5 matchgroup=markdownHeadingDelimiter start="######\@!" end="#*\s*$" keepend oneline contains=@markdownInline contained +syn region markdownH6 matchgroup=markdownHeadingDelimiter start="#######\@!" end="#*\s*$" keepend oneline contains=@markdownInline contained + +syn match markdownBlockquote ">\s" contained nextgroup=@markdownBlock + +syn region markdownCodeBlock start=" \|\t" end="$" contained + +" TODO: real nesting +syn match markdownListMarker " \{0,4\}[-*+]\%(\s\+\S\)\@=" contained +syn match markdownOrderedListMarker " \{0,4}\<\d\+\.\%(\s*\S\)\@=" contained + +syn match markdownRule "\* *\* *\*[ *]*$" contained +syn match markdownRule "- *- *-[ -]*$" contained + +syn match markdownLineBreak "\s\{2,\}$" + +syn region markdownIdDeclaration matchgroup=markdownLinkDelimiter start="^ \{0,3\}!\=\[" end="\]:" oneline keepend nextgroup=markdownUrl skipwhite +syn match markdownUrl "\S\+" nextgroup=markdownUrlTitle skipwhite contained +syn region markdownUrl matchgroup=markdownUrlDelimiter start="<" end=">" oneline keepend nextgroup=markdownUrlTitle skipwhite contained +syn region markdownUrlTitle matchgroup=markdownUrlTitleDelimiter start=+"+ end=+"+ keepend contained +syn region markdownUrlTitle matchgroup=markdownUrlTitleDelimiter start=+'+ end=+'+ keepend contained +syn region markdownUrlTitle matchgroup=markdownUrlTitleDelimiter start=+(+ end=+)+ keepend contained + +syn region markdownLinkText matchgroup=markdownLinkTextDelimiter start="!\=\[\%(\_[^]]*]\%( \=[[(]\)\)\@=" end="\]\%( \=[[(]\)\@=" keepend nextgroup=markdownLink,markdownId skipwhite contains=@markdownInline,markdownLineStart +syn region markdownLink matchgroup=markdownLinkDelimiter start="(" end=")" contains=markdownUrl keepend contained +syn region markdownId matchgroup=markdownIdDelimiter start="\[" end="\]" keepend contained +syn region markdownAutomaticLink matchgroup=markdownUrlDelimiter start="<\%(\w\+:\|[[:alnum:]_+-]\+@\)\@=" end=">" keepend oneline + +syn region markdownItalic start="\S\@<=\*\|\*\S\@=" end="\S\@<=\*\|\*\S\@=" keepend contains=markdownLineStart +syn region markdownItalic start="\S\@<=_\|_\S\@=" end="\S\@<=_\|_\S\@=" keepend contains=markdownLineStart +syn region markdownBold start="\S\@<=\*\*\|\*\*\S\@=" end="\S\@<=\*\*\|\*\*\S\@=" keepend contains=markdownLineStart +syn region markdownBold start="\S\@<=__\|__\S\@=" end="\S\@<=__\|__\S\@=" keepend contains=markdownLineStart +syn region markdownBoldItalic start="\S\@<=\*\*\*\|\*\*\*\S\@=" end="\S\@<=\*\*\*\|\*\*\*\S\@=" keepend contains=markdownLineStart +syn region markdownBoldItalic start="\S\@<=___\|___\S\@=" end="\S\@<=___\|___\S\@=" keepend contains=markdownLineStart +syn region markdownCode matchgroup=markdownCodeDelimiter start="`" end="`" transparent keepend contains=markdownLineStart +syn region markdownCode matchgroup=markdownCodeDelimiter start="`` \=" end=" \=``" keepend contains=markdownLineStart + +syn match markdownEscape "\\[][\\`*_{}()#+.!-]" + +hi def link markdownH1 htmlH1 +hi def link markdownH2 htmlH2 +hi def link markdownH3 htmlH3 +hi def link markdownH4 htmlH4 +hi def link markdownH5 htmlH5 +hi def link markdownH6 htmlH6 +hi def link markdownHeadingRule markdownRule +hi def link markdownHeadingDelimiter Delimiter +hi def link markdownOrderedListMarker markdownListMarker +hi def link markdownListMarker htmlTagName +hi def link markdownBlockquote Comment +hi def link markdownRule PreProc + +hi def link markdownLinkText htmlLink +hi def link markdownIdDeclaration Typedef +hi def link markdownId Type +hi def link markdownAutomaticLink markdownUrl +hi def link markdownUrl Float +hi def link markdownUrlTitle String +hi def link markdownIdDelimiter markdownLinkDelimiter +hi def link markdownUrlDelimiter htmlTag +hi def link markdownUrlTitleDelimiter Delimiter + +hi def link markdownItalic htmlItalic +hi def link markdownBold htmlBold +hi def link markdownBoldItalic htmlBoldItalic +hi def link markdownCodeDelimiter Delimiter + +hi def link markdownEscape Special + +let b:current_syntax = "markdown" + +" vim:set sw=2: diff --git a/runtime/syntax/sass.vim b/runtime/syntax/sass.vim index 1a2e7a450f..5bee495c04 100644 --- a/runtime/syntax/sass.vim +++ b/runtime/syntax/sass.vim @@ -1,7 +1,8 @@ " Vim syntax file " Language: Sass -" Maintainer: Tim Pope <vimNOSPAM@tpope.info> +" Maintainer: Tim Pope <vimNOSPAM@tpope.org> " Filenames: *.sass +" Last Change: 2010 May 21 if exists("b:current_syntax") finish @@ -15,9 +16,11 @@ syn cluster sassCssProperties contains=cssFontProp,cssFontDescriptorProp,cssColo syn cluster sassCssAttributes contains=css.*Attr,cssComment,cssValue.*,cssColor,cssURL,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssRenderProp syn match sassProperty "^\s*\zs\s\%([[:alnum:]-]\+:\|:[[:alnum:]-]\+\)"hs=s+1 contains=css.*Prop skipwhite nextgroup=sassCssAttribute +syn match sassProperty "^\s*\zs\s\%(:\=[[:alnum:]-]\+\s*=\)"hs=s+1 contains=css.*Prop skipwhite nextgroup=sassScript syn match sassCssAttribute ".*$" contained contains=@sassCssAttributes,sassConstant +syn match sassScript ".*$" contained contains=@sassCssAttributes,sassConstant syn match sassConstant "![[:alnum:]_-]\+" -syn match sassConstantAssignment "\%(![[:alnum:]_]\+\s*\)\@<==" nextgroup=sassCssAttribute skipwhite +syn match sassConstantAssignment "\%(![[:alnum:]_]\+\s*\)\@<=\%(||\)\==" nextgroup=sassScript skipwhite syn match sassMixin "^=.*" syn match sassMixing "^\s\+\zs+.*" @@ -32,6 +35,9 @@ syn match sassAmpersand "&" " TODO: Arithmetic (including strings and concatenation) syn region sassInclude start="@import" end=";\|$" contains=cssComment,cssURL,cssUnicodeEscape,cssMediaType +syn region sassDebugLine matchgroup=sassDebug start="@debug\>" end="$" contains=@sassCssAttributes,sassConstant +syn region sassControlLine matchgroup=sassControl start="@\%(if\|else\%(\s\+if\)\=\|while\|for\)\>" end="$" contains=sassFor,@sassCssAttributes,sassConstant +syn keyword sassFor from to through contained syn keyword sassTodo FIXME NOTE TODO OPTIMIZE XXX contained syn region sassComment start="^\z(\s*\)//" end="^\%(\z1 \)\@!" contains=sassTodo @@ -44,6 +50,9 @@ hi def link sassMixing PreProc hi def link sassMixin PreProc hi def link sassTodo Todo hi def link sassInclude Include +hi def link sassDebug Debug +hi def link sassControl PreProc +hi def link sassFor PreProc hi def link sassEscape Special hi def link sassIdChar Special hi def link sassClassChar Special -- GitLab