1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-04-13 21:09:10 +08:00

Fix cursor shape option (#4168)

This commit is contained in:
Wang Shidong 2021-04-04 13:46:48 +08:00 committed by GitHub
parent 55a7b77786
commit e1666d8e9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 24 deletions

View File

@ -1363,7 +1363,7 @@ function! SpaceVim#end() abort
" tab options:
set smarttab
let &expandtab = g:spacevim_expand_tab
if g:spacevim_default_indent > 0
let &tabstop = g:spacevim_default_indent
let &softtabstop = g:spacevim_default_indent
@ -1433,30 +1433,21 @@ function! SpaceVim#end() abort
call SpaceVim#autocmds#init()
if has('nvim')
if !has('nvim-0.2.0')
let $NVIM_TUI_ENABLE_CURSOR_SHAPE = g:spacevim_terminal_cursor_shape
else
if g:spacevim_terminal_cursor_shape == 0
" prevent nvim from changing the cursor shape
set guicursor=
elseif g:spacevim_terminal_cursor_shape == 1
" enable non-blinking mode-sensitive cursor
set guicursor=n-v-c:block-blinkon0,i-ci-ve:ver25-blinkon0,r-cr:hor20,o:hor50
elseif g:spacevim_terminal_cursor_shape == 2
" enable blinking mode-sensitive cursor
set guicursor=n-v-c:block-blinkon10,i-ci-ve:ver25-blinkon10,r-cr:hor20,o:hor50
endif
if !has('nvim-0.2.0') && !has('nvim')
" In old version of neovim, &guicursor do not support cursor shape
" setting.
let $NVIM_TUI_ENABLE_CURSOR_SHAPE = g:spacevim_terminal_cursor_shape
else
if g:spacevim_terminal_cursor_shape == 0
" prevent nvim from changing the cursor shape
set guicursor=
elseif g:spacevim_terminal_cursor_shape == 1
" enable non-blinking mode-sensitive cursor
set guicursor=n-v-c:block-blinkon0,i-ci-ve:ver25-blinkon0,r-cr:hor20,o:hor50
elseif g:spacevim_terminal_cursor_shape == 2
" enable blinking mode-sensitive cursor
set guicursor=n-v-c:block-blinkon10,i-ci-ve:ver25-blinkon10,r-cr:hor20,o:hor50
endif
"silent! let &t_SI = "\<Esc>]50;CursorShape=1\x7"
"silent! let &t_SR = "\<Esc>]50;CursorShape=2\x7"
"silent! let &t_EI = "\<Esc>]50;CursorShape=0\x7"
augroup nvimrc_aucmd
autocmd!
autocmd CursorHold,FocusGained,FocusLost * rshada|wshada
augroup END
endif
filetype plugin indent on
syntax on

View File

@ -65,6 +65,9 @@ function! SpaceVim#autocmds#init() abort
autocmd BufEnter * let b:_spacevim_project_name = get(g:, '_spacevim_project_name', '')
autocmd SessionLoadPost * let g:_spacevim_session_loaded = 1
autocmd VimLeavePre * call SpaceVim#plugins#manager#terminal()
if has('nvim')
autocmd CursorHold,FocusGained,FocusLost * rshada|wshada
endif
augroup END
endfunction