From 4faad4a950c68689166f0d6ecf5694cb04a9b589 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 15 Jun 2024 10:07:36 +0200 Subject: [PATCH] vim-patch:9.1.0486: filetype: Snakemake files are not recognized Problem: filetype: Snakemake files are not recognized Solution: Detect '*.smk' and Snakefile files as snakemake filetype (Riley Bruins) See: https://snakemake.readthedocs.io/en/stable/snakefiles/deployment.html#distribution-and-reproducibility closes: vim/vim#14992 https://github.com/vim/vim/commit/82a579e15ad78f4b99d2957300da3076ccc7d378 Co-authored-by: Riley Bruins Co-authored-by: zeertzjq --- runtime/ftplugin/snakemake.vim | 13 +++++++++++++ runtime/lua/vim/filetype.lua | 2 ++ test/old/testdir/test_filetype.vim | 1 + 3 files changed, 16 insertions(+) create mode 100644 runtime/ftplugin/snakemake.vim diff --git a/runtime/ftplugin/snakemake.vim b/runtime/ftplugin/snakemake.vim new file mode 100644 index 0000000000..ab90ca10b5 --- /dev/null +++ b/runtime/ftplugin/snakemake.vim @@ -0,0 +1,13 @@ +" Vim filetype plugin +" Language: snakemake +" Maintainer: Riley Bruins +" Last Change: 2024 Jun 13 + +if exists('b:did_ftplugin') + finish +endif +let b:did_ftplugin = 1 + +setl comments=:# commentstring=#\ %s + +let b:undo_ftplugin = 'setl com< cms<' diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index cc2fbe0cec..2bb50d8c0b 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -985,6 +985,7 @@ local extension = { smt = 'smith', smithy = 'smithy', sml = 'sml', + smk = 'snakemake', spt = 'snobol4', sno = 'snobol4', sln = 'solution', @@ -1620,6 +1621,7 @@ local filename = { ['/etc/slp.spi'] = 'slpspi', ['.slrnrc'] = 'slrnrc', ['sendmail.cf'] = 'sm', + Snakefile = 'snakemake', ['.sqlite_history'] = 'sql', ['squid.conf'] = 'squid', ['ssh_config'] = 'sshconfig', diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index fa62765398..8bbda1dc99 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -670,6 +670,7 @@ func s:GetFilenameChecks() abort \ 'smith': ['file.smt', 'file.smith'], \ 'smithy': ['file.smithy'], \ 'sml': ['file.sml'], + \ 'snakemake': ['file.smk', 'Snakefile'], \ 'snobol4': ['file.sno', 'file.spt'], \ 'solidity': ['file.sol'], \ 'solution': ['file.sln'],