From c3673abd93d8fe5c9ef3be38ffc961e9e5dc429b Mon Sep 17 00:00:00 2001 From: Alisue Date: Thu, 20 May 2021 23:41:08 +0900 Subject: [PATCH] Fix cursor hide in GUI vim Close #339 --- autoload/fern/internal/cursor.vim | 60 +++++++++++++++---------------- 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/autoload/fern/internal/cursor.vim b/autoload/fern/internal/cursor.vim index 9b8cb9be..5492f004 100644 --- a/autoload/fern/internal/cursor.vim +++ b/autoload/fern/internal/cursor.vim @@ -9,37 +9,35 @@ function! fern#internal#cursor#restore() abort call s:restore() endfunction -if has('nvim') - if has('nvim-0.5.0') - " https://github.com/neovim/neovim/issues/3688#issuecomment-574544618 - function! s:hide() abort - set guicursor+=a:FernTransparentCursor/lCursor - endfunction - - function! s:restore() abort - set guicursor+=a:Cursor/lCursor - let &guicursor = s:guicursor_saved - endfunction - - function! s:highlight() abort - highlight default FernTransparentCursor gui=strikethrough blend=100 - endfunction - call s:highlight() - - augroup fern_internal_cursor - autocmd! - autocmd ColorScheme * call s:highlight() - augroup END - else - " No way thus use narrow cursor instead - function! s:hide() abort - set guicursor+=a:ver1 - endfunction - - function! s:restore() abort - let &guicursor = s:guicursor_saved - endfunction - endif +if has('nvim-0.5.0') + " https://github.com/neovim/neovim/issues/3688#issuecomment-574544618 + function! s:hide() abort + set guicursor+=a:FernTransparentCursor/lCursor + endfunction + + function! s:restore() abort + set guicursor+=a:Cursor/lCursor + let &guicursor = s:guicursor_saved + endfunction + + function! s:highlight() abort + highlight default FernTransparentCursor gui=strikethrough blend=100 + endfunction + call s:highlight() + + augroup fern_internal_cursor + autocmd! + autocmd ColorScheme * call s:highlight() + augroup END +elseif has('nvim') || has('gui_running') + " No way thus use narrow cursor instead + function! s:hide() abort + set guicursor+=a:ver1 + endfunction + + function! s:restore() abort + let &guicursor = s:guicursor_saved + endfunction else " Vim supports 't_ve' function! s:hide() abort