runtime(odin): update indent and syntax scripts

- fix indent of a closing } after another } on previous line
- fix indent of consequent #+feature lines
- highlight #+features

closes: #19310

Signed-off-by: Maxim Kim <habamax@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Maxim Kim
2026-02-02 10:16:36 +00:00
committed by Christian Brabandt
parent f39e7a89f3
commit c50be218cd
2 changed files with 7 additions and 4 deletions
+5 -3
View File
@@ -4,7 +4,7 @@ vim9script
# Language: Odin
# Maintainer: Maxim Kim <habamax@gmail.com>
# Website: https://github.com/habamax/vim-odin
# Last Change: 2025-10-15
# Last Change: 2026-02-02
if exists("b:did_indent")
finish
@@ -61,7 +61,9 @@ def GetOdinIndent(lnum: number): number
var indent = cindent(lnum)
var line = getline(lnum)
if line =~ '^\s*#\k\+'
if line =~ '^\s*#+\k'
indent = pindent
elseif line =~ '^\s*#\k\+'
if pline =~ '[{:]\s*$'
indent = pindent + shiftwidth()
else
@@ -79,7 +81,7 @@ def GetOdinIndent(lnum: number): number
endif
elseif pline =~ '^\s*@.*' && line !~ '^\s*}'
indent = pindent
elseif pline =~ ':[:=].*}\s*$'
elseif pline =~ ':[:=].*}\s*$' && line !~ '^\s*}'
indent = pindent
elseif pline =~ '^\s*}\s*$'
if line !~ '^\s*}' && line !~ '\<case\>\s*.*:\s*$'
+2 -1
View File
@@ -4,7 +4,7 @@ vim9script
# Language: Odin
# Maintainer: Maxim Kim <habamax@gmail.com>
# Website: https://github.com/habamax/vim-odin
# Last Change: 2025-12-06
# Last Change: 2026-02-02
if exists("b:current_syntax")
finish
@@ -64,6 +64,7 @@ syntax match odinAddressOf "&" display
syntax match odinDeref "\^" display
syntax match odinMacro "#\<\w\+\>" display
syntax region odinFeature matchgroup=odinMacro start="#+\<\w\+\>" end="$" oneline display
syntax match odinTemplate "$\<\w\+\>"