From 47237cb27a2224ccd0e0c58527f39ae2e2e9a810 Mon Sep 17 00:00:00 2001 From: YohananDiamond Date: Sun, 13 Jun 2021 16:57:42 -0300 Subject: [PATCH] Fixed indentation on empty brackets with trailing comma/colon I'm not fully sure if this fixes, it. Still experimenting. --- indent/zig.vim | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/indent/zig.vim b/indent/zig.vim index 560edf4..0f56031 100644 --- a/indent/zig.vim +++ b/indent/zig.vim @@ -49,19 +49,12 @@ function! GetZigIndent(lnum) " }, " }; " try treat them the same as a } - if prevLine =~ '\v^\s*},$' - if currentLine =~ '\v^\s*};$' || currentLine =~ '\v^\s*}$' + if prevLine =~ '\v^\s*}\s*[,;]\s*$' + if currentLine =~ '\v^\s*}\s*[,;]?\s*$' return indent(prevLineNum) - 4 endif return indent(prevLineNum-1) - 4 endif - if currentLine =~ '\v^\s*},$' - return indent(prevLineNum) - 4 - endif - if currentLine =~ '\v^\s*};$' - return indent(prevLineNum) - 4 - endif - " cindent doesn't handle this case correctly: " switch (1): {