From 8bccd07972523936fe536fdade22d2f72eab3ef0 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 15 Jul 2025 22:48:15 +0200 Subject: [PATCH] vim-patch:9.1.1549: filetype: pkl files are not recognized Problem: filetype: pkl files are not recognized Solution: detect *.pkl files as pkl filetype, include a filetype plugin (Riley Bruins) References: https://pkl-lang.org/ https://github.com/apple/pkl closes: vim/vim#17751 https://github.com/vim/vim/commit/d128889b306680338dbfb54ccc1ff32dc114165d Co-authored-by: Riley Bruins --- runtime/ftplugin/pkl.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/pkl.vim diff --git a/runtime/ftplugin/pkl.vim b/runtime/ftplugin/pkl.vim new file mode 100644 index 0000000000..52cf6b8b44 --- /dev/null +++ b/runtime/ftplugin/pkl.vim @@ -0,0 +1,14 @@ +" Vim filetype plugin +" Language: Pkl +" Maintainer: Riley Bruins +" Last Change: 2025 Jul 14 + +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 = 'setl com< cms<' diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 73d56228b2..da9f263ab3 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -949,6 +949,7 @@ local extension = { pike = 'pike', pmod = 'pike', rcp = 'pilrc', + pkl = 'pkl', PL = detect.pl, pli = 'pli', pl1 = 'pli', diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 4f6df1600b..adc5f2aaf6 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -602,6 +602,7 @@ func s:GetFilenameChecks() abort \ 'pilrc': ['file.rcp'], \ 'pine': ['.pinerc', 'pinerc', '.pinercex', 'pinercex'], \ 'pinfo': ['/etc/pinforc', '/.pinforc', 'any/.pinforc', 'any/etc/pinforc'], + \ 'pkl': ['file.pkl'], \ 'pli': ['file.pli', 'file.pl1'], \ 'plm': ['file.plm', 'file.p36', 'file.pac'], \ 'plp': ['file.plp'],