diff options
Diffstat (limited to 'indent')
-rw-r--r-- | indent/crystal.vim | 6 | ||||
-rw-r--r-- | indent/julia.vim | 18 |
2 files changed, 7 insertions, 17 deletions
diff --git a/indent/crystal.vim b/indent/crystal.vim index 66eeef42..96cdd586 100644 --- a/indent/crystal.vim +++ b/indent/crystal.vim @@ -42,7 +42,7 @@ function GetCrystalIndent(...) let clnum = a:0 ? a:1 : v:lnum " Set up variables for restoring position in file - let vcol = col(clnum) + let vcol = col('.') " Work on the current line {{{2 " ------------------------ @@ -170,7 +170,7 @@ function GetCrystalIndent(...) " " If it contained hanging closing brackets, find the rightmost one, find its " match and indent according to that. - if line =~# '[[({]' || line =~# '[])}]\s*\%(#.*\)\=$' + if line =~# '[[({]' || line =~# '[])]\s*\%(#.*\)\=$' let [opening, closing] = crystal#indent#ExtraBrackets(lnum) if opening.pos != -1 @@ -186,7 +186,7 @@ function GetCrystalIndent(...) endif elseif closing.pos != -1 call cursor(lnum, closing.pos + 1) - normal! % + keepjumps normal! % if crystal#indent#Match(line('.'), g:crystal#indent#crystal_indent_keywords) return indent('.') + s:sw() diff --git a/indent/julia.vim b/indent/julia.vim index 97dd7bc6..59cd7d80 100644 --- a/indent/julia.vim +++ b/indent/julia.vim @@ -370,23 +370,13 @@ function GetJuliaIndent() " Analyse the reference line let [num_open_blocks, num_closed_blocks] = GetJuliaNestingStruct(lnum, st, lim) - - " Increase indentation for each newly opened block - " in the reference line - while num_open_blocks > 0 - let ind += &sw - let num_open_blocks -= 1 - endwhile + " Increase indentation for each newly opened block in the reference line + let ind += shiftwidth() * num_open_blocks " Analyse the current line let [num_open_blocks, num_closed_blocks] = GetJuliaNestingStruct(v:lnum) - - " Decrease indentation for each closed block - " in the current line - while num_closed_blocks > 0 - let ind -= &sw - let num_closed_blocks -= 1 - endwhile + " Decrease indentation for each closed block in the current line + let ind -= shiftwidth() * num_closed_blocks return ind endfunction |