thestinger / termite

Termite is obsoleted by Alacritty. Termite was a keyboard-centric VTE-based terminal, aimed at use within a window manager with tiling and/or tabbing support.
https://github.com/alacritty/alacritty
2.74k stars 241 forks source link

ibeam cursor change to block cursor after opening vim #691

Closed shibumi closed 3 years ago

shibumi commented 5 years ago

Hi, I have some weird behavior. I have set the following option in my .config/termite/config file:

cursor_shape = ibeam

This works as expected, but when I open vim for editing a file and close it afterwards the cursor is changed to a block cursor. Any idea?

shibumi commented 5 years ago

Here is a screen record https://paste.xinu.at/t96/

BarbUk commented 5 years ago

Do you have a cursor definition in your vim config ? Check for:

let &t_SI = "\e[6 q"
let &t_EI = "\e[2 q"

or

autocmd VimEnter * silent !echo -ne "\e[2 q"
BarbUk commented 5 years ago

You can change your vim config if you want a block cursor only in vim:

" optional reset cursor on start and leave:
augroup myCmds
au!
autocmd VimEnter * silent !echo -ne "\e[1 q"
autocmd VimLeave * silent !echo -ne "\e[5 q"
augroup END

To test the cursor change: echo -ne "\e[N q"

with N =

N = 0  -> blinking block.
N = 1  -> blinking block (default).
N = 2  -> steady block.
N = 3  -> blinking underline.
N = 4  -> steady underline.
N = 5  -> blinking bar (xterm).
N = 6  -> steady bar (xterm).
shibumi commented 5 years ago

@BarbUk I have cursor definition in my vim. But it's not about the cursor inside of vim, the cursor changes when I exit vim. This is not what I expect. I expect that the terminal always has the same cursor. But I will try out this reset block you have posted.

BarbUk commented 5 years ago

I expect that the terminal always has the same cursor.

Vim use the terminal cursor in cli mode. Your config in vim is telling termite: change the cursor to block please.

elenapan commented 4 years ago

Use this in your vim config to restore the cursor on exit:

" Restore cursor shape to beam on exit
augroup restore_cursor_shape
  autocmd!
  au VimLeave * set guicursor=a:ver10-blinkoff0
augroup END
harsath commented 3 years ago

This works, but I make vim as BG task, it makes the cursor to Block instead of the I beam. This works only on exit, is there any way I can do it when I make vim as BG task and return to the shell?

thestinger commented 3 years ago

Termite is obsolete. Please use Alacritty instead. See https://github.com/thestinger/termite#termite-is-obsoleted-by-alacritty for more details.