This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch

[PATCH hare.vim v2] Highlight error assertion operator bold red

Message ID
DKIM signature
Download raw message
Patch: +3 -0
! is highlighted bold red when it appears immediately after a closing
parentheses that wasn't part of a comment, and is not immediately
followed by an equals sign.

Note that this only works when ! comes after a function call, as it
almost always does. Handling all edge cases where ! is used after a
non-call expression is, if not impossible, extremely impractical without
the use of semantic analysis.

Signed-off-by: Sebastian <sebastian@sebsite.pw>
Since v1: ! is only highlighted following a function call. See the
commit message for reasoning.

 syntax/hare.vim | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/syntax/hare.vim b/syntax/hare.vim
index b3eb750..362f4b7 100644
--- a/syntax/hare.vim
+++ b/syntax/hare.vim
@@ -18,6 +18,7 @@ syn match hareBuiltin "\v<size>((\_s|//.*\n)*\()@="
syn match harePreProc "^use .*;"
syn match harePreProc "@[a-z]*"
syn match hareOperator "\.\.\." "\.\."
syn match hareErrorAssertion "\v(^([^/]|//@!)*\)\_s*)@<=!\=@!"

syn region hareString start=+\z(["']\)+ end=+\z1+ skip=+\\\\\|\\\z1+
syn region hareString start=+`+ end=+`+
@@ -79,4 +80,6 @@ hi def link hareSpaceError Error
autocmd InsertEnter * hi link hareSpaceError NONE
autocmd InsertLeave * hi link hareSpaceError Error

hi hareErrorAssertion ctermfg=red cterm=bold guifg=red gui=bold

" vim: tabstop=8 shiftwidth=2 expandtab
Message ID
<20220623233703.3934-1-sebastian@sebsite.pw> (view parent)
DKIM signature
Download raw message
I'm not sure hardcoding the highlighting is a good idea, that should be
left to color schemes.  It's probably better to just link it to some
predefined highlighting group (or define a new highlighting group) so
that the actual highlighting is done based on people's color scheme of
Reply to thread Export thread (mbox)