Added syntax highlighting for vim

master
Ruben Dahl 2023-01-14 15:06:44 +01:00
parent 2e4e5bff3d
commit c5a1cda975
No known key found for this signature in database
GPG Key ID: C7838D0300EDEF1B
3 changed files with 47 additions and 0 deletions

38
syntax/ceev.vim 100644
View File

@ -0,0 +1,38 @@
if exists("b:current_syntax")
finish
endif
set iskeyword=a-z,A-Z,-,*,_,!,@
" Language keywords
syntax keyword ceevKeywords let unlet
syntax keyword ceevConstant Character
" Comments
syntax region ceevCommentLine start="//" end="$" contains=ceevTodos
" String literals
syntax region ceevString start=/\v"/ skip=/\v\\./ end=/\v"/ contains=ceevEscapes
" Char literals
syntax region ceevChar start=/\v'/ skip=/\v\\./ end=/\v'/ contains=ceevEscapes
" Escape literals \n, \r, ....
syntax match ceevEscapes display contained "\\[nr\"']"
" Number literals
syntax region ceevNumber start=/\s\d/ skip=/\d/ end=/\s/
" Set highlights
highlight default link ceevTodos Todo
highlight default link ceevKeywords Keyword
highlight default link ceevConstant Constant
highlight default link ceevCommentLine Comment
highlight default link ceevString String
highlight default link ceevNumber Number
highlight default link ceevTypeNames Type
highlight default link ceevChar Character
highlight default link ceevEscapes SpecialChar
let b:current_syntax = "ceev"

View File

@ -0,0 +1 @@
autocmd BufNewFile,BufRead *.cv setf ceev

View File

@ -0,0 +1,8 @@
#!/bin/bash
if [[ -z $1 ]]; then echo "Expected a file but got nothing"; exit 1; fi
cp $1 ~/.vim/syntax/$1
cp "${1}.ftd" ~/.vim/ftdetect/$1
echo "Installed $1"