wasd
wasd

Reputation: 81

Neovim: Change Cursor Type for Insert Mode

I'm new to (Neo) Vim and I'm trying to find configurations that I like and learn from them.

Whenever I watch people code in vim/neovim, I notice that their cursor a thick box, same as when they're outside of Insert mode.

Basically, while in insert mode, my cursor is thin like this |, but I want to change it so that it's thick like it is when you're outside of insert mode.

I'm on the latest version of Neovim and I use Windows 10 if that's useful information.

Upvotes: 8

Views: 26282

Answers (5)

trash bin
trash bin

Reputation: 61

Lua workaround:

vim.opt.guicursor = "n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20"

Upvotes: 6

Lshiroc
Lshiroc

Reputation: 49

In my case, putting this in my set.lua or init.lua worked:

vim.opt.guicursor = "n-v-i-c:block-Cursor"

Upvotes: 0

Wojciech Kulik
Wojciech Kulik

Reputation: 8470

You can configure Neovim using Lua to show the block cursor in insert mode:

vim.opt.guicursor = "n-v-i-c:block-Cursor"

n-v-i-c - it defines all modes in which the block cursor will be used.

n - normal, v - visual, i - insert, c - command

Upvotes: 3

jdhao
jdhao

Reputation: 28449

Yes, that is possible with guicursor option, but whether what option takes effect also depends on your terminal, for example, using Windows Termianl.

This is a working setting to make cursor shape block in insert mode:

set guicursor=n-v-c-i:block

which means to make cursor shape block in normal, visual, command, and insert mode. For more details, please use :h 'guicursor'.

Upvotes: 13

flawr
flawr

Reputation: 11628

You should be able to change that setting with guicursor. (For NeoVim there is termcap-cursor-shape.)

But note that the two different cursor actually make sense: In normal mode you are always on a character (i.e. you can use i and a to produce different results), while in insert mode the curor must be between two characters.

Personally I think that it would just get confusing to have a blocky cursor in insert mode due to the reason above, but furthermore it would make it harder to distinguish the two modes too!

And for future reference, there is a dedicated stackexchange for vi and vim!

Upvotes: 0

Related Questions