From 0abaccb2a795c40cd7f55b9a19fe6ecb765479e2 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 5 Jul 2024 21:39:51 +0200 Subject: [PATCH] vim-patch:9.1.0532: filetype: Cedar files not recognized Problem: filetype: Cedar files not recognized Solution: Detect '*.cedar' files as cedar filetype (Riley Bruins) References: https://github.com/cedar-policy closes: vim/vim#15148 https://github.com/vim/vim/commit/15addb24dd3b2645f5c04d2742ab5eb53444a3a0 Co-authored-by: Riley Bruins --- runtime/ftplugin/cedar.vim | 13 +++++++++++++ runtime/lua/vim/filetype.lua | 1 + test/old/testdir/test_filetype.vim | 1 + 3 files changed, 15 insertions(+) create mode 100644 runtime/ftplugin/cedar.vim diff --git a/runtime/ftplugin/cedar.vim b/runtime/ftplugin/cedar.vim new file mode 100644 index 0000000000..74a1903b46 --- /dev/null +++ b/runtime/ftplugin/cedar.vim @@ -0,0 +1,13 @@ +" Vim filetype plugin +" Language: Cedar +" Maintainer: Riley Bruins +" Last Change: 2024 Jul 4 + +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 6d3fc48efc..d2cf87bea5 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -261,6 +261,7 @@ local extension = { cdc = 'cdc', cdl = 'cdl', toc = detect_line1('\\contentsline', 'tex', 'cdrtoc'), + cedar = 'cedar', cfc = 'cf', cfm = 'cf', cfi = 'cf', diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index da312ded8a..5675068c71 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -143,6 +143,7 @@ func s:GetFilenameChecks() abort \ 'cdl': ['file.cdl'], \ 'cdrdaoconf': ['/etc/cdrdao.conf', '/etc/defaults/cdrdao', '/etc/default/cdrdao', '.cdrdao', 'any/etc/cdrdao.conf', 'any/etc/default/cdrdao', 'any/etc/defaults/cdrdao'], \ 'cdrtoc': ['file.toc'], + \ 'cedar': ['file.cedar'], \ 'cf': ['file.cfm', 'file.cfi', 'file.cfc'], \ 'cfengine': ['cfengine.conf'], \ 'cfg': ['file.hgrc', 'filehgrc', 'hgrc', 'some-hgrc'],