1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-24 05:30:07 +08:00

Add neovim#gui api (#2368)

* Add neovim#gui api

* Add gui function
This commit is contained in:
Wang Shidong 2019-05-06 11:33:00 +08:00 committed by GitHub
parent 7835efd261
commit 916312fa79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,34 @@
let s:self = {}
function! s:self.gui_name() abort
if !has('nvim-0.3')
return ''
endif
let uis = nvim_list_uis()
if len(uis) == 0
echoerr "No UIs are attached"
return
endif
" Use the last UI in the list
let ui_chan = uis[-1].chan
let info = nvim_get_chan_info(ui_chan)
return get(info.client, 'name', '')
endfunction
function! s:self.toggle_tabline(enable) abort
call rpcnotify(0, 'Gui', 'Option', 'Tabline', a:enable)
endfunction
function! s:self.toggle_popupmenu(enable) abort
call rpcnotify(0, 'Gui', 'Option', 'Popupmenu', a:enable)
endfunction
function! SpaceVim#api#neovim#gui#get()
return deepcopy(s:self)
endfunction