diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2014-07-29 13:03:49 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2014-07-29 13:03:49 +0200 |
commit | 5f1223fbc5285689db812236c9100329740a805b (patch) | |
tree | 58bc6f11540011afb25826c96f65fa35f5687291 /indent | |
parent | a59f644d49ee029df48586a6c3c358858f1e6739 (diff) | |
download | vim-polyglot-1.9.2.tar.gz vim-polyglot-1.9.2.zip |
Major updatev1.9.2
Diffstat (limited to 'indent')
-rw-r--r-- | indent/haskell.vim | 2 | ||||
-rw-r--r-- | indent/jade.vim | 2 | ||||
-rw-r--r-- | indent/ruby.vim | 23 | ||||
-rw-r--r-- | indent/scala.vim | 1 |
4 files changed, 22 insertions, 6 deletions
diff --git a/indent/haskell.vim b/indent/haskell.vim index c584e940..1d741032 100644 --- a/indent/haskell.vim +++ b/indent/haskell.vim @@ -68,7 +68,7 @@ function! HIndent(lnum) endif endif - if prevl =~ '\Wof\s*$' || prevl =~ '\Wdo\s*$' + if prevl =~ '\Wof\s*$' || prevl =~ '\Wm\=do\s*$' return previ + &sw endif diff --git a/indent/jade.vim b/indent/jade.vim index 12b9e2ed..8cfa656d 100644 --- a/indent/jade.vim +++ b/indent/jade.vim @@ -60,7 +60,7 @@ function! GetJadeIndent() return increase elseif line =~? '^\v%('.g:jade_self_closing_tags.')>' return indent - elseif group =~? '\v^%(jadeAttributesDelimiter|jadeClass|jadeId|htmlTagName|htmlSpecialTagName|jadeFilter)$' + elseif group =~? '\v^%(jadeAttributesDelimiter|jadeClass|jadeId|htmlTagName|htmlSpecialTagName|jadeFilter|jadeTagBlockChar)$' return increase else return indent diff --git a/indent/ruby.vim b/indent/ruby.vim index 2a571bd2..f2059982 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -90,13 +90,20 @@ let s:end_skip_expr = s:skip_expr . let s:non_bracket_continuation_regex = '\%([\\.,:*/%+]\|\<and\|\<or\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\)\s*\%(#.*\)\=$' " Regex that defines continuation lines. -" TODO: this needs to deal with if ...: and so on let s:continuation_regex = \ '\%(%\@<![({[\\.,:*/%+]\|\<and\|\<or\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\)\s*\%(#.*\)\=$' +" Regex that defines continuable keywords +let s:continuable_regex = + \ '\C\%(^\s*\|[=,*/%+\-|;{]\|<<\|>>\|:\s\)\s*\zs' . + \ '\<\%(if\|for\|while\|until\|unless\):\@!\>' + " Regex that defines bracket continuations let s:bracket_continuation_regex = '%\@<!\%([({[]\)\s*\%(#.*\)\=$' +" Regex that defines end of bracket continuation followed by another continuation +let s:bracket_switch_continuation_regex = '^\([^(]\+\zs).\+\)\+'.s:continuation_regex + " Regex that defines the first part of a splat pattern let s:splat_regex = '[[,(]\s*\*\s*\%(#.*\)\=$' @@ -488,6 +495,10 @@ function GetRubyIndent(...) endif endif + if s:Match(lnum, s:continuable_regex) && s:Match(lnum, s:continuation_regex) + return indent(s:GetMSL(lnum)) + &sw + &sw + endif + " 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 @@ -575,10 +586,14 @@ function GetRubyIndent(...) let p_lnum = lnum let lnum = s:GetMSL(lnum) - " If the previous line wasn't a MSL and is continuation return its indent. - " TODO: the || s:IsInString() thing worries me a bit. + " If the previous line wasn't a MSL. if p_lnum != lnum - if s:Match(p_lnum, s:non_bracket_continuation_regex) || s:IsInString(p_lnum,strlen(line)) + " If previous line ends bracket and begins non-bracket continuation decrease indent by 1. + if s:Match(p_lnum, s:bracket_switch_continuation_regex) + return ind - 1 + " If previous line is a continuation return its indent. + " TODO: the || s:IsInString() thing worries me a bit. + elseif s:Match(p_lnum, s:non_bracket_continuation_regex) || s:IsInString(p_lnum,strlen(line)) return ind endif endif diff --git a/indent/scala.vim b/indent/scala.vim index c9dc639e..4053a83c 100644 --- a/indent/scala.vim +++ b/indent/scala.vim @@ -15,6 +15,7 @@ setlocal autoindent setlocal softtabstop=2 setlocal tabstop=2 setlocal shiftwidth=2 +setlocal expandtab if exists("*GetScalaIndent") finish |