Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim - change cursor in command line

Tags:

vim

I'm trying to change cursor from block to vertical bar (I-beam) when entering Vim command line.

I was trying with this separate codes:

" with these two codes nothing happens
autocmd CmdlineEnter * let &t_SI
autocmd CmdlineEnter * execute &t_SI

" this last one  produce "E20: Mark not set" error
autocmd CmdlineEnter * execute '!echo -ne "' . &t_SI . '"'

Is something like that even possible or vim uses same cursor for cmd line like it uses in normal mode.
I've changed normal mode (&t_EI) to vertical bar and in that case cursor was vertical bar in cmd line.

Can cursor be changed in cmd line regardles of normal mode?
Can someone help with this?

like image 489
Bengall Avatar asked Nov 04 '25 16:11

Bengall


1 Answers

In Vim 8.2.0258 or newer, the echoraw() function can be used

autocmd CmdlineEnter * call echoraw(&t_SI)
autocmd CmdlineLeave * call echoraw(&t_EI)
like image 166
Tachi Avatar answered Nov 07 '25 15:11

Tachi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!