diff options
| author | Adam Stankiewicz <sheerun@sher.pl> | 2016-07-19 10:09:54 +0200 | 
|---|---|---|
| committer | Adam Stankiewicz <sheerun@sher.pl> | 2016-07-19 10:09:54 +0200 | 
| commit | 11f34624aa32ac72dc65e46ea9badb4b16a0edd1 (patch) | |
| tree | 63c50a215fe4a67e4223c19b4b1dbb9747c14ffd /indent | |
| parent | 1422f7a75ce0b382d601238c5979b04473b9021e (diff) | |
| download | vim-polyglot-11f34624aa32ac72dc65e46ea9badb4b16a0edd1.tar.gz vim-polyglot-11f34624aa32ac72dc65e46ea9badb4b16a0edd1.zip | |
Updatev2.11.3
Diffstat (limited to '')
| -rw-r--r-- | indent/blade.vim | 24 | ||||
| -rw-r--r-- | indent/clojure.vim | 32 | ||||
| -rw-r--r-- | indent/ember-script.vim | 6 | ||||
| -rw-r--r-- | indent/emblem.vim | 6 | ||||
| -rw-r--r-- | indent/rust.vim | 5 | 
5 files changed, 51 insertions, 22 deletions
| diff --git a/indent/blade.vim b/indent/blade.vim index d578a432..97f7f293 100644 --- a/indent/blade.vim +++ b/indent/blade.vim @@ -18,9 +18,18 @@ unlet! b:did_indent  let b:did_indent = 1 +" Doesn't include 'foreach' and 'forelse' because these already get matched by 'for'. +let s:directives_start = 'if\|else\|unless\|for\|while\|empty\|push\|section\|can\|hasSection\|verbatim' +let s:directives_end = 'else\|end\|empty\|show\|stop\|append\|overwrite' + +if exists('g:blade_custom_directives_pairs') +    let s:directives_start .= '\|' . join(keys(g:blade_custom_directives_pairs), '\|') +    let s:directives_end .= '\|' . join(values(g:blade_custom_directives_pairs), '\|') +endif +  setlocal autoindent  setlocal indentexpr=GetBladeIndent() -setlocal indentkeys=o,O,*<Return>,<>>,!^F,=@else,=@end,=@empty,=@show,=@stop +exe "setlocal indentkeys=o,O,<>>,!^F,0=}},0=!!},=@" . substitute(s:directives_end, '\\|', ',=@', 'g')  " Only define the function once.  if exists("*GetBladeIndent") @@ -36,18 +45,21 @@ function! GetBladeIndent()      let line = substitute(substitute(getline(lnum), '\s\+$', '', ''), '^\s\+', '', '')      let cline = substitute(substitute(getline(v:lnum), '\s\+$', '', ''), '^\s\+', '', '')      let indent = indent(lnum) -    if cline =~# '@\%(else\|elseif\|empty\|end\|show\|stop\)' || +    if cline =~# '@\%(' . s:directives_end . '\)' ||                  \ cline =~# '\%(<?.*\)\@<!?>\|\%({{.*\)\@<!}}\|\%({!!.*\)\@<!!!}'          let indent = indent - &sw -    elseif line =~# '<?\%(.*?>\)\@!' +    elseif line =~# '<?\%(.*?>\)\@!\|@php\%(\s*(\)\@!'          let indent = indent + &sw      else          if exists("*GetBladeIndentCustom")              let hindent = GetBladeIndentCustom() -        elseif searchpair('@include\s*(', '', ')', 'bWr') || +        " Don't use PHP indentation if line is a comment +        elseif line !~# '^\s*\%(#\|//\)\|\*/\s*$' && ( +                    \ searchpair('@include\%(If\)\?\s*(', '', ')', 'bWr') ||                      \ searchpair('{!!', '', '!!}', 'bWr') ||                      \ searchpair('{{', '', '}}', 'bWr') || -                    \ searchpair('<?', '', '?>', 'bWr') +                    \ searchpair('<?', '', '?>', 'bWr') || +                    \ searchpair('@php\%(\s*(\)\@!', '', '@endphp', 'bWr') )              execute 'let hindent = ' . s:phpindent          else              execute 'let hindent = ' . s:htmlindent @@ -60,7 +72,7 @@ function! GetBladeIndent()      if line =~# '@\%(section\)\%(.*@end\)\@!' && line !~# '@\%(section\)\s*([^,]*)'          return indent -    elseif line =~# '@\%(if\|elseif\|else\|unless\|foreach\|forelse\|for\|while\|empty\|push\|section\|can\|hasSection\)\%(.*@end\|.*@stop\)\@!' || +    elseif line =~# '@\%(' . s:directives_start . '\)\%(.*@end\|.*@stop\)\@!' ||                  \ line =~# '{{\%(.*}}\)\@!' || line =~# '{!!\%(.*!!}\)\@!'          return increase      else diff --git a/indent/clojure.vim b/indent/clojure.vim index cb8c050b..1d474d8e 100644 --- a/indent/clojure.vim +++ b/indent/clojure.vim @@ -1,14 +1,14 @@  if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'clojure') == -1  " Vim indent file -" Language:	Clojure -" Author:	Meikel Brandmeyer <mb@kotka.de> -" URL:		http://kotka.de/projects/clojure/vimclojure.html +" Language:     Clojure +" Author:       Meikel Brandmeyer <mb@kotka.de> +" URL:          http://kotka.de/projects/clojure/vimclojure.html  " -" Maintainer:	Sung Pae <self@sungpae.com> -" URL:		https://github.com/guns/vim-clojure-static -" License:	Same as Vim -" Last Change:	%%RELEASE_DATE%% +" Maintainer:   Sung Pae <self@sungpae.com> +" URL:          https://github.com/guns/vim-clojure-static +" License:      Same as Vim +" Last Change:  %%RELEASE_DATE%%  if exists("b:did_indent")  	finish @@ -79,8 +79,8 @@ if exists("*searchpairpos")  	" patterns.  	function! s:match_one(patterns, string)  		let list = type(a:patterns) == type([]) -			   \ ? a:patterns -			   \ : map(split(a:patterns, ','), '"^" . v:val . "$"') +		           \ ? a:patterns +		           \ : map(split(a:patterns, ','), '"^" . v:val . "$"')  		for pat in list  			if a:string =~# pat | return 1 | endif  		endfor @@ -189,6 +189,16 @@ if exists("*searchpairpos")  		return val  	endfunction +	" Check if form is a reader conditional, that is, it is prefixed by #? +	" or @#? +	function! s:is_reader_conditional_special_case(position) +		if getline(a:position[0])[a:position[1] - 3 : a:position[1] - 2] == "#?" +			return 1 +		endif + +		return 0 +	endfunction +  	" Returns 1 for opening brackets, -1 for _anything else_.  	function! s:bracket_type(char)  		return stridx('([{', a:char) > -1 ? 1 : -1 @@ -256,6 +266,10 @@ if exists("*searchpairpos")  			return [paren[0], paren[1] + &shiftwidth - 1]  		endif +		if s:is_reader_conditional_special_case(paren) +			return paren +		endif +  		" In case we are at the last character, we use the paren position.  		if col("$") - 1 == paren[1]  			return paren diff --git a/indent/ember-script.vim b/indent/ember-script.vim index 29a0daf0..8d76823d 100644 --- a/indent/ember-script.vim +++ b/indent/ember-script.vim @@ -3,9 +3,9 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'emberscript') =  " Language:    ember-script  " Maintainer:  Yulij Andreevich Lesov <yalesov@gmail.com>>  " URL:         http://github.com/yalesov/vim-ember-script -" Version:     1.0.3 -" Last Change: 2016 Jul 5 -" License:     GPL-3.0 +" Version:     1.0.4 +" Last Change: 2016 Jul 6 +" License:     ISC  if exists('b:did_indent')    finish diff --git a/indent/emblem.vim b/indent/emblem.vim index 54bab60b..6538baca 100644 --- a/indent/emblem.vim +++ b/indent/emblem.vim @@ -3,8 +3,8 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'emblem') == -1  " Language:    emblem  " Maintainer:  Yulij Andreevich Lesov <yalesov@gmail.com>  " URL:         http://github.com/yalesov/vim-emblem -" Version:     2.0.0 -" Last Change: 2016 Jul 5 -" License:     GPL-3.0 +" Version:     2.0.1 +" Last Change: 2016 Jul 6 +" License:     ISC  endif diff --git a/indent/rust.vim b/indent/rust.vim index 0a3c3344..fec789de 100644 --- a/indent/rust.vim +++ b/indent/rust.vim @@ -3,7 +3,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1  " Vim indent file  " Language:         Rust  " Author:           Chris Morgan <me@chrismorgan.info> -" Last Change:      2014 Sep 13 +" Last Change:      2016 Jul 15  " Only load this indent file when no other was loaded.  if exists("b:did_indent") @@ -134,6 +134,7 @@ function GetRustIndent(lnum)  				\ && s:get_line_trimmed(a:lnum) !~ '^\s*[\[\]{}]'  				\ && prevline !~ '^\s*fn\s'  				\ && prevline !~ '([^()]\+,$' +				\ && s:get_line_trimmed(a:lnum) !~ '^\s*\S\+\s*=>'  		" Oh ho! The previous line ended in a comma! I bet cindent will try to  		" take this too far... For now, let's normally use the previous line's  		" indent. @@ -158,6 +159,8 @@ function GetRustIndent(lnum)  		" if baz && (foo ||  		"            bar) {  		" +		" Another case is when the current line is a new match arm. +		"  		" There are probably other cases where we don't want to do this as  		" well. Add them as needed.  		return indent(prevlinenum) | 
