summaryrefslogtreecommitdiff
path: root/support
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-06-17 15:57:30 -0700
committerOri Bernstein <ori@eigenstate.org>2015-06-17 15:57:30 -0700
commitc7b5ad4772e5ad2183d24f6ae9ffde85dfdc42dd (patch)
tree9ced8ce6b00b650d15f31382151fc29971066c12 /support
parentedd9a39b5350d707c1e0ff5d171766175a182886 (diff)
downloadmc-c7b5ad4772e5ad2183d24f6ae9ffde85dfdc42dd.tar.gz
Fix up indent script.
Diffstat (limited to 'support')
-rw-r--r--support/vim/indent/myr.vim8
1 files changed, 4 insertions, 4 deletions
diff --git a/support/vim/indent/myr.vim b/support/vim/indent/myr.vim
index d53111c..2dbadfe 100644
--- a/support/vim/indent/myr.vim
+++ b/support/vim/indent/myr.vim
@@ -24,7 +24,7 @@ function! s:CountMatches(line, lnum, pats)
while idx >= 0
let idx = match(a:line, p, idx)
if idx >= 0
- let ic = Quoted(a:lnum, idx)
+ let ic = Quoted(a:lnum, idx+1)
if !ic
let matches = matches + 1
endif
@@ -67,8 +67,8 @@ function! GetMyrIndent(ln)
\ '\<struct\>', '\<union\>',
\ '{', '\[', '(', '^\s*|', '=\s*$']
let outpat = ['}', ']', '(', ';;']
- let outalone = ['\<else\>', '\<elif\>.*',
- \ '}.*', '].*', ').*', ';;', '|.*']
+ let outalone = ['\<else\>', '\<elif\>.*', ';;', '|.*',
+ \ '].*', ').*', '}.*']
let width = &tabstop
let n_in = s:CountMatches(prevln, ln - i, inpat)
@@ -84,7 +84,7 @@ function! GetMyrIndent(ln)
endif
" avoid double counting outdents that are also outalone
- if n_out > 0 && s:LineMatch(prevln, outalone) != 0
+ if s:CountMatches(curln, ln, inpat) == 0 && s:LineMatch(prevln, outalone) != 0
let n_out = n_out - 1
endif
let n_out = n_out + s:LineMatch(curln, outalone)