diff options
author | Bram Moolenaar <Bram@vim.org> | 2013-06-01 14:50:56 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2013-06-01 14:50:56 +0200 |
commit | 543b7ef7000d08d77409478315d68b607bb8bad8 (patch) | |
tree | 387cd45294ce55a130556d4e22a0b7706156b1fd /runtime/indent | |
parent | 3737fc1c30a559c82c57b5ce6aedae76cbeabaef (diff) |
Updated runtime files and translations.
Diffstat (limited to 'runtime/indent')
-rw-r--r-- | runtime/indent/cucumber.vim | 36 | ||||
-rw-r--r-- | runtime/indent/gitconfig.vim | 2 | ||||
-rw-r--r-- | runtime/indent/haml.vim | 4 | ||||
-rw-r--r-- | runtime/indent/liquid.vim | 2 | ||||
-rw-r--r-- | runtime/indent/perl.vim | 41 | ||||
-rw-r--r-- | runtime/indent/perl6.vim | 22 | ||||
-rw-r--r-- | runtime/indent/sass.vim | 7 |
7 files changed, 63 insertions, 51 deletions
diff --git a/runtime/indent/cucumber.vim b/runtime/indent/cucumber.vim index a19d123f7e..965c7786ed 100644 --- a/runtime/indent/cucumber.vim +++ b/runtime/indent/cucumber.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Cucumber " Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2010 May 21 +" Last Change: 2013 May 30 if exists("b:did_indent") finish @@ -12,6 +12,8 @@ setlocal autoindent setlocal indentexpr=GetCucumberIndent() setlocal indentkeys=o,O,*<Return>,<:>,0<Bar>,0#,=,!^F +let b:undo_indent = 'setl ai< inde< indk<' + " Only define the function once. if exists("*GetCucumberIndent") finish @@ -24,35 +26,47 @@ endfunction function! GetCucumberIndent() let line = getline(prevnonblank(v:lnum-1)) let cline = getline(v:lnum) + let nline = getline(nextnonblank(v:lnum+1)) let syn = s:syn(prevnonblank(v:lnum-1)) let csyn = s:syn(v:lnum) + let nsyn = s:syn(nextnonblank(v:lnum+1)) if csyn ==# 'cucumberFeature' || cline =~# '^\s*Feature:' + " feature heading return 0 elseif csyn ==# 'cucumberExamples' || cline =~# '^\s*\%(Examples\|Scenarios\):' + " examples heading return 2 * &sw elseif csyn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || cline =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):' + " background, scenario or outline heading return &sw elseif syn ==# 'cucumberFeature' || line =~# '^\s*Feature:' + " line after feature heading return &sw elseif syn ==# 'cucumberExamples' || line =~# '^\s*\%(Examples\|Scenarios\):' + " line after examples heading return 3 * &sw elseif syn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || line =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):' + " line after background, scenario or outline heading return 2 * &sw - elseif cline =~# '^\s*@' && (s:syn(nextnonblank(v:lnum+1)) == 'cucumberFeature' || getline(nextnonblank(v:lnum+1)) =~# '^\s*Feature:' || indent(prevnonblank(v:lnum-1)) <= 0) + elseif cline =~# '^\s*[@#]' && (nsyn == 'cucumberFeature' || nline =~# '^\s*Feature:' || indent(prevnonblank(v:lnum-1)) <= 0) + " tag or comment before a feature heading return 0 - elseif line =~# '^\s*@' + elseif cline =~# '^\s*@' + " other tags return &sw - elseif cline =~# '^\s*|' && line =~# '^\s*|' + elseif cline =~# '^\s*[#|]' && line =~# '^\s*|' + " mid-table + " preserve indent return indent(prevnonblank(v:lnum-1)) - elseif cline =~# '^\s*|' && line =~# '^\s*[^|#]' + elseif cline =~# '^\s*|' && line =~# '^\s*[^|]' + " first line of a table, relative indent return indent(prevnonblank(v:lnum-1)) + &sw - elseif cline =~# '^\s*[^|# \t]' && line =~# '^\s*|' + elseif cline =~# '^\s*[^|]' && line =~# '^\s*|' + " line after a table, relative unindent return indent(prevnonblank(v:lnum-1)) - &sw - elseif cline =~# '^\s*$' && line =~# '^\s*|' - let in = indent(prevnonblank(v:lnum-1)) - return in == indent(v:lnum) ? in : in - &sw - elseif cline =~# '^\s*#' && getline(v:lnum-1) =~ '^\s*$' && getline(v:lnum+1) =~# '\S' - return indent(getline(v:lnum+1)) + elseif cline =~# '^\s*#' && getline(v:lnum-1) =~ '^\s*$' && (nsyn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || nline =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):') + " comments on scenarios + return &sw endif return indent(prevnonblank(v:lnum-1)) endfunction diff --git a/runtime/indent/gitconfig.vim b/runtime/indent/gitconfig.vim index 8eece5d309..7d5d44b779 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: 2012 April 7 +" Last Change: 2013 May 30 if exists("b:did_indent") finish diff --git a/runtime/indent/haml.vim b/runtime/indent/haml.vim index 58c0307204..c47a8a59c7 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.org> -" Last Change: 2010 May 21 +" Last Change: 2013 May 30 if exists("b:did_indent") finish @@ -23,7 +23,7 @@ let s:attributes = '\%({.\{-\}}\|\[.\{-\}\]\)' let s:tag = '\%([%.#][[:alnum:]_-]\+\|'.s:attributes.'\)*[<>]*' if !exists('g:haml_self_closing_tags') - let g:haml_self_closing_tags = 'meta|link|img|hr|br' + let g:haml_self_closing_tags = 'base|link|meta|br|hr|img|input' endif function! GetHamlIndent() diff --git a/runtime/indent/liquid.vim b/runtime/indent/liquid.vim index df43f40cc4..01e7223696 100644 --- a/runtime/indent/liquid.vim +++ b/runtime/indent/liquid.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Liquid " Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2012 May 07 +" Last Change: 2013 May 30 if exists('b:did_indent') finish diff --git a/runtime/indent/perl.vim b/runtime/indent/perl.vim index 1fbc4ded9e..ccdbeceaef 100644 --- a/runtime/indent/perl.vim +++ b/runtime/indent/perl.vim @@ -1,8 +1,9 @@ " Vim indent file -" Language: Perl 5 -" Author: Andy Lester <andy@petdance.com> -" URL: http://github.com/petdance/vim-perl/tree/master -" Last Change: June 3, 2009 +" Language: Perl 5 +" Maintainer: vim-perl <vim-perl@googlegroups.com> +" Homepage: http://github.com/vim-perl/vim-perl +" Bugs/requests: http://github.com/vim-perl/vim-perl/issues +" Last Change: May 12, 2013 " Suggestions and improvements by : " Aaron J. Sherman (use syntax for hints) @@ -11,9 +12,9 @@ " TODO things that are not or not properly indented (yet) : " - Continued statements " print "foo", -" "bar"; +" "bar"; " print "foo" -" if bar(); +" if bar(); " - Multiline regular expressions (m//x) " (The following probably needs modifying the perl syntax file) " - qw() lists @@ -34,15 +35,10 @@ if !b:indent_use_syntax setlocal indentkeys+=0=EO endif -" Only define the function once. -if exists("*GetPerlIndent") - finish -endif - let s:cpo_save = &cpo set cpo-=C -function GetPerlIndent() +function! GetPerlIndent() " Get the line to be indented let cline = getline(v:lnum) @@ -52,7 +48,7 @@ function GetPerlIndent() return 0 endif - " Don't reindent coments on first column + " Don't reindent comments on first column if cline =~ '^#.' return 0 endif @@ -124,7 +120,12 @@ function GetPerlIndent() " Indent blocks enclosed by {}, (), or [] if b:indent_use_syntax " Find a real opening brace - let bracepos = match(line, '[(){}\[\]]', matchend(line, '^\s*[)}\]]')) + " NOTE: Unlike Perl character classes, we do NOT need to escape the + " closing brackets with a backslash. Doing so just puts a backslash + " in the character class and causes sorrow. Instead, put the closing + " bracket as the first character in the class. + let braceclass = '[][(){}]' + let bracepos = match(line, braceclass, matchend(line, '^\s*[])}]')) while bracepos != -1 let synid = synIDattr(synID(lnum, bracepos + 1, 0), "name") " If the brace is highlighted in one of those groups, indent it. @@ -133,7 +134,7 @@ function GetPerlIndent() \ || synid == "perlMatchStartEnd" \ || synid == "perlHereDoc" \ || synid =~ "^perlFiledescStatement" - \ || synid =~ '^perl\(Sub\|Block\)Fold' + \ || synid =~ '^perl\(Sub\|Block\|Package\)Fold' let brace = strpart(line, bracepos, 1) if brace == '(' || brace == '{' || brace == '[' let ind = ind + &sw @@ -141,22 +142,22 @@ function GetPerlIndent() let ind = ind - &sw endif endif - let bracepos = match(line, '[(){}\[\]]', bracepos + 1) + let bracepos = match(line, braceclass, bracepos + 1) endwhile - let bracepos = matchend(cline, '^\s*[)}\]]') + let bracepos = matchend(cline, '^\s*[])}]') if bracepos != -1 let synid = synIDattr(synID(v:lnum, bracepos, 0), "name") if synid == "" \ || synid == "perlMatchStartEnd" - \ || synid =~ '^perl\(Sub\|Block\)Fold' + \ || synid =~ '^perl\(Sub\|Block\|Package\)Fold' let ind = ind - &sw endif endif else - if line =~ '[{\[(]\s*\(#[^)}\]]*\)\=$' + if line =~ '[{[(]\s*\(#[^])}]*\)\=$' let ind = ind + &sw endif - if cline =~ '^\s*[)}\]]' + if cline =~ '^\s*[])}]' let ind = ind - &sw endif endif diff --git a/runtime/indent/perl6.vim b/runtime/indent/perl6.vim index 75159e3a3a..60ee640b16 100644 --- a/runtime/indent/perl6.vim +++ b/runtime/indent/perl6.vim @@ -1,12 +1,13 @@ " Vim indent file -" Language: Perl 6 -" Maintainer: Andy Lester <andy@petdance.com> -" URL: http://github.com/petdance/vim-perl/tree/master -" Last Change: 2009-07-04 -" Contributors: Andy Lester <andy@petdance.com> -" Hinrik Örn Sigurðsson <hinrik.sig@gmail.com> +" Language: Perl 6 +" Maintainer: vim-perl <vim-perl@googlegroups.com> +" Homepage: http://github.com/vim-perl/vim-perl +" Bugs/requests: http://github.com/vim-perl/vim-perl/issues +" Last Change: 2013-05-12 +" Contributors: Andy Lester <andy@petdance.com> +" Hinrik Örn Sigurðsson <hinrik.sig@gmail.com> " -" Adapted from Perl indent file by Rafael Garcia-Suarez <rgarciasuarez@free.fr> +" Adapted from indent/perl.vim by Rafael Garcia-Suarez <rgarciasuarez@free.fr> " Suggestions and improvements by : " Aaron J. Sherman (use syntax for hints) @@ -46,15 +47,10 @@ if !b:indent_use_syntax setlocal indentkeys+=0=EO endif -" Only define the function once. -if exists("*GetPerl6Indent") - finish -endif - let s:cpo_save = &cpo set cpo-=C -function GetPerl6Indent() +function! GetPerl6Indent() " Get the line to be indented let cline = getline(v:lnum) diff --git a/runtime/indent/sass.vim b/runtime/indent/sass.vim index 4622f00ff8..b6e2e66e8a 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.org> -" Last Change: 2010 May 21 +" Last Change: 2013 May 30 if exists("b:did_indent") finish @@ -17,7 +17,8 @@ if exists("*GetSassIndent") finish endif -let s:property = '^\s*:\|^\s*[[:alnum:]-]\+\%(:\|\s*=\)' +let s:property = '^\s*:\|^\s*[[:alnum:]#{}-]\+\%(:\|\s*=\)' +let s:extend = '^\s*\%(@extend\|@include\|+\)' function! GetSassIndent() let lnum = prevnonblank(v:lnum-1) @@ -27,7 +28,7 @@ function! GetSassIndent() let line = substitute(line,'^\s\+','','') let indent = indent(lnum) let cindent = indent(v:lnum) - if line !~ s:property && cline =~ s:property + if line !~ s:property && line !~ s:extend && cline =~ s:property return indent + &sw "elseif line =~ s:property && cline !~ s:property "return indent - &sw |