commit bae3a9c565c18d80ebcd92372dde4aa28dd0d80d parent d17814a5e000cb54be33696d833e027bf32abfb9 Author: Sebastian <sebastian@sebsite.pw> Date: Tue, 22 Feb 2022 18:47:02 -0500 Improve indent script Signed-off-by: Sebastian <sebastian@sebsite.pw> Diffstat:
M | indent/hare.vim | | | 10 | +++++++++- |
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/indent/hare.vim b/indent/hare.vim @@ -82,8 +82,16 @@ function! GetHareIndent() return FloorCindent(v:lnum) - shiftwidth() end + let l:indent = FloorCindent(v:lnum) + + " If a normal cindent would indent the same amount as the previous line, + " deindent by one shiftwidth. This fixes some issues with `case let` blocks. + if l:indent == indent(prevlnum) + return l:indent - shiftwidth() + endif + " Otherwise, do a normal cindent. - return FloorCindent(v:lnum) + return l:indent endif " Indent the body of a case.