Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting the cursor to a vertical thin line in vim

Tags:

vim

I am trying to set the cursor in insert mode to be a thin vertical line and I am unable to. I have tried this in my .vimrc file:

set guicursor+=i:ver100-iCursor

It does not set the cursor to a vertical bar on insert mode.

What am I missing and how do I do this?

like image 317
mpora Avatar asked Apr 22 '13 00:04

mpora


People also ask

How do I change my cursor in Vim?

Changing the cursor color in insert modeUsing gvim with the defaults, the cursor shape is a block when in n-v-c modes (normal mode, or visual selection mode, or command mode while entering a colon command), and the shape changes to a vertical bar when in i (insert) mode. The color and blink rates do not change.

How do I change my cursor from insert mode?

You may have just pressed your INSERT key on your keyboard. This changes Word, etc., from insert mode to overtype mode. Press the INSERT key again and it should toggle back to being a line.

How do I enter insert mode in Vim?

To go into INSERT mode from COMMAND mode, you type i . To go back to COMMAND mode, you type the esc key. vim starts out in COMMAND mode. Over time, you will likely spend more time in COMMAND mode than INSERT mode.

How do I jump to the next word in Vim?

Press w (“word”) to move the cursor to the right one word at a time. Press b (“back”) to move the cursor to the left one word at a time. Press W or B to move the cursor past the adjacent punctuation to the next or previous blank space. Press e (“end”) to move the cursor to the last character of the current word.


2 Answers

This code in my /home/el/.vimrc worked for my console:

if $TERM_PROGRAM =~ "iTerm"
    let &t_SI = "\<Esc>]50;CursorShape=1\x7" " Vertical bar in insert mode
    let &t_EI = "\<Esc>]50;CursorShape=0\x7" " Block in normal mode
endif

Which does this for me:

enter image description here

Source:

https://hamberg.no/erlend/posts/2014-03-09-change-vim-cursor-in-iterm.html

like image 93
Eric Leschinski Avatar answered Sep 30 '22 10:09

Eric Leschinski


This did the trick:

set guicursor=i:ver25-iCursor

I had to reduce the 100 to 25

like image 34
mpora Avatar answered Sep 30 '22 09:09

mpora