added syntax highlighting for conf files

This commit is contained in:
Stefan Friese 2023-12-08 14:38:33 +01:00
parent f2ce40fa9a
commit fc79de71e6
2 changed files with 24 additions and 0 deletions

View File

@ -1 +1,2 @@
au BufNewFile,BufRead known_hosts setfiletype knownhosts
au BufNewFile,BufRead *.conf setfiletype conf

23
vim/.vim/syntax/conf.vim Normal file
View File

@ -0,0 +1,23 @@
if exists("b:current_syntax")
finish
endif
syntax clear
syntax match confSection "[a-zA-Z0-9_]\+" contained
highlight link confSection Statement
syntax match confKey "[a-zA-Z0-9_]\+\s\+"
highlight link confKey Identifier
syntax match confValue "[^\n]*" contained
highlight link confValue String
syntax match confObjectHeader "^\[\[\S+\]\]/$"
syntax match confObjectHeader /\v\[\S+\]/
highlight link confObjectHeader Type
" Enable folding based on sections
setlocal foldmethod=marker
setlocal foldmarker=[,]