From a81756029291d6e21295687515a3e58499c19b33 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Fri, 1 Jan 2021 17:09:30 +0100 Subject: Add support for gleam, closes #655 Co-authored-by: Jeff Kreeftmeijer --- indent/dune.vim | 3 +++ indent/ocaml.vim | 14 +++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'indent') 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 +" 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 " Mike Leary " Markus Mottl -" 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\)\>\|\' 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\)\|\.*\\s*\