Gentoo Archives: gentoo-user

From: Floyd Anderson <f.a@××××.net>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] vim colorschemes: A question regarding terminal capabilities
Date: Mon, 10 Apr 2017 19:36:29
Message-Id: 20170410193605.GA26520@31c0.net
In Reply to: [gentoo-user] vim colorschemes: A question regarding terminal capabilities by tuxic@posteo.de
1 On Mo, 10 Apr 05:00:26 +0000
2 tuxic@××××××.de wrote:
3 >I am playing around with colorschemes in vim […]
4 Wrong mailing list?
5
6 >It seems impossible to change the fore-/background color of the cursor itself.
7 What have you tried by yourself so far to come to this conclusion at the
8 end? Or is it not much more as a guess while you are waiting for a
9 solution from the list?
10
11 There are so many resources out there. Have you ever searched for it?
12
13 >[…] the terminal is able to display 256 colors
14 From which terminal emulator are you talking about? And of course, are
15 you using ‘app-editors/vim’, ‘app-editors/vim-core’, USE=minimal or even
16 ‘app-editors/neovim’?
17
18 >Is there something special terminal-wise when setting cursor colors ?
19 You have to deal with terminal escape sequences which may cause
20 headaches. Vim usually inherits its terminal options from the terminfo
21 file (man 5 terminfo) specified by the ${TERM} variable or at command
22 line as argument for the parameter ‘-T’.
23
24 Within Vim’s command line invoke (without the quotes) ‘:set termcap’ to
25 see what is currently set in your Vim session. To get an idea what those
26 output means, read the help at ‘:help terminal-options’. But it may be
27 worth to check first Vim is able to set cursor shape/colour related
28 stuff by running:
29 vim --version
30 or within Vim any of:
31 :version
32 :echo has('cursorshape')
33 and look it is compiled with the '+cursorshape' feature.
34
35 When it is, you can set the related terminal options (‘t_SI’,
36 ‘t_SR’, ‘t_EI’). Read — once more — the most obviously resource:
37 :help termcap-cursor-shape
38 :help termcap-cursor-color
39 for an example. As an additional hint, you can set both (shape and
40 colour) by concatenating terminal escape sequences. For instance:
41 let &t_SI = "\<Esc>]12;purple\x7\<Esc>[5 q"
42 sets a purple blinking IBeam cursor for insert mode (or globally, if you
43 are not reset the cursor style for the other modes).
44
45 Because you aren’t disclose your terminal emulator, I have to stop here.
46
47 The mentioned headaches maybe starts when:
48 • you are expect a ready to use solution and/or unwilling to
49 understand the basics of terminal escape sequences
50 • you only want to style the cursor in Vim (not those in the terminal)
51 • you are using different shapes/colours for different modes
52 • you are using different terminal emulators (local/remote)
53 • you are running terminal multiplexer > terminal emulator > Vim
54 • your system lacks the required terminfo file
55 • annoying side effects appears (e.g. with alternate screen)
56 • …
57
58 But there are solutions for those issues (except for point one).
59
60 >Why does it fail?
61 Why *what* fails? How can you expect an appropriate answer with so
62 sparsely informations from your side?
63
64 --
65 Regards,
66 floyd