add vim syntax files for config files

This commit is contained in:
Edgar 2022-11-04 16:54:05 +01:00
parent d83cf0ac56
commit b67dcdc1e2
3 changed files with 34 additions and 0 deletions

View file

@ -339,3 +339,11 @@ Only then you could also set up git to ignore specific formatting revisions:
```bash
git config blame.ignoreRevsFile formatting-revs.txt
```
(Neo)Vim Syntax Highlighting for config files
----------------------------------------
Copy the file detection and syntax files to your vim config folder, in the case of neovim:
```bash
cp -R other/vim/* ~/.config/nvim/
```

View file

@ -0,0 +1 @@
autocmd BufRead,BufNewFile settings_ddnet.cfg set filetype=ddnet-cfg

View file

@ -0,0 +1,25 @@
" Vim syntax file
" Language: ddnet config files (https://github.com/ddnet/ddnet)
if exists("b:current_syntax")
finish
endif
syntax match settingName "^\w*"
syntax match value "\s\w*"
syntax match escapeQuote "\\\""
syntax match number "\s[0-9]\+"
syntax match ip "\s\d\+\.\d\+\.\d\+\.\d\+\(:\d\+\)\="
syntax region string start='"' end='"' contains=escapeQuote
hi def link settingName Identifier
hi def link value Constant
hi def link ip Constant
hi def link string String
hi def link number Number
hi def link escapeQuote SpecialChar
let b:current_syntax = "ddnet-cfg"