@@ -4,7 +4,7 @@ vim9script
44# Language: Odin
55# Maintainer: Maxim Kim
<[email protected] > 66# Website: https: // github.com /habamax/ vim - odin
7- # Last Change: 2024 - 01 - 15
7+ # Last Change: 2025 - 10 - 15
88
99if exists (" b:did_indent" )
1010 finish
@@ -14,7 +14,7 @@ b:did_indent = 1
1414b: undo_indent = ' setlocal cindent< cinoptions< cinkeys< indentexpr<'
1515
1616setlocal cindent
17- setlocal cinoptions = L0,m1,(s ,j1,J1,l1,+ 0 ,:0 ,#1
17+ setlocal cinoptions = L0,m1,(s ,j1,J1,l1,+ 0 ,:0 ,#3
1818setlocal cinkeys = 0 {,0 },0 ),0 ],! ^F,:,o ,O
1919
2020setlocal indentexpr = GetOdinIndent (v: lnum )
@@ -67,22 +67,22 @@ def GetOdinIndent(lnum: number): number
6767 else
6868 indent = pindent
6969 endif
70- elseif pline = ~ ' switch\s.*{\s*$'
70+ elseif pline = ~ ' \< switch\> \s.*{\s*$'
7171 indent = pindent
72- elseif pline = ~ ' case\s*.*,\s*\(//.*\)\?$' # https: // github.com /habamax/ vim - odin/issues/ 8
73- indent = pindent + matchstr (pline, ' case\s*' )- >strcharlen ()
74- elseif line = ~ ' ^\s*case\s\+.*,\s*$'
72+ elseif pline = ~ ' \< case\> \s*.*,\s*\(//.*\)\?$' # https: // github.com /habamax/ vim - odin/issues/ 8
73+ indent = pindent + matchstr (pline, ' \< case\s*' )- >strcharlen ()
74+ elseif line = ~ ' ^\s*case\>\ s\+.*,\s*$'
7575 indent = pindent - shiftwidth ()
76- elseif pline = ~ ' case\s*.*:\s*\(//.*\)\?$'
77- if line !~ ' ^\s*}\s*$' && line !~ ' ^\s*case[[:space:]:]'
76+ elseif pline = ~ ' \< case\> \s*.*:\s*\(//.*\)\?$'
77+ if line !~ ' ^\s*}\s*$' && line !~ ' ^\s*case\> [[:space:]:]'
7878 indent = pindent + shiftwidth ()
7979 endif
8080 elseif pline = ~ ' ^\s*@.*' && line !~ ' ^\s*}'
8181 indent = pindent
8282 elseif pline = ~ ' :[:=].*}\s*$'
8383 indent = pindent
8484 elseif pline = ~ ' ^\s*}\s*$'
85- if line !~ ' ^\s*}' && line !~ ' case\s*.*:\s*$'
85+ if line !~ ' ^\s*}' && line !~ ' \< case\> \s*.*:\s*$'
8686 indent = pindent
8787 else
8888 indent = pindent - shiftwidth ()
@@ -96,7 +96,7 @@ def GetOdinIndent(lnum: number): number
9696 if plnum < 1
9797 break
9898 endif
99- if getline (idx) = ~ ' ^\s*case\s.*,\s*$'
99+ if getline (idx) = ~ ' ^\s*case\>\ s.*,\s*$'
100100 indent = indent (idx) + shiftwidth ()
101101 break
102102 endif
0 commit comments