util to show popup for vim8 and neovim
if you like my work, check here for a list of my vim plugins, or buy me a coffee
- vim
exists('*popup_create')
- neovim
exists('*nvim_open_win')0.7.0or above, see this- you may
let g:ZFPopup_nvim_enableOnOldVer=1to bypass the check, but may causeE5601: Cannot close window, only floating window would remain
- you may
use Vundle or any other plugin manager you like to install
Plugin 'ZSaberLv0/ZFVimPopup'
Plugin 'ZSaberLv0/ZFVimJob' " optional, recommeded to combine with this job utility
if ZFPopupAvailable()
let popupId = ZFPopupCreate({
\ 'pos' : 'cursor|right|bottom',
\ })
call ZFPopupContent(popupId, ['line1', 'line2'])
call ZFPopupClose(popupId)
endif
-
ZFPopupAvailable() -
ZFPopupCreate([config])return popupId if success, or -1 if failed
config: (default config can be configured by
g:ZFPopup_defaultConfig)pos:left/right/top/bottom/cursor, can combine as 'cursor|left|top', element order doesn't matter, default isright|bottomwidth/height[1, 9999): use fixed size(0.0, 1.0): use size relative to screen size- others : use
1.0/4and5
x/y: offset according toposwrap:0or1, whether:h wrapin popup window, default is1
-
ZFPopupClose(popupId) -
ZFPopupShow(popupId) -
ZFPopupHide(popupId) -
ZFPopupContent(popupId [, content])- when
contentnot specified, return current content (as List of strings) - when
contentspecified, set the entire content of popup buffer
- when
-
ZFPopupConfig(popupId [, config])- when
confignot specified, return popup's config - when
configspecified, change and update popup's config
- when
-
ZFPopupFrame(popupId): return popup's window frame, as{'x':0,'y':0,'width':0,'height':0} -
ZFPopupBufnr(popupId): return popup'sbufnr() -
ZFPopupList(): return a List of popupId