diff --git a/src/gui/runtime/doc/nvim_gui_shim.txt b/src/gui/runtime/doc/nvim_gui_shim.txt index daac2fd29..1d99baed7 100644 --- a/src/gui/runtime/doc/nvim_gui_shim.txt +++ b/src/gui/runtime/doc/nvim_gui_shim.txt @@ -121,6 +121,11 @@ GuiMousehide(enabled) enables mouse hiding while typing. If enabled is 1, as soon as the user types the mouse cursor is concealed. When the user moves the mouse, the cursor becomes visible. Replaces |'mousehide'|. + *GuiClose()* +GuiClose() notifies the GUI that it should close. The GUI may or may not +respect this request. The shim setups an autocommand to call this function +when the |'VimLeave'| event occurs. + ============================================================================== 4. Internals diff --git a/src/gui/runtime/plugin/nvim_gui_shim.vim b/src/gui/runtime/plugin/nvim_gui_shim.vim index 68c855432..2fa09455c 100644 --- a/src/gui/runtime/plugin/nvim_gui_shim.vim +++ b/src/gui/runtime/plugin/nvim_gui_shim.vim @@ -4,8 +4,13 @@ if !has('nvim') || exists('g:GuiLoaded') endif let g:GuiLoaded = 1 +" Close the GUI +function! GuiClose() abort + call rpcnotify(0, 'Gui', 'Close') +endfunction + " Notify the GUI when exiting Neovim -autocmd VimLeave * call rpcnotify(0, 'Gui', 'Close')" +autocmd VimLeave * call GuiClose() " A replacement for foreground() function! GuiForeground() abort