commit b0e2fda51e3ebf374111c3cdc8e162ce2c523e42
parent 0ef2216f3085adafdc47a1bc85d6ff7eb6ff012f
Author: hhvn <dev@hhvn.uk>
Date: Tue, 8 Feb 2022 19:17:11 +0000
Add vim ftdetect & use region for %{nick:...}
Diffstat:
3 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/hirc.vim b/hirc.vim
@@ -1,23 +0,0 @@
-" hirc config syntax highlighting
-" Colours comments and formats.
-" I haven't done any autocmd stuff,
-" so you'll likely want to tell vim
-" to use this syntax (:help modeline) */
-
-if exists("b:current_syntax")
- finish
-endif
-
-syn match hircComment "^[^/].*"
-syn region hircFormatA start="^/format" end=/$/ contains=hircStyle,hircVariable,hircNickStyle
-syn region hircFormatB start="^/set format." end=/$/ contains=hircStyle,hircVariable,hircNickStyle
-syn match hircStyle "%{[^}]*}" contained
-" hircNickStyle is a bit hacky and should be replaced
-" by a region, but I don't know syn enough for that
-syn match hircNickStyle "%{nick:\${[^}]*}}" contained contains=hircVariable
-syn match hircVariable "\${[^}]*}" contained
-
-hi link hircComment comment
-hi link hircStyle preproc
-hi link hircNickStyle hircStyle
-hi link hircVariable variable
diff --git a/vim/ftdetect/hirc.vim b/vim/ftdetect/hirc.vim
@@ -0,0 +1 @@
+au BufNewFile,BufRead *.hirc,*.hircrc,*hirc.conf set filetype=hirc syntax=hirc
diff --git a/vim/syntax/hirc.vim b/vim/syntax/hirc.vim
@@ -0,0 +1,22 @@
+" Vim syntax file
+" Language: hirc configuration
+" Maintainer: hhvn <dev@hhvn.uk>
+" Last Change: 2022-02-08
+" License: This file is placed in the public domain.
+
+if exists("b:current_syntax")
+ finish
+endif
+
+syn match hircComment "^[^/].*"
+syn region hircFormatA start="^/format" end=/$/ contains=hircStyle,hircVariable,hircNickStyle
+syn region hircFormatB start="^/set format." end=/$/ contains=hircStyle,hircVariable,hircNickStyle
+syn match hircStyle "%{[^}]*}" contained
+" hircNickStyle is a bit hacky and should be replaced
+" by a region, but I don't know syn enough for that
+syn region hircNickStyle matchgroup=hircStyle start='%{nick:' end='}' contains=hircStyle,hircVariable
+syn match hircVariable "\${[^}]*}" contained
+
+hi link hircComment comment
+hi link hircStyle preproc
+hi link hircVariable variable