How do I change the cursor between Normal and Insert modes in Vim?

后端 未结 11 783
无人及你
无人及你 2020-12-04 10:56

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

11条回答
  •  情话喂你
    2020-12-04 11:15

    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,InsertLeave * set cul!
    

    or, alternatively:

    :autocmd InsertEnter * set cul
    :autocmd InsertLeave * set nocul
    

    Modify the CursorLine highlighting group to change the styling of the cursor line to your liking (see :help :highlight and :help highlight-groups).

提交回复
热议问题