summaryrefslogtreecommitdiffstats
path: root/indent/ocaml.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2021-01-01 17:09:30 +0100
committerAdam Stankiewicz <sheerun@sher.pl>2021-01-01 17:09:30 +0100
commita81756029291d6e21295687515a3e58499c19b33 (patch)
tree81142fd6640ad9de3b38b7cb0e4bd798a6db86e0 /indent/ocaml.vim
parent1f4236df3aaaec797e81572fd120a9d49d4035b9 (diff)
downloadvim-polyglot-a81756029291d6e21295687515a3e58499c19b33.tar.gz
vim-polyglot-a81756029291d6e21295687515a3e58499c19b33.zip
Add support for gleam, closes #655
Co-authored-by: Jeff Kreeftmeijer <jeffkreeftmeijer@gmail.com>
Diffstat (limited to 'indent/ocaml.vim')
-rw-r--r--indent/ocaml.vim14
1 files changed, 7 insertions, 7 deletions
diff --git a/indent/ocaml.vim b/indent/ocaml.vim
index d67f3e36..c902d8db 100644
--- a/indent/ocaml.vim
+++ b/indent/ocaml.vim
@@ -7,8 +7,8 @@ endif
" Maintainers: Jean-Francois Yuen <jfyuen@happycoders.org>
" 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
+" URL: https://github.com/ocaml/vim-ocaml
+" 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)
@@ -106,7 +106,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)
@@ -177,7 +177,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':
@@ -204,14 +204,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*;;'
@@ -268,7 +268,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