Setting the cursor to a vertical thin line in vim

前端 未结 3 1839
离开以前
离开以前 2021-02-07 06:23

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         


        
3条回答
  •  猫巷女王i
    2021-02-07 06:27

    For gnome terminal version>3.15
    Add this to your ~/.vimrc.

    if has("autocmd")
      au VimEnter,InsertLeave * silent execute '!echo -ne "\e[2 q"' | redraw!
      au InsertEnter,InsertChange *
    \ if v:insertmode == 'i' | 
    \   silent execute '!echo -ne "\e[6 q"' | redraw! |
    \ elseif v:insertmode == 'r' |
    \   silent execute '!echo -ne "\e[4 q"' | redraw! |
    \ endif
    au VimLeave * silent execute '!echo -ne "\e[ q"' | redraw!
    endif
    

    You will get a block cursor in normal mode and a thin one in insert mode.

提交回复
热议问题