Friday, May 31, 2019

Re: Cursor shape in the console

On Fri, May 31, 2019 at 6:45 AM John Little <john.b.little@gmail.com> wrote:
>
> On Wednesday, May 29, 2019 at 9:31:17 AM UTC+12, Tony Mechelynck wrote:
> > ... I haven't found how to make it work in both konsole
> > and xterm ...
>
> I use the XTERM_VERSION environment variable. xterm defines it, konsole doesn't.

Ah, interesting. Yes, indeed, in bash in xterm, "echo $XTERM_VERSION"
answers Xterm(330) but in konsole the answer is empty. Thanks!
>
> Note that if xterm is started with -bc for a blinking cursor, the effects of the 5 and 6 are reversed, so that 5 is steady and 6 blinking.

IOW, if the cursor is blinking in bash in xterm, with the "even" codes
it wil remain blinking in Vim.

Thanks to you, my problem is solved in both xterm and konsole, with
the folowing code:

" try to change cursor shape in Console mode in xterm-like terminals
" t_EI = █ (Normal)
" t_SR = _ (Replace)
" t_SI = | (Insert)
if !has('gui_running') && has('cursorshape')
if $XTERM_VERSION =~? '^xterm' " a «real» xterm
let &t_EI = "\<Esc>[2 q"
let &t_SI = "\<Esc>[6 q"
let &t_SR = "\<Esc>[4 q"
else " assume konsole
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_SR = "\<Esc>]50;CursorShape=2\x7"
endif
endif


Best regards,
Tony.

--
--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXu9Frb-5nYQkFg6BEmrfh%3D4Ov%2BkLJV5Hwnp5_d6M%2BZ0Sw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments: