diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2014-12-09 23:09:20 +0100 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2014-12-09 23:09:20 +0100 |
commit | 4071c094c69ba8ef716f8048cac8415fc7d96e26 (patch) | |
tree | ccf17bae58ed7655d62a7bce6104f31480976dc6 /indent/eruby.vim | |
parent | 617b01a5b6aa3cadb25b2ff8639e330cfc6cf3c1 (diff) | |
download | vim-polyglot-1.10.4.tar.gz vim-polyglot-1.10.4.zip |
Updatev1.10.4
Diffstat (limited to 'indent/eruby.vim')
-rw-r--r-- | indent/eruby.vim | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/indent/eruby.vim b/indent/eruby.vim index 5f323857..5028fe06 100644 --- a/indent/eruby.vim +++ b/indent/eruby.vim @@ -42,6 +42,13 @@ if exists("*GetErubyIndent") endif function! GetErubyIndent(...) + " The value of a single shift-width + if exists('*shiftwidth') + let sw = shiftwidth() + else + let sw = &sw + endif + if a:0 && a:1 == '.' let v:lnum = line('.') elseif a:0 && a:1 =~ '^\d' @@ -70,24 +77,24 @@ function! GetErubyIndent(...) let line = getline(lnum) let cline = getline(v:lnum) if cline =~# '^\s*<%[-=]\=\s*\%(}\|end\|else\|\%(ensure\|rescue\|elsif\|when\).\{-\}\)\s*\%([-=]\=%>\|$\)' - let ind = ind - &sw + let ind = ind - sw endif if line =~# '\S\s*<%[-=]\=\s*\%(}\|end\).\{-\}\s*\%([-=]\=%>\|$\)' - let ind = ind - &sw + let ind = ind - sw endif if line =~# '\%({\|\<do\)\%(\s*|[^|]*|\)\=\s*[-=]\=%>' - let ind = ind + &sw + let ind = ind + sw elseif line =~# '<%[-=]\=\s*\%(module\|class\|def\|if\|for\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure\|rescue\)\>.*%>' - let ind = ind + &sw + let ind = ind + sw endif if line =~# '^\s*<%[=#-]\=\s*$' && cline !~# '^\s*end\>' - let ind = ind + &sw + let ind = ind + sw endif if line !~# '^\s*<%' && line =~# '%>\s*$' - let ind = ind - &sw + let ind = ind - sw endif if cline =~# '^\s*[-=]\=%>\s*$' - let ind = ind - &sw + let ind = ind - sw endif return ind endfunction |