Skip to content

Commit

Permalink
add syntax highlight for CMakeCache.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
Freed-Wu committed Jul 15, 2023
1 parent 7c6f28d commit 5d880b0
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ftdetect/cmake.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
augroup cmake
autocmd!
autocmd BufNewFile,BufRead CMakeLists.txt,*.cmake setfiletype cmake
autocmd BufNewFile,BufRead CMakeCache.txt setfiletype cmakecache
augroup END
30 changes: 30 additions & 0 deletions syntax/cmakecache.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
" Vim syntax file
" Program: CMake - Cross-Platform Makefile Generator
" Version: cmake version 3.27.20230713-gdc88dd5
" Language: CMake
" Author: Andy Cedilnik <[email protected]>,
" Nicholas Hutchinson <[email protected]>,
" Patrick Boettcher <[email protected]>
" Maintainer: Dimitri Merejkowsky <[email protected]>
" Former Maintainer: Karthik Krishnan <[email protected]>
" Last Change: 2023 Jul 13
"
" Licence: The CMake license applies to this file. See
" https://cmake.org/licensing
" This implies that distribution with Vim is allowed

if exists('b:current_syntax')
finish
endif
let b:current_syntax = 'cmakecache'

syntax region cmakecacheComment start="#" end="$"
syntax region cmakecacheComment start="//" end="$"
syntax match cmakecacheKeyword /^\S*\ze:/
syntax match cmakecacheType /:\zs\S*\ze=/
syntax match cmakecacheConstant /=\zs.*/

highlight default link cmakecacheComment Comment
highlight default link cmakecacheKeyword Keyword
highlight default link cmakecacheType Type
highlight default link cmakecacheConstant Constant

0 comments on commit 5d880b0

Please sign in to comment.