3

There are ANSI escape codes (namely 5 and 6) that make subsequent text blink and my terminal (rxvt-unicode-256color) does support this.

Is there a way to allow this to happen using hi?

EDIT: From the manual:

start={term-list} highlight-start E422
stop={term-list} term-list highlight-stop

These lists of terminal codes can be used to get non-standard attributes on a terminal.

The escape sequence specified with the "start" argument is written before the characters in the highlighted area. It can be anything that you want to send to the terminal to highlight this area. The escape sequence specified with the "stop" argument is written after the highlighted area. This should undo the "start" argument. Otherwise the screen will look messed up.

I supposed this could be what I was looking for therefore I tried the following:

hi foo start=t_mb stop=<ESC>[0m`<br>

Nothing happened however (and I did make sure foo matches the sy[ntax] rule)
I tried making the text bold in similar fashion (by using t_md instead of t_mb) but it did not work (bold does work with cterm=bold though).

I either misunderstood what start and stop actually do or the line above simply shows incorrect usage.

How do I make this work?

5

It's possible to do this using the start and stop arguments to the :highlight command as you suggest, but you're probably not going to like the trade-off required.

It seems those arguments only work if Vim believes it is running in a black and white terminal (i.e. if t_Co is set to 1).

I found the following info in a newsgroup posting:

Based on the code 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)).

Indeed, I tried using the following command to use the ANSI blink escape sequence:

:highlight Blinking start=<esc>[5m stop=<esc>[0m

It had no effect. However running the following resulted in blinking text, as expected:

:set t_Co=1
:highlight Blinking start=<esc>[5m stop=<esc>[0m

Note that if you are dead set on having blinking and coloured text at the same time in Vim, you could also use the same highlight arguments to provide colouring even with t_Co set to 1. e.g. the following results in blinking red text:

:highlight Blinking start=<esc>[31;5m stop=<esc>[0m

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.