summaryrefslogtreecommitdiffstats
path: root/indent/eelixir.vim
diff options
context:
space:
mode:
Diffstat (limited to 'indent/eelixir.vim')
-rw-r--r--indent/eelixir.vim19
1 files changed, 12 insertions, 7 deletions
diff --git a/indent/eelixir.vim b/indent/eelixir.vim
index d9538425..b80edc98 100644
--- a/indent/eelixir.vim
+++ b/indent/eelixir.vim
@@ -8,6 +8,9 @@ runtime! indent/elixir.vim
unlet! b:did_indent
setlocal indentexpr=
+let s:cpo_save = &cpo
+set cpo&vim
+
if exists("b:eelixir_subtype")
exe "runtime! indent/".b:eelixir_subtype.".vim"
else
@@ -53,19 +56,21 @@ function! GetEelixirIndent(...)
let line = getline(lnum)
let cline = getline(v:lnum)
if cline =~# '^\s*<%\s*\%(end\|else\|elsif\|catch\|after\|rescue\)\>.*%>'
- let ind = ind - &sw
+ let ind -= &sw
elseif line =~# '\S\s*<%\s*end\s*%>'
- let ind = ind - &sw
+ let ind -= &sw
endif
- if line =~# '<%[=%]\=\s*.*\<do\s*%>'
- let ind = ind + &sw
- elseif line =~# '<%\s*\%(else\|elsif\|catch\|after\|rescue\)\>.*%>'
- let ind = ind + &sw
+ if line =~# '<%[=%]\=\s*.*\(\<do\|->\)\s*%>' ||
+ \ line =~# '<%\s*\%(else\|elsif\|catch\|after\|rescue\)\>.*%>'
+ let ind += &sw
endif
if cline =~# '^\s*%>\s*$'
- let ind = ind - &sw
+ let ind -= &sw
endif
return ind
endfunction
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
endif