Skip to content

Commit 967be08

Browse files
committed
Bugfix :GhostTextStart and :GhostTextStop
1 parent 6f8a59b commit 967be08

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

autoload/nvim_ghost.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ if !has('nvim')
22
finish
33
endif
44

5-
function! nvim_ghost#init()
5+
function! nvim_ghost#init(defer = 1)
66
if !g:nvim_ghost_use_script && (!filereadable(g:nvim_ghost_binary_path) ||
77
\ readfile(g:nvim_ghost_installation_dir .. 'binary_version')[0] !=
88
\ readfile(g:nvim_ghost_binary_path .. ".version")[0]
99
\)
1010
call nvim_ghost#installer#install(function("nvim_ghost#enable"))
1111
else
12-
call nvim_ghost#enable(1)
12+
call nvim_ghost#enable(a:defer)
1313
endif
1414
endfunction
1515

plugin/nvim_ghost.vim

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,18 @@ endif
5151

5252
" If autostart is disabled, add GhostTextStart command
5353
if !g:nvim_ghost_autostart
54-
command! GhostTextStart
55-
\| call nvim_ghost#init()
56-
\| doau <nomodeline> nvim_ghost UIEnter
57-
\| delcommand GhostTextStart
58-
\| command GhostTextStop
59-
\| call nvim_ghost#disable()
54+
command! GhostTextStart call s:GhostTextStart()
55+
fun! s:GhostTextStart()
56+
call nvim_ghost#init(0)
57+
doau <nomodeline> nvim_ghost UIEnter
58+
delcommand GhostTextStart
59+
command GhostTextStop call s:GhostTextStop()
60+
endfun
61+
fun! s:GhostTextStop()
62+
call nvim_ghost#disable()
63+
delcommand GhostTextStop
64+
command GhostTextStart call s:GhostTextStart()
65+
endfun
6066
finish
6167
endif
6268

0 commit comments

Comments
 (0)