commit 8bccd07972523936fe536fdade22d2f72eab3ef0
parent 4195b82ec9ed9c7c573bbcaaa642c5ab3c9f9167
Author: Christian Clason <c.clason@uni-graz.at>
Date: Tue, 15 Jul 2025 22:48:15 +0200
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 <ribru17@hotmail.com>
Diffstat:
3 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/runtime/ftplugin/pkl.vim b/runtime/ftplugin/pkl.vim
@@ -0,0 +1,14 @@
+" Vim filetype plugin
+" Language: Pkl
+" Maintainer: Riley Bruins <ribru17@gmail.com>
+" 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
@@ -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
@@ -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'],