Commit: runtime(odin): support underscore-separated numeric literals

1 view
Skip to first unread message

Christian Brabandt

unread,
Dec 6, 2025, 4:45:45 AM (yesterday) Dec 6
to vim...@googlegroups.com
runtime(odin): support underscore-separated numeric literals

Commit: https://github.com/vim/vim/commit/c7c16e4130c665fa6abd0c46ac305be61e467c2b
Author: Maxim Kim <hab...@gmail.com>
Date: Sat Dec 6 10:36:30 2025 +0100

runtime(odin): support underscore-separated numeric literals

Add support for underscore-separated numeric literals in Odin syntax
highlighting. This allows proper highlighting of numbers like 1_000_000,
0xFF_AA_BB, and 0b1010_1111 as specified in the Odin language.

> Numerical literals are written similar to most other programming
> languages. A useful feature in Odin is that underscores are allowed
> for better readability: 1_000_000_000 (one billion).
> https://odin-lang.org/docs/overview/#numbers

closes: #18852

Signed-off-by: Maxim Kim <hab...@gmail.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/runtime/syntax/odin.vim b/runtime/syntax/odin.vim
index 7f6b0ba65..41d6ca1c4 100644
--- a/runtime/syntax/odin.vim
+++ b/runtime/syntax/odin.vim
@@ -4,7 +4,7 @@ vim9script
# Language: Odin
# Maintainer: Maxim Kim <hab...@gmail.com>
# Website: https://github.com/habamax/vim-odin
-# Last Change: 2025-03-28
+# Last Change: 2025-12-06

if exists("b:current_syntax")
finish
@@ -53,12 +53,12 @@ syntax region odinAttribute
\ start="@\ze(" end="\ze)"
\ transparent oneline

-syntax match odinInteger "\-\?\<\d\+\>" display
-syntax match odinFloat "\-\?\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\%([eE][+-]\=[0-9_]\+\)\=" display
-syntax match odinHex "\<0[xX][0-9A-Fa-f]\+\>" display
-syntax match odinDoz "\<0[zZ][0-9a-bA-B]\+\>" display
-syntax match odinOct "\<0[oO][0-7]\+\>" display
-syntax match odinBin "\<0[bB][01]\+\>" display
+syntax match odinInteger " -?<[0-9]+%(_[0-9]+)*>" display
+syntax match odinFloat " -?<[0-9]+%(_[0-9]+)*%(\.[0-9]+%(_[0-9]+)*)%([eE][+-]=[0-9]+%(_[0-9]+)*)=" display
+syntax match odinHex " <0[xX][0-9A-Fa-f]+%(_[0-9A-Fa-f]+)*>" display
+syntax match odinDoz " <0[zZ][0-9A-Ba-b]+%(_[0-9A-Ba-b]+)*>" display
+syntax match odinOct " <0[oO][0-7]+%(_[0-7]+)*>" display
+syntax match odinBin " <0[bB][01]+%(_[01]+)*>" display

syntax match odinAddressOf "&" display
syntax match odinDeref "\^" display
Reply all
Reply to author
Forward
0 new messages