Skip to content

Commit bef4615

Browse files
committed
unlet g:loaded_clipboard_provider on clipboard reload
With the upstream merge of neovim/neovim#10161 we can now safely reload the clipboard provider. There is no tagged version of neovim with this yet but the only difference is the unlet command which can be made to ignore errors if we are still running older neovim version (i.e. <= 0.3.8).
1 parent 0360b33 commit bef4615

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/gui/runtime/plugin/nvim_gui_shim.vim

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,16 @@ function GuiClipboard()
165165
\ },
166166
\ }
167167

168-
" When the clipboard provider is sourced it short circuits if it cannot
169-
" find a working clipboard - this behaviour is used internally by nvim to
170-
" check if the provider is available, by checking for
171-
" provider#clipboard#Call which is not defined if no clipboard is
172-
" available.
168+
" We need to reload the neovim clipboard provider here so it picks up on
169+
" g:clipboard. In older versions of neovim (<=0.3.8) the provider would
170+
" short circuit if a working clipboard was not available. After 0.3.8
171+
" the provider should not short circuit, andunsetting
172+
" g:loaded_clipboard_provider will enable a full reload of the provider.
173173
"
174-
" TLDR; we need to source this to reinitialize the clipboard provider
175-
runtime autoload/provider/clipboard.vim
174+
" TLDR; source this to reinitialize the clipboard provider, this may not
175+
" work
176+
unlet! g:loaded_clipboard_provider
177+
runtime autoload/provider/clipboard.vim
176178
endfunction
177179

178180
" Directory autocommands for Treeview

0 commit comments

Comments
 (0)