mirror of
https://github.com/amix/vimrc
synced 2025-07-08 09:35:00 +08:00
lets try again...
This commit is contained in:
52
sources_non_forked/tlib/autoload/tlib/balloon.vim
Normal file
52
sources_non_forked/tlib/autoload/tlib/balloon.vim
Normal file
@ -0,0 +1,52 @@
|
||||
" @Author: Tom Link (micathom AT gmail com?subject=[vim])
|
||||
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
||||
" @GIT: http://github.com/tomtom/tlib_vim/
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Created: 2010-08-30.
|
||||
" @Last Change: 2010-09-05.
|
||||
" @Revision: 23
|
||||
|
||||
|
||||
function! tlib#balloon#Register(expr) "{{{3
|
||||
if !has('balloon_eval')
|
||||
return
|
||||
endif
|
||||
if !exists('b:tlib_balloons')
|
||||
let b:tlib_balloons = []
|
||||
endif
|
||||
if !&ballooneval
|
||||
setlocal ballooneval
|
||||
endif
|
||||
if &balloonexpr != 'tlib#balloon#Expr()'
|
||||
if !empty(&balloonexpr)
|
||||
call add(b:tlib_balloons, &balloonexpr)
|
||||
endif
|
||||
setlocal ballooneval balloonexpr=tlib#balloon#Expr()
|
||||
endif
|
||||
if index(b:tlib_balloons, a:expr) == -1
|
||||
call add(b:tlib_balloons, a:expr)
|
||||
endif
|
||||
endf
|
||||
|
||||
|
||||
function! tlib#balloon#Remove(expr) "{{{3
|
||||
if !exists('b:tlib_balloons')
|
||||
call filter(b:tlib_balloons, 'v:val != a:expr')
|
||||
endif
|
||||
endf
|
||||
|
||||
|
||||
function! tlib#balloon#Expr() "{{{3
|
||||
if !exists('b:tlib_balloons')
|
||||
return ''
|
||||
endif
|
||||
let text = map(copy(b:tlib_balloons), 'eval(v:val)')
|
||||
call filter(text, '!empty(v:val)')
|
||||
if has('balloon_multiline')
|
||||
return join(text, "\n----------------------------------\n")
|
||||
else
|
||||
return get(text, 0, '')
|
||||
endif
|
||||
endf
|
||||
|
||||
|
Reference in New Issue
Block a user