gnotclub / xst

st fork that uses Xresources and some pretty good patches
MIT License
536 stars 73 forks source link

Changing cursor shape in vim #63

Closed vikigenius closed 4 years ago

vikigenius commented 5 years ago

Hi, I am trying to change the shape of the cursor based on the mode in vim.

The wiki suggests to add this to my vimrc:

let &t_SI = "\\[6 q" let &t_SR = "\\[4 q" let &t_EI = "\\[2 q"

http://vim.wikia.com/wiki/Change_cursor_shape_in_different_modes

It specifically mentions st, so I tried it, but it doesn't work. Any idea why?

actionless commented 5 years ago

using tmux?

vikigenius commented 5 years ago

Okay, solved it need to use the tmux escape sequence. Works fine now, although, going back to normal mode causes a slight delay.

actionless commented 5 years ago

what kind of delay?

vikigenius commented 5 years ago

Oh, i don't think it's too much trouble. But changing from blinking block to blinking ibeam when I go from normal to insert is very quick, but going back to normal takes more time.

actionless commented 5 years ago

i think redraw should be tied to blinking rate or keypress

masaeedu commented 5 years ago

@vikigenius What did you do to get it working using the tmux escape sequence?

iynaix commented 5 years ago

@masaeedu Spent wayyyyyy too long trying to figure this out. I added st.termname: st-256color in my .Xresources and it works! I didn't have to make any modifications to my vimrc.

I may be completely wrong here, but my understanding is that st doesn't report the termcaps for cursor shape correctly. Vim has exceptions for such terminals and overrides their termcaps. Masquerading as st now allows vim to apply the fix.

actionless commented 5 years ago

@iynaix in xst itself i have default value, xterm-256color, in tmux -- screen-256color

(if it would be helpful for anybody)

@masaeedu regarding caret shape in vim: https://github.com/actionless/dotfiles/blob/master/vim/.vim/caret_shape.vim