Hiding cursor with t_ve in terminal

51 views
Skip to first unread message

Brett Stahlman

unread,
Nov 19, 2016, 9:27:24 PM11/19/16
to vim...@googlegroups.com
Vim's documentation lists 't_vi' as "cursor invisible" and 't_ve' as
"cursor visible", but provides no hints on usage. Naively, I would
have guessed that Vim would send the 't_vi' sequence when you somehow
indicated that the cursor should be hidden (e.g., using something
analogous to 'guicursor' for terminals), but there doesn't appear to
be any such mechanism. The only way I've been able to hide the cursor
in a terminal is to make the "cursor visible" option empty: e.g.,

set t_ve=

I interpret this behavior as follows: when you tell Vim there's no way
to make the cursor visible, it immediately uses the 't_vi' option
value to make it *invisible*. This was less than intuitive to me, and
I didn't see it documented in the Vim help. Is the behavior
well-defined? Can anyone give a better explanation of what's happening
and perhaps the rationale behind it? Have I simply missed the
pertinent documenation?

Thanks,
Brett Stahlman

Bram Moolenaar

unread,
Nov 20, 2016, 7:52:48 AM11/20/16
to vim...@googlegroups.com, Brett Stahlman
Traditionally terminals show the cursor even when drawing text. So on
your 300 baud modem you could see the cursor move ahead of the text that
was displayed. Now that text is drawn instantly, updating the cursor
just becomes flickering. So Vim disables the cursor before drawing
text, and switches it back on when done.

The setting is termcap thing, telling Vim what escape sequence to use.

--
A day without sunshine is like, well, night.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Brett Stahlman

unread,
Nov 20, 2016, 8:21:53 AM11/20/16
to Bram Moolenaar, vim...@googlegroups.com
On Sun, Nov 20, 2016 at 6:52 AM, Bram Moolenaar <Br...@moolenaar.net> wrote:
>
> Brett Stahlman wrote:
>
>> Vim's documentation lists 't_vi' as "cursor invisible" and 't_ve' as
>> "cursor visible", but provides no hints on usage. Naively, I would
>> have guessed that Vim would send the 't_vi' sequence when you somehow
>> indicated that the cursor should be hidden (e.g., using something
>> analogous to 'guicursor' for terminals), but there doesn't appear to
>> be any such mechanism. The only way I've been able to hide the cursor
>> in a terminal is to make the "cursor visible" option empty: e.g.,
>>
>> set t_ve=
>>
>> I interpret this behavior as follows: when you tell Vim there's no way
>> to make the cursor visible, it immediately uses the 't_vi' option
>> value to make it *invisible*. This was less than intuitive to me, and
>> I didn't see it documented in the Vim help. Is the behavior
>> well-defined? Can anyone give a better explanation of what's happening
>> and perhaps the rationale behind it? Have I simply missed the
>> pertinent documenation?
>
> Traditionally terminals show the cursor even when drawing text. So on
> your 300 baud modem you could see the cursor move ahead of the text that
> was displayed. Now that text is drawn instantly, updating the cursor
> just becomes flickering. So Vim disables the cursor before drawing
> text, and switches it back on when done.
>
> The setting is termcap thing, telling Vim what escape sequence to use.

Makes sense, but out of curiosity, why is the cursor hidden
*immediately* when I clear t_ve, even when no text is being drawn?
Even if I do the `set t_ve=' in a silent mapping (to ensure no text is
being changed), the cursor disappears immediately. I'm actually glad
it works this way - I just want to be sure it's intended behavior,
and not likely to change...

Thanks,
Brett Stahlman
Reply all
Reply to author
Forward
0 new messages