60

I am used to having a block cursor in normal mode in Vim. This makes sense with the Vim paradigm; when you press x, it is clear which character will be deleted.

I've installed Cygwin on a Windows computer, but when I use Vim in its terminal, I get the I cursor, even in normal mode. How can I make the cursor be a block instead?

Kazark
  • 3,509

5 Answers5

91

This question on the Cygwin mailing list answers the question by setting some arcane variables to the appropriate escape sequences. Add this to your .vimrc:

let &t_ti.="\e[1 q"
let &t_SI.="\e[5 q"
let &t_EI.="\e[1 q"
let &t_te.="\e[0 q"
Kazark
  • 3,509
40

There's a setting for that, in the cygwin terminal emulator:

Right-click on the window title bar > Options > Looks > Cursor > Cursor radio button

4

Create a file ~/.minttyrc, add below line to it

CursorType=block

Then re-launch mintty, which is Cygwin's default terminal.

qeatzy
  • 305
0

Or, you could create a batch file:

 %SYSTEMDRIVE%\cygwin\bin\mintty.exe ^
        -s 132,50 -o ScrollbackLines=10000 ^
        -o BackgroundColour=54,54,54 ^
        -o Transparency=High -o OpaqueWhenFocused=yes ^
        -o CursorColour=Green -o CursorType=block -o CursorBlinks=no ^
        -o Font=Consolas -o FontHeight=10 ^
        /bin/env CHERE_INVOKING=1 /bin/bash -l -i

And run it.

If you don't like the blinking cursor in the DOS command windows too use %COMSPEC% instead of /bin/env/... and be surprised.

0

People have raised the issue of @Kazark's answer setting the cursor for the entire shell session, to set it back to a line there are a couple of things you can do:

In .vimrc:

autocmd VimLeave * silent let &t_te.="\e[5 q"

Which should set in when you leave vim but it's not flawless (in particular when I'm running tmux on Windows and on a Linux machine I'm connected to), you can issue:

 printf '\033[5 q' 

at the command prompt.