Re: [gentoo-user] vim colorschemes: A question regarding terminal capabilities

2017-04-14 Thread Andrew Savchenko
On Mon, 10 Apr 2017 05:00:26 + tu...@posteo.de wrote:
> I am playing around with colorschemes in vim and came across a problem: It 
> seems impossible to change the fore-/background color of the cursor itself.
> $TERM is xterm-256color and vim itself offers settings for the color of the 
> cursor. Different colortests for terminals validate that the terminal is able 
> to display 256 colors.
> 
> Is there something special terminal-wise when setting cursor colors ?
> Why does it fail?

Cursor colour has its own control sequence:

http://rcr.io/words/dynamic-xterm-colors.html

e.g.

  echo -ne "\033]12;#DD3123\007"

will change your cursor to red (colour DD3123) without affecting
normal text foreground and background colors.

Best regards,
Andrew Savchenko


pgpF2WZYsRDLk.pgp
Description: PGP signature


Re: [gentoo-user] vim colorschemes: A question regarding terminal capabilities

2017-04-10 Thread Floyd Anderson

On Mo, 10 Apr 05:00:26 +
tu...@posteo.de wrote:

I am playing around with colorschemes in vim […]

Wrong mailing list?


It seems impossible to change the fore-/background color of the cursor itself.

What have you tried by yourself so far to come to this conclusion at the
end? Or is it not much more as a guess while you are waiting for a
solution from the list?

There are so many resources out there. Have you ever searched for it?


[…] the terminal is able to display 256 colors
From which terminal emulator are you talking about? And of course, are

you using ‘app-editors/vim’, ‘app-editors/vim-core’, USE=minimal or even
‘app-editors/neovim’?


Is there something special terminal-wise when setting cursor colors ?

You have to deal with terminal escape sequences which may cause
headaches. Vim usually inherits its terminal options from the terminfo
file (man 5 terminfo) specified by the ${TERM} variable or at command
line as argument for the parameter ‘-T’.

Within Vim’s command line invoke (without the quotes) ‘:set termcap’ to
see what is currently set in your Vim session. To get an idea what those
output means, read the help at ‘:help terminal-options’. But it may be
worth to check first Vim is able to set cursor shape/colour related 
stuff by running:

   vim --version
or within Vim any of:
   :version
   :echo has('cursorshape')
and look it is compiled with the '+cursorshape' feature.

When it is, you can set the related terminal options (‘t_SI’,
‘t_SR’, ‘t_EI’). Read — once more — the most obviously resource:
   :help termcap-cursor-shape
   :help termcap-cursor-color
for an example. As an additional hint, you can set both (shape and
colour) by concatenating terminal escape sequences. For instance:
   let _SI = "\]12;purple\x7\[5 q"
sets a purple blinking IBeam cursor for insert mode (or globally, if you
are not reset the cursor style for the other modes).

Because you aren’t disclose your terminal emulator, I have to stop here.

The mentioned headaches maybe starts when:
 • you are expect a ready to use solution and/or unwilling to
   understand the basics of terminal escape sequences
 • you only want to style the cursor in Vim (not those in the terminal)
 • you are using different shapes/colours for different modes
 • you are using different terminal emulators (local/remote)
 • you are running terminal multiplexer > terminal emulator > Vim
 • your system lacks the required terminfo file
 • annoying side effects appears (e.g. with alternate screen)
 • …

But there are solutions for those issues (except for point one).


Why does it fail?

Why *what* fails? How can you expect an appropriate answer with so
sparsely informations from your side?

--
Regards,
floyd