]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0551: filetype: Tolk files are not recognized v9.2.0551
authorredavy <hello.redavy@proton.me>
Thu, 28 May 2026 20:32:36 +0000 (20:32 +0000)
committerChristian Brabandt <cb@256bit.org>
Thu, 28 May 2026 20:36:04 +0000 (20:36 +0000)
Problem:  filetype: Tolk files are not recognized
Solution: Detect *.tolk files as tolk filetype, include a syntax and
          filetype plugin (redavy)

Tolk is a new-generation language for writing smart contracts on TON
blockchain, which is #1 in speed among other chains.

Reference:
https://docs.ton.org/blockchain-basics/tolk/overview

closes: #20320

Signed-off-by: redavy <hello.redavy@proton.me>
Signed-off-by: Christian Brabandt <cb@256bit.org>
.github/MAINTAINERS
runtime/autoload/dist/ft.vim
runtime/ftplugin/tolk.vim [new file with mode: 0644]
runtime/syntax/tolk.vim [new file with mode: 0644]
src/testdir/test_filetype.vim
src/version.c

index d73c7f10d748c98769d8d7e5de18cecd67e25f8a..614dd13e216004793fa5d023e6c714366c5b5832 100644 (file)
@@ -339,6 +339,7 @@ runtime/ftplugin/thrift.vim                         @jiangyinzuo
 runtime/ftplugin/tiasm.vim                             @Freed-Wu
 runtime/ftplugin/tidy.vim                              @dkearns
 runtime/ftplugin/tmux.vim                              @ericpruitt
+runtime/ftplugin/tolk.vim                              @redavy
 runtime/ftplugin/toml.vim                              @averms
 runtime/ftplugin/tt2html.vim                           @petdance
 runtime/ftplugin/twig.vim                              @ribru17
@@ -700,6 +701,7 @@ runtime/syntax/thrift.vim                           @jiangyinzuo
 runtime/syntax/tiasm.vim                               @Freed-Wu
 runtime/syntax/tidy.vim                                        @dkearns
 runtime/syntax/tmux.vim                                        @ericpruitt
+runtime/syntax/tolk.vim                                        @redavy
 runtime/syntax/toml.vim                                        @averms
 runtime/syntax/tt2.vim                                 @petdance
 runtime/syntax/tt2html.vim                             @petdance
index f7d42d7f9917b6d9d603b0322ed1ade1dae563f1..3b585b61d238199134ed03932239719483c8ee93 100644 (file)
@@ -3,7 +3,7 @@ vim9script
 # Vim functions for file type detection
 #
 # Maintainer:          The Vim Project <https://github.com/vim/vim>
-# Last Change:         2026 May 18
+# Last Change:         2026 May 28
 # Former Maintainer:   Bram Moolenaar <Bram@vim.org>
 
 # These functions are moved here from runtime/filetype.vim to make startup
@@ -2743,6 +2743,8 @@ const ft_from_ext = {
   "sieve": "sieve",
   # TriG
   "trig": "trig",
+  # Tolk
+  "tolk": "tolk",
   # Zig and Zig Object Notation (ZON)
   "zig": "zig",
   "zon": "zig",
diff --git a/runtime/ftplugin/tolk.vim b/runtime/ftplugin/tolk.vim
new file mode 100644 (file)
index 0000000..f1339b7
--- /dev/null
@@ -0,0 +1,22 @@
+" Vim filetype plugin file
+" Language:     Tolk
+" Maintainer:   redavy <hello.redavy@proton.me>
+" Upstream:     https://github.com/redavy/vim-tolk
+" Last Update:  24 May 2026
+
+if exists("b:did_ftplugin")
+  finish
+endif
+let b:did_ftplugin = 1
+
+setlocal commentstring=//\ %s
+
+if get(g:, 'tolk_recommended_style', get(g:, 'recommended_style', 1))
+  setlocal tabstop=2
+  setlocal shiftwidth=2
+  setlocal expandtab
+  setlocal softtabstop=2
+  setlocal cindent
+endif
+
+let b:undo_ftplugin = "setlocal commentstring< tabstop< shiftwidth< expandtab< softtabstop< cindent<"
diff --git a/runtime/syntax/tolk.vim b/runtime/syntax/tolk.vim
new file mode 100644 (file)
index 0000000..ce3ffc6
--- /dev/null
@@ -0,0 +1,37 @@
+" Vim syntax file
+" Language:     Tolk
+" Maintainer:   redavy <hello.redavy@proton.me>
+" Upstream:     https://github.com/redavy/vim-tolk
+" Last Update:  28 May 2026
+
+if exists("b:current_syntax")
+  finish
+endif
+
+" Keywords
+syn keyword tolkKeyword  do if as fun asm get try var val lazy
+syn keyword tolkKeyword  else enum true tolk const false throw
+syn keyword tolkKeyword  redef while catch return assert import
+syn keyword tolkKeyword  global repeat contract mutate struct
+syn keyword tolkKeyword  match type null void never
+
+" Strings
+syn region tolkString  start=+"+ end=+"+
+syn region tolkString  start=+'+ end=+'+
+
+" Numbers
+syn match tolkNumber  "\<[0-9]\+\>"
+syn match tolkNumber  "\<0[xX][0-9a-fA-F]\+\>"
+syn match tolkNumber  "\<[0-9]\+\.[0-9]\+\>"
+
+" Comments
+syn match  tolkComment  "//.*$"
+syn region tolkComment  start="/\*" end="\*/"
+
+" Highlights
+hi link tolkKeyword    Keyword
+hi link tolkString     String
+hi link tolkNumber     Number
+hi link tolkComment    Comment
+
+let b:current_syntax = "tolk"
index 23651f44b4bf2be5e0e71f4e220833ad84c3ec46..aefdef1b57aba301c5a70913ac4c4ed51fbb33de 100644 (file)
@@ -904,6 +904,7 @@ def s:GetFilenameChecks(): dict<list<string>>
     tla: ['file.tla'],
     tli: ['file.tli'],
     tmux: ['tmuxfile.conf', '.tmuxfile.conf', '.tmux-file.conf', '.tmux.conf', 'tmux-file.conf', 'tmux.conf', 'tmux.conf.local'],
+    tolk: ['file.tolk'],
     toml: ['file.toml', 'uv.lock', 'Gopkg.lock', 'Pipfile', '/home/user/.cargo/config', '.black',
            'any/containers/containers.conf', 'any/containers/containers.conf.d/file.conf',
            'any/containers/containers.conf.modules/file.conf', 'any/containers/containers.conf.modules/any/file.conf',
index bf1c31fc28c7c7ced05940353e520fffdaf23375..85fa5595ca4b138b378c6e5a135daadadba734ec 100644 (file)
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    551,
 /**/
     550,
 /**/