Skip to content

Commit

Permalink
runtime: Add GuiClose function
Browse files Browse the repository at this point in the history
  • Loading branch information
Rui Abreu Ferreira authored and equalsraf committed Mar 7, 2017
1 parent 69e9b97 commit 7b4bbbc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/gui/runtime/doc/nvim_gui_shim.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 6 additions & 1 deletion src/gui/runtime/plugin/nvim_gui_shim.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7b4bbbc

Please sign in to comment.