diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2021-01-01 17:09:30 +0100 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2021-01-01 17:09:30 +0100 |
commit | a81756029291d6e21295687515a3e58499c19b33 (patch) | |
tree | 81142fd6640ad9de3b38b7cb0e4bd798a6db86e0 /indent | |
parent | 1f4236df3aaaec797e81572fd120a9d49d4035b9 (diff) | |
download | vim-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')
-rw-r--r-- | indent/dune.vim | 3 | ||||
-rw-r--r-- | indent/ocaml.vim | 14 |
2 files changed, 10 insertions, 7 deletions
diff --git a/indent/dune.vim b/indent/dune.vim index e39aa7a2..0a658da4 100644 --- a/indent/dune.vim +++ b/indent/dune.vim @@ -4,6 +4,9 @@ endif " Vim indent file " Language: dune +" Maintainers: Markus Mottl <markus.mottl@gmail.com> +" URL: https://github.com/ocaml/vim-ocaml +" Last Change: 2020 Dec 31 if exists("b:did_indent") finish 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 |