From d6be2b33125d6706779beed7f8e83015bdff9396 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 6 Dec 2025 20:02:16 +0800 Subject: [PATCH] vim-patch:9.1.1957: filetype: bpftrace files are not recognized (#36838) Problem: filetype: bpftrace files are not recognized Solution: Detect *.bt files as btftrace filetype, include a btftrace filetype plugin (Stanislaw Gruszka) closes: vim/vim#18866 https://github.com/vim/vim/commit/b60b33a9dc91569f803e5a4856244bd8414f1802 Co-authored-by: Stanislaw Gruszka --- runtime/ftplugin/bpftrace.vim | 14 ++++++++++++++ runtime/lua/vim/filetype.lua | 1 + test/old/testdir/test_filetype.vim | 1 + 3 files changed, 16 insertions(+) create mode 100644 runtime/ftplugin/bpftrace.vim diff --git a/runtime/ftplugin/bpftrace.vim b/runtime/ftplugin/bpftrace.vim new file mode 100644 index 0000000000..b9ad1d13c1 --- /dev/null +++ b/runtime/ftplugin/bpftrace.vim @@ -0,0 +1,14 @@ +" Vim filetype plugin +" Language: bpftrace +" Maintainer: Stanislaw Gruszka +" Last Change: 2025 Dec 05 + +if exists('b:did_ftplugin') + finish +endif +let b:did_ftplugin = 1 + +setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// +setlocal commentstring=//\ %s + +let b:undo_ftplugin = "setlocal comments< commentstring<" diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 9074084f2c..9230ece5d3 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -267,6 +267,7 @@ local extension = { bl = 'blank', blp = 'blueprint', bp = 'bp', + bt = 'bpftrace', bs = 'brighterscript', brs = 'brightscript', bsd = 'bsdl', diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 0093da2d6e..4a1aaf854e 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -148,6 +148,7 @@ func s:GetFilenameChecks() abort \ 'blank': ['file.bl'], \ 'blueprint': ['file.blp'], \ 'bp': ['Android.bp'], + \ 'bpftrace': ['file.bt'], \ 'brighterscript': ['file.bs'], \ 'brightscript': ['file.brs'], \ 'bsdl': ['file.bsd', 'file.bsdl'],