summaryrefslogtreecommitdiff
path: root/runtime/indent/ocaml.vim
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/indent/ocaml.vim')
-rw-r--r--runtime/indent/ocaml.vim12
1 files changed, 6 insertions, 6 deletions
diff --git a/runtime/indent/ocaml.vim b/runtime/indent/ocaml.vim
index 3bd65c63f..8fe9de3d6 100644
--- a/runtime/indent/ocaml.vim
+++ b/runtime/indent/ocaml.vim
@@ -4,7 +4,7 @@
" Mike Leary <leary@nwlink.com>
" Markus Mottl <markus.mottl@gmail.com>
" URL: http://www.ocaml.info/vim/indent/ocaml.vim
-" Last Change: 2013 Jun 29
+" Last Change: 2017 Jun 13
" 2005 Jun 25 - Fixed multiple bugs due to 'else\nreturn ind' working
" 2005 May 09 - Added an option to not indent OCaml-indents specially (MM)
" 2013 June - commented textwidth (Marc Weber)
@@ -101,7 +101,7 @@ function! GetOCamlIndent()
" Return double 'shiftwidth' after lines matching:
if lline =~ '^\s*|.*->\s*$'
- return ind + &sw + &sw
+ return ind + 2 * shiftwidth()
endif
let line = getline(v:lnum)
@@ -172,7 +172,7 @@ function! GetOCamlIndent()
" Indent if current line begins with 'and':
elseif line =~ '^\s*and\>'
if lline !~ '^\s*\(and\|let\|type\)\>\|\<end\s*$'
- return ind - &sw
+ return ind - shiftwidth()
endif
" Indent if current line begins with 'with':
@@ -199,14 +199,14 @@ function! GetOCamlIndent()
" or 'method':
elseif line =~ '^\s*\(constraint\|inherit\|initializer\|method\)\>'
if lline !~ s:obj
- return indent(search('\<\(object\|object\s*(.*)\)\s*$', 'bW')) + &sw
+ return indent(search('\<\(object\|object\s*(.*)\)\s*$', 'bW')) + shiftwidth()
endif
endif
" Add a 'shiftwidth' after lines ending with:
if lline =~ '\(:\|=\|->\|<-\|(\|\[\|{\|{<\|\[|\|\[<\|\<\(begin\|do\|else\|fun\|function\|functor\|if\|initializer\|object\|parser\|private\|sig\|struct\|then\|try\)\|\<object\s*(.*)\)\s*$'
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
" Back to normal indent after lines ending with ';;':
elseif lline =~ ';;\s*$' && lline !~ '^\s*;;'
@@ -263,7 +263,7 @@ function! GetOCamlIndent()
" Subtract a 'shiftwidth' after lines matching 'match ... with parser':
if lline =~ '\<match\>.*\<with\>\s*\<parser\s*$'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
return ind