Awesome
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
Requirement
- vim
exists('*popup_create')
- neovim
exists('*nvim_open_win')
0.7.0
or above, see this- you may
let g:ZFPopup_nvim_enableOnOldVer=1
to bypass the check, but may causeE5601: Cannot close window, only floating window would remain
- you may
Install
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
Usage
if ZFPopupAvailable()
let popupId = ZFPopupCreate({
\ 'pos' : 'cursor|right|bottom',
\ })
call ZFPopupContent(popupId, ['line1', 'line2'])
call ZFPopupClose(popupId)
endif
Functions
-
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|bottom
width
/height
[1, 9999)
: use fixed size(0.0, 1.0)
: use size relative to screen size- others : use
1.0/4
and5
x
/y
: offset according topos
wrap
:0
or1
, whether:h wrap
in popup window, default is1
-
ZFPopupClose(popupId)
-
ZFPopupShow(popupId)
-
ZFPopupHide(popupId)
-
ZFPopupContent(popupId [, content])
- when
content
not specified, return current content (as List of strings) - when
content
specified, set the entire content of popup buffer
- when
-
ZFPopupConfig(popupId [, config])
- when
config
not specified, return popup's config - when
config
specified, 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