Standard equivalents for t_SI t_EI?

608 views
Skip to first unread message

Benjamin R. Haskell

unread,
Nov 24, 2012, 1:17:13 PM11/24/12
to Vim Dev
As far as I can tell, the t_SI and t_EI sequences¹ don't have non-Vim
equivalents in either termcap or terminfo. Is that accurate? Were they
just "made up" out of necessity? If it's not accurate, does someone
have a link to a termcap or terminfo reference that includes those two?

¹: SI = Start Insert mode, EI = Exit Insert mode. In Vim they're used
(usually?) to set the cursor shape from block to bar and back.

E.g. in Konsole (needs to be in .vimrc, since updates don't seem to take
effect):

" set cursor shape to vertical bar when entering insert mode
let &t_SI="\<Esc>]50;CursorShape=1\x7"
" set cursor shape to block when leaving insert mode
let &t_EI="\<Esc>]50;CursorShape=0\x7"

--
Best,
Ben

James McCoy

unread,
Nov 24, 2012, 1:56:18 PM11/24/12
to Vim Dev
On Sat, Nov 24, 2012 at 01:17:13PM -0500, Benjamin R. Haskell wrote:
> As far as I can tell, the t_SI and t_EI sequences¹ don't have
> non-Vim equivalents in either termcap or terminfo. Is that
> accurate? Were they just "made up" out of necessity?

Yes. As noted at the top of the ":help t_SI" paragraph:

Added by Vim (there are no standard codes for these):

> If it's not
> accurate, does someone have a link to a termcap or terminfo
> reference that includes those two?

http://invisible-island.net/xterm/ctlseqs/ctlseqs.html has information
on the sequences necessary to control this behavior with xterm. For
example,

" Switch to underline on insert
let &t_SI="\<Esc>[4 q"
" Back to block when leaving
let &t_EI="\<Esc>[2 q"

> E.g. in Konsole (needs to be in .vimrc, since updates don't seem to
> take effect):

Setting it interactively works for me when running in xterm. I'm not
sure why it wouldn't work, since Vim sends this every time it
enters/leaves insert mode.

Cheers,
--
James
GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <jame...@jamessan.com>
signature.asc

Benjamin R. Haskell

unread,
Nov 24, 2012, 3:23:46 PM11/24/12
to vim...@googlegroups.com, Vim Dev
On Sat, 24 Nov 2012, James McCoy wrote:

> On Sat, Nov 24, 2012 at 01:17:13PM -0500, Benjamin R. Haskell wrote:
>> As far as I can tell, the t_SI and t_EI sequences¹ don't have non-Vim
>> equivalents in either termcap or terminfo. Is that accurate? Were
>> they just "made up" out of necessity?
>
> Yes. As noted at the top of the ":help t_SI" paragraph:
>
> Added by Vim (there are no standard codes for these):

Woops. Jumped directly to *t_SI* and assumed I was in the big list of
termcap entries. Didn't help that *t_EI* pointed to
*termcap-cursor-shape*, which made it seem like an actual termcap entry.


>> If it's not accurate, does someone have a link to a termcap or
>> terminfo reference that includes those two?
>
> http://invisible-island.net/xterm/ctlseqs/ctlseqs.html has information
> on the sequences necessary to control this behavior with xterm. For
> example,
>
> " Switch to underline on insert
> let &t_SI="\<Esc>[4 q"
> " Back to block when leaving
> let &t_EI="\<Esc>[2 q"

Thanks. That's actually what I was hoping to find by tracing back
through t_SI/t_EI: anything close to a "standard" set-cursor-style
sequence. (The Xterm Control Sequence reference calls it DECSCUSR, from
the VT520. I'm adding it to simple-terminal from st.suckless.org)


>> E.g. in Konsole (needs to be in .vimrc, since updates don't seem to
>> take effect):
>
> Setting it interactively works for me when running in xterm. I'm not
> sure why it wouldn't work, since Vim sends this every time it
> enters/leaves insert mode.

Well, crap. Also PEBKAC. Looking at the source, term_cursor_shape
short-circuits:

if (!full_screen || *T_CSI == NUL || *T_CEI == NUL)
return;

When testing interactively, I was only setting t_SI.

Sorry for (all) the noise. But thanks for finding the actual sequence I
was looking for.

--
Best,
Ben

sc

unread,
Nov 24, 2012, 10:14:36 PM11/24/12
to vim...@googlegroups.com
On Sat, Nov 24, 2012 at 01:17:13PM -0500, Benjamin R. Haskell wrote:

> E.g. in Konsole (needs to be in .vimrc, since updates don't seem to
> take effect):

> " set cursor shape to vertical bar when entering insert mode
> let &t_SI="\<Esc>]50;CursorShape=1\x7"
> " set cursor shape to block when leaving insert mode
> let &t_EI="\<Esc>]50;CursorShape=0\x7"

I tried this and it worked great in konsole vim, but when I went to
compose an email in mutt it made the font in the whole window too tiny
to read so I backed it out.

sc
Reply all
Reply to author
Forward
0 new messages