aboutsummaryrefslogtreecommitdiff
path: root/vim/werge.vim
diff options
context:
space:
mode:
authorMirek Kratochvil <miroslav.kratochvil@uni.lu>2025-10-14 14:07:40 +0200
committerMirek Kratochvil <miroslav.kratochvil@uni.lu>2025-10-14 14:07:40 +0200
commit10777c32f603c187316d2c1cacc665c7f34dd0b7 (patch)
tree244722cfb82754d13a4aecfab3273e426151d140 /vim/werge.vim
parent6beaeec8e773d8494d084ce49d87c62929da5b2e (diff)
downloadwerge-10777c32f603c187316d2c1cacc665c7f34dd0b7.tar.gz
werge-10777c32f603c187316d2c1cacc665c7f34dd0b7.tar.bz2
actually make the vim syntax work nicely + document it
Diffstat (limited to 'vim/werge.vim')
-rw-r--r--vim/werge.vim29
1 files changed, 29 insertions, 0 deletions
diff --git a/vim/werge.vim b/vim/werge.vim
new file mode 100644
index 0000000..0997437
--- /dev/null
+++ b/vim/werge.vim
@@ -0,0 +1,29 @@
+" Vim syntax file
+" Language: werge
+" Maintainer: Mirek Kratochvil
+" Last Change: Oct 14, 2025
+" Version: 1
+" URL: https://github.com/exaexa/werge
+
+" quit if a syntax file was already loaded
+if exists("b:current_syntax")
+ finish
+endif
+
+" syntax for the werge files
+syntax region wergeHunk start=/<<<<</ end=/>>>>>/ contains=wergeRm,wergeDiffAdd,wergeConflictOrigAdd
+syntax region wergeRm start=/<<<<</hs=e+1 end=/|||||/he=s-1,me=s-1 contained
+syntax match wergeDiffAdd /|||||\([^>=]\|>\{1,4\}>\@!\|=\{1,4\}=\@!\)*>>>>>/ms=s+5,me=e-5 contained
+syntax match wergeConflictOrigAdd /|||||\([^=>]\|=\{1,4\}=\@!\|>\{1,4\}>\@!\)*=====\([^=>]\|=\{1,4\}=\@!\|>\{1,4\}>\@!\)*>>>>>/me=e-5 contained contains=wergeConflictOrig,wergeconflictAdd
+syntax region wergeConflictOrig start=/|||||/hs=e+1 end=/=====/he=s-1,me=s-1 contained
+syntax region wergeConflictAdd start=/=====/hs=e+1 end=/>>>>>/he=s-1,me=s-1 contained
+
+" color specification
+highlight default link wergeHunk Comment
+highlight default link wergeRm Removed
+highlight default link wergeDiffAdd Added
+highlight default link wergeConflictOrigAdd Comment
+highlight default link wergeConflictOrig Changed
+highlight default link wergeConflictAdd Added
+
+let b:current_syntax = "werge"