How to check if strikethrough is available

109 views
Skip to first unread message

Rick Howe

unread,
Oct 13, 2017, 11:56:55 PM10/13/17
to vim_use
A strikethrough attribute is available since patch 1038.
:help strikethrough says
In general "undercurl" and "strikethrough" is only available in the GUI.
But my cygwin and neovim terminals can also show it
and then I am looking for how to check and use it as much as possible.

I am now trying with:
has('patch-8.0.1038') &&
\(&term == 'builtin_gui' || &termguicolors || (!empty(&t_Ts) && !empty(&t_Te)))

I would appreciate if you could give me more useful way.

Tony Mechelynck

unread,
Oct 18, 2017, 12:13:33 PM10/18/17
to vim...@googlegroups.com
1. The usual way to test for the GUI is

:if has('gui_running')

rather than

:if &term == 'builtin_gui'

which, however, should work too.

2. 'termguicolors' can be on even in a terminal emulator which doesn't
support strikethrough or undercurl: it just means that your terminal
understands #RRGGBB color codes (where each of these letters
represents a hex digit), though maybe only for background and
foreground. IMHO you should not rely of it.

3. I notice that in my gvim 8.0.1203 with GTK2 GUI running in GUI
mode, t_Ts and t_Te are defined as ^[|4c and ^[|4C respectively, so I
suppose that the test for has('gui_running') is superfluous. (In the
same executable running as "vim" in a konsole terminal, they are ^[[9m
and ^[[29m respectively.)


The above give the following simplified test:

:if has('patch-8.0.1038') && &t_Ts != '' && &t_Te != ''


Best regards,
Tony.

Rick Howe

unread,
Oct 21, 2017, 11:47:47 PM10/21/17
to vim_use
Thank you for your suggestions. I will try and follow it.

Reply all
Reply to author
Forward
0 new messages