runtime(odin): fix indent for mis-identified case statements

Commit: 
https://github.com/vim/vim/commit/a30cf0b3ace613e216b7ae248b657b281de9f21c
Author: Maxim Kim <[email protected]>
Date:   Thu Oct 16 18:53:19 2025 +0000

    runtime(odin): fix indent for mis-identified case statements
    
    related: habamax/vim-odinhttps://github.com/vim/vim/issues/11
    closes: https://github.com/vim/vim/issues/18578
    
    Signed-off-by: Maxim Kim <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/runtime/indent/odin.vim b/runtime/indent/odin.vim
index e3318c4d6..50284f4ca 100644
--- a/runtime/indent/odin.vim
+++ b/runtime/indent/odin.vim
@@ -4,7 +4,7 @@ vim9script
 # Language: Odin
 # Maintainer: Maxim Kim <[email protected]>
 # Website: https://github.com/habamax/vim-odin
-# Last Change: 2024-01-15
+# Last Change: 2025-10-15
 
 if exists("b:did_indent")
     finish
@@ -14,7 +14,7 @@ b:did_indent = 1
 b:undo_indent = 'setlocal cindent< cinoptions< cinkeys< indentexpr<'
 
 setlocal cindent
-setlocal cinoptions=L0,m1,(s,j1,J1,l1,+0,:0,#1
+setlocal cinoptions=L0,m1,(s,j1,J1,l1,+0,:0,#3
 setlocal cinkeys=0{,0},0),0],!^F,:,o,O
 
 setlocal indentexpr=GetOdinIndent(v:lnum)
@@ -67,14 +67,14 @@ def GetOdinIndent(lnum: number): number
         else
             indent = pindent
         endif
-    elseif pline =~ 'switch\s.*{\s*$'
+    elseif pline =~ '\<switch\>\s.*{\s*$'
         indent = pindent
-    elseif pline =~ 'case\s*.*,\s*\(//.*\)\?$' # 
https://github.com/habamax/vim-odin/issues/8
-        indent = pindent + matchstr(pline, 'case\s*')->strcharlen()
-    elseif line =~ '^\s*case\s\+.*,\s*$'
+    elseif pline =~ '\<case\>\s*.*,\s*\(//.*\)\?$' # 
https://github.com/habamax/vim-odin/issues/8
+        indent = pindent + matchstr(pline, '\<case\s*')->strcharlen()
+    elseif line =~ '^\s*case\>\s\+.*,\s*$'
         indent = pindent - shiftwidth()
-    elseif pline =~ 'case\s*.*:\s*\(//.*\)\?$'
-        if line !~ '^\s*}\s*$' && line !~ '^\s*case[[:space:]:]'
+    elseif pline =~ '\<case\>\s*.*:\s*\(//.*\)\?$'
+        if line !~ '^\s*}\s*$' && line !~ '^\s*case\>[[:space:]:]'
             indent = pindent + shiftwidth()
         endif
     elseif pline =~ '^\s*@.*' && line !~ '^\s*}'
@@ -82,7 +82,7 @@ def GetOdinIndent(lnum: number): number
     elseif pline =~ ':[:=].*}\s*$'
         indent = pindent
     elseif pline =~ '^\s*}\s*$'
-        if line !~ '^\s*}' && line !~ 'case\s*.*:\s*$'
+        if line !~ '^\s*}' && line !~ '\<case\>\s*.*:\s*$'
             indent = pindent
         else
             indent = pindent - shiftwidth()
@@ -96,7 +96,7 @@ def GetOdinIndent(lnum: number): number
             if plnum < 1
                 break
             endif
-            if getline(idx) =~ '^\s*case\s.*,\s*$'
+            if getline(idx) =~ '^\s*case\>\s.*,\s*$'
                 indent = indent(idx) + shiftwidth()
                 break
             endif

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1v9TCp-001HtZ-Hi%40256bit.org.

Raspunde prin e-mail lui