'syntax hi [...] start=[...] stop=[...]' has no effect

55 views
Skip to first unread message

mwnx

unread,
May 2, 2016, 7:52:34 PM5/2/16
to vim...@googlegroups.com
Hello Vim users,

I'm trying to get some fancy 24-bit color going with the official
vim using escape codes such as "<Esc>[38;2;${r};${g};${b}m", which
work on some terminals.

Now, according to Vim's documentation, it's possible to highlight
syntax regions with arbitrary terminal escape sequences using the
'start' and 'stop' arguments of the 'highlight' command (relevant
help entries: highlight-start, E422, term-list, highlight-stop).

However, this simply has no effect whatsoever, even when trying to
get some basic bold text, with e.g.:

hi mailSubject start=<Esc>[1m stop=<Esc>0m

I've also tried "hi clear" beforehand but that doesn't help.

This feature seems oddly ignored and forgotten, since my numerous
attempts at searching for it through Google have turned up no
relevant results, and the code for it in the git repo hasn't been
updated since 2004, so I'm guessing the behaviour I'm getting could
just be a bug that got in because nobody ever uses this feature.

If nobody comes up with a solution or an explanation to my problem,
I guess I'll file a bug report...

--
mwnx
GPG: AEC9 554B 07BD F60D 75A3 AF6A 44E8 E4D4 0312 C726

Nikolay Aleksandrovich Pavlov

unread,
May 2, 2016, 10:08:09 PM5/2/16
to vim...@googlegroups.com
Based on the [code][1] I think it never supposed to work if t_Co is
greater then 1. But for some reason I do not see this working when
t_Co is 1 and setting start/stop for Normal highlight group. Other
groups (tested on NonText only) seem to be fine. Though `hi Normal
term=bold` neither works with t_Co set to 1.

So this feature is intended for black and white terminals and works
there. And it is documented: open `:h highlight-start` and scroll up
to “1. highlight arguments for normal terminals”. Higher there is some
explanation what is normal and color terminal, though I would say
rather strange explanation (while vt100 may be black-and-white (at
least its entry does not state it supports any colors) xterm termcap
entry states it supports 8 colors (256 colors is supported by
xterm-256colors)).

[1]: https://github.com/ZyX-I/vim/blob/6b82591127b58b9ef03790cb51e867b4fd575622/src/screen.c#L7862

>
> --
> mwnx
> GPG: AEC9 554B 07BD F60D 75A3 AF6A 44E8 E4D4 0312 C726
>
> --
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google Groups "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

mwnx

unread,
May 3, 2016, 12:06:09 PM5/3/16
to v...@vim.org
Hello Vim users,

I'm trying to get some fancy 24-bit color going with the official
vim using escape codes such as "<Esc>[38;2;${r};${g};${b}m", which
work on some terminals.

Now, according to Vim's documentation, it's possible to highlight
syntax regions with arbitrary terminal escape sequences using the
'start' and 'stop' arguments of the 'highlight' command (relevant
help entries: highlight-start, E422, term-list, highlight-stop).

However, this simply has no effect whatsoever, even when trying to
get some basic bold text, with e.g.:

hi mailSubject start=<Esc>[1m stop=<Esc>0m

I've also tried "hi clear" beforehand but that doesn't help.

This feature seems oddly ignored and forgotten, since my numerous
attempts at searching for it through Google have turned up no
relevant results, and the code for it in the git repo hasn't been
updated since 2004, so I'm guessing the behaviour I'm getting could
just be a bug that got in because nobody ever uses this feature.

If nobody comes up with a solution or an explanation to my problem,
I guess I'll file a bug report...

mwnx

unread,
May 3, 2016, 1:53:49 PM5/3/16
to vim...@googlegroups.com
On Tue, May 03, 2016 at 05:08:00AM +0300, Nikolay Aleksandrovich Pavlov wrote:
> Based on the [code][1] I think it never supposed to work if t_Co is
> greater then 1. But for some reason I do not see this working when
> t_Co is 1 and setting start/stop for Normal highlight group. Other
> groups (tested on NonText only) seem to be fine. Though `hi Normal
> term=bold` neither works with t_Co set to 1.
>
> So this feature is intended for black and white terminals and works
> there. And it is documented: open `:h highlight-start` and scroll up
> to “1. highlight arguments for normal terminals”. Higher there is some
> explanation what is normal and color terminal, though I would say
> rather strange explanation (while vt100 may be black-and-white (at
> least its entry does not state it supports any colors) xterm termcap
> entry states it supports 8 colors (256 colors is supported by
> xterm-256colors)).
>
> [1]: https://github.com/ZyX-I/vim/blob/6b82591127b58b9ef03790cb51e867b4fd575622/src/screen.c#L7862

Thanks! I had not noticed the heading.

When setting t_Co to 0 or 1, I am indeed able to get the effects I
want using 'start=' and 'stop='. I'll see if I can change my whole
colorscheme to work with terminal codes only, and if that works out,
I might write and release a plugin.

Sorry for the double post by the way.
Reply all
Reply to author
Forward
0 new messages