How to change the cursor between Normal and Insert modes in Vim?
vim
Solution
A popular approach to indicate switching to and from Insert mode is toggling the `cursorline` option, which is responsible for whether the current screen line is highlighted (see `:help cursorline`):
:autocmd InsertEnter * set cursorline
:autocmd InsertLeave * set nocursorline
or, alternatively:
:autocmd InsertEnter,InsertLeave * set cul!
Modify the `CursorLine` highlighting group to change the styling of the cursor line to your liking (see `:help :highlight` and `:help highlight-groups`).
This approach assumes, of course, that you do not use the cursor line highlighting in Normal mode.
Problem
I would like to know how to change, if possible, the cursor in Vim (in color, shape, etc.) depending on what mode you are in. I am constantly forgetting that I am not in Insert mode and start typing code, which results in all sorts of crazy things happening. It would be helpful if there was some sort of visual indication on the cursor.