summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWu, Zhenyu <wuzhenyu@ustc.edu>2024-04-14 20:34:22 +0200
committerChristian Brabandt <cb@256bit.org>2024-04-14 20:34:22 +0200
commit62c09e032c6b2d49fffac726300d142381924b98 (patch)
treeba312fb39a92f27f37c803c37ab21a448522904a
parent4ba70cab37d2a625d8c59bb136070ef9d1976934 (diff)
patch 9.1.0325: filetype: CMakeCache.txt files not recognizedv9.1.0325
Problem: filetype: CMakeCache.txt files not recognized Solution: Detect 'CMakeCache.txt' files as cmakecache filetype, include basic syntax script for cmakecache (Wu, Zhenyu, @bfrg) closes: #14384 Co-authored-by: bfrg <bfrg@users.noreply.github.com> Signed-off-by: Wu, Zhenyu <wuzhenyu@ustc.edu> Signed-off-by: Christian Brabandt <cb@256bit.org>
-rw-r--r--runtime/filetype.vim3
-rw-r--r--runtime/syntax/cmakecache.vim60
-rw-r--r--src/testdir/test_filetype.vim1
-rw-r--r--src/version.c2
4 files changed, 66 insertions, 0 deletions
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index 9864e06b1e..8943536ec0 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -449,6 +449,9 @@ au BufNewFile,BufRead *.clj,*.cljs,*.cljx,*.cljc setf clojure
" Cmake
au BufNewFile,BufRead CMakeLists.txt,*.cmake,*.cmake.in setf cmake
+" CmakeCache
+autocmd BufRead,BufNewFile CMakeCache.txt setf cmakecache
+
" Cmusrc
au BufNewFile,BufRead */.cmus/{autosave,rc,command-history,*.theme} setf cmusrc
au BufNewFile,BufRead */cmus/{rc,*.theme} setf cmusrc
diff --git a/runtime/syntax/cmakecache.vim b/runtime/syntax/cmakecache.vim
new file mode 100644
index 0000000000..f07c719811
--- /dev/null
+++ b/runtime/syntax/cmakecache.vim
@@ -0,0 +1,60 @@
+" Vim syntax file
+" Language: cmakecache - CMakeCache.txt files generated by CMake
+" Author: bfrg <https://github.com/bfrg>
+" Upstream: https://github.com/bfrg/vim-cmakecache-syntax
+" Last Change: Nov 28, 2019
+" License: Same as Vim itself (see :h license)
+
+if exists('b:current_syntax')
+ finish
+endif
+
+let s:cpo_save = &cpoptions
+set cpoptions&vim
+
+" Comments start with # or //
+syntax region CMakeCacheComment start="#\|//" end="$"
+
+" Match 'key' in key:type=value
+syntax match CMakeCacheKey "^\s*\w\+\(-ADVANCED\)\=:"me=e-1
+
+" Highlight 'str' in key:STRING=str (many thanks to Nickspoons in #vim!)
+syntax region CMakeCacheStringVar matchgroup=CMakeCacheType start=":STRING="ms=s+1,rs=e-1 end="$" contains=CMakeCacheString keepend
+syntax region CMakeCacheString start="="ms=s+1 end="$" contained
+
+" Highlight boolean 'value' in key:BOOL=value
+syntax region CMakeCacheBoolVar matchgroup=CMakeCacheType start=":BOOL="ms=s+1,rs=e-1 end="$" contains=CMakeCacheBool keepend
+syntax region CMakeCacheBool start="="ms=s+1 end="$" contained
+
+" Highlight 'path' in key:PATH=path
+syntax region CMakeCachePathVar matchgroup=CMakeCacheType start=":PATH="ms=s+1,rs=e-1 end="$" contains=CMakeCachePath keepend
+syntax region CMakeCachePath start="="ms=s+1 end="$" contained
+
+" Highlight 'file' in key:FILEPATH=file
+syntax region CMakeCacheFilePathVar matchgroup=CMakeCacheType start=":FILEPATH="ms=s+1,rs=e-1 end="$" contains=CMakeCacheFilePath keepend
+syntax region CMakeCacheFilePath start="="ms=s+1 end="$" contained
+
+" Highlight 'value' in key:STATIC=value
+syntax region CMakeCacheStaticVar matchgroup=CMakeCacheType start=":STATIC="ms=s+1,rs=e-1 end="$" contains=CMakeCacheStatic keepend
+syntax region CMakeCacheStatic start="="ms=s+1 end="$" contained
+
+" Highlight 'value' in key:Internal=value
+syntax region CMakeCacheInternalVar matchgroup=CMakeCacheType start=":INTERNAL="ms=s+1,rs=e-1 end="$" contains=CMakeCacheInternal keepend
+syntax region CMakeCacheInternal start="="ms=s+1 end="$" contained
+
+hi def link CMakeCacheComment Comment
+hi def link CMakeCacheKey Identifier
+hi def link CMakeCacheString String
+hi def link CMakeCacheBool Constant
+hi def link CMakeCachePath Directory
+hi def link CMakeCacheFilePath Normal
+hi def link CMakeCacheStatic Normal
+hi def link CMakeCacheInternal Normal
+
+" Highlight 'type' in key:type=value
+hi def link CMakeCacheType Type
+
+let b:current_syntax = 'cmakecache'
+
+let &cpoptions = s:cpo_save
+unlet s:cpo_save
diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim
index 07aa6853ec..66eeb3534f 100644
--- a/src/testdir/test_filetype.vim
+++ b/src/testdir/test_filetype.vim
@@ -157,6 +157,7 @@ def s:GetFilenameChecks(): dict<list<string>>
clean: ['file.dcl', 'file.icl'],
clojure: ['file.clj', 'file.cljs', 'file.cljx', 'file.cljc', 'init.trans', 'any/etc/translate-shell', '.trans'],
cmake: ['CMakeLists.txt', 'file.cmake', 'file.cmake.in'],
+ cmakecache: ['CMakeCache.txt'],
cmod: ['file.cmod'],
cmusrc: ['any/.cmus/autosave', 'any/.cmus/rc', 'any/.cmus/command-history', 'any/.cmus/file.theme', 'any/cmus/rc', 'any/cmus/file.theme', '/.cmus/autosave', '/.cmus/command-history', '/.cmus/file.theme', '/.cmus/rc', '/cmus/file.theme', '/cmus/rc'],
cobol: ['file.cbl', 'file.cob', 'file.lib'],
diff --git a/src/version.c b/src/version.c
index d8e4f2672b..5addc136fd 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 325,
+/**/
324,
/**/
323,