Comments (6)
sent initial PR at #748
from vital.vim.
Let's definitely have them. And yes let's have both the lower layor one to bridge and the one to orchestrate/coordinate a set of popups.
from vital.vim.
This one seems interesting since it supports border which I believe neovim doesn't support by default. junegunn/fzf.vim#821 (comment) I have found popup without border very difficult to use since some colorschemes blend together and very difficult to know what the issue is.
I haven't played much with popup apis but would be good to hear thoughts from those who have experience around it.
from vital.vim.
Just note.
https://github.com/lambdalisue/loupe.vim/blob/master/autoload/loupe/viewer/nvim.vim#L24-L105
To provide borders in Neovim, we need to make the border by ourselves like above.
The feature request has closed in Neovim.
neovim/neovim#9718
from vital.vim.
Here is an api I can think of some would most likely have to be pushed as a higher level api.
let s:Popup = vital#vital#import('UI.Popup')
function! s:demo() abort
let popup = s:Popup.new({
\ 'max_width': 'auto',
\ 'max_height': 'auto',
\ 'min_height': 'auto',
\ 'min_width': 'auto',
\ 'height': 10,
\ 'width': 10,
\ 'border': 1,
\ 'borderchars': '',
\ 'contents': ['hello', 'world'],
\ 'screenpos': [0, 0],
\ 'directionalhint': 'bottomleft|bottomright|topleftedge|topcenter',
\ 'focusable': 0,
\ 'zindex': 0,
\ 'drag': 0,
\ 'scrollbar': 0,
\ 'on_event': function('s:on_event'),
\ })
let winid = popup.get_winid()
let [height, width] = popup.get_dimensions(id)
call popup.set_dimensions(height, width)
" or
let height = popup.get_height()
let width = popup.get_width()
call popup.set_height(height)
call popup.set_width(width)
let isopen = popup.is_open()
call popup.show(id) " open popup
call popup.hide(id) " popup is hidden
" or
call popup.set_visibility(0)
let isvisible = popup.get_visiblity()
let contents = popup.get_contents()
call popup.set_contents(contents)
call popup.focus() " focus cursor
call popup.close(id) " disposes and cleans up the popup
endfunction
function! s:on_event(id, event, data) abort
let l:popup = s:Popup.get(a:id)
let l:bufnr = a:data['bufnr']
let l:popuid = a:id
if a:event == 'open'
" register autocmd for cursor move so can auto close the popup
elseif a:event == 'close'
elseif a:event == 'focus'
elseif a:event == 'blur'
elseif a:event == 'hidden'
elseif a:event == 'scrolldown'
elseif a:event == 'scrollup'
endif
endfunction
Another option is for s:Popup.new()
to return an id
which is a number instead of string so when using different languages such as lua or rpc it is very easy to pass references around. This does mean one would have to use call s:Popup.close(id)
//cc @hrsh7th since he had submitted a similar PR to refactor this for vim-lsp.
from vital.vim.
Seems like the border in neovim uses two floating window most likely to not have impact on syntax highlighting. In order to make it consistent with vim and have z-index the same might have to use the same trick on vim.
from vital.vim.
Related Issues (20)
- Feature request: Web.HTTP Python client support for HTTP_PROXY HOT 1
- Test Fail: MacVim latest (2019 fall) Async.Promise resolve test fails HOT 4
- Web.HTTP depend Python2, but Pyhon2 End of Life at 2020
- Vital.Data.String.nsplit() doesn't keep empty HOT 3
- Suggest: local detect problem and solution / Windows timer_start bootup delay fix
- Info: Windows reject speedy
- Text.TOML do not support dotted key HOT 1
- Fix locale during tests
- Do NOT use redir in vital/vital.vim
- Latest Async.Promise default unhandle occur and error happen HOT 2
- DateTime.from_unix_time() returns 1 hour earlier in the summer season
- The example from the README doesn't work HOT 1
- Data.String.Interpolation: test broken at latest vim. HOT 4
- Web.HTTP: python client currently not handling in code : ContentTooShortError HOT 1
- Data.List: Deprecate function in string form
- Security Update need : codecov Bash Uploader HOT 3
- ci: Fix MacVim + Lua HOT 2
- feat: Bitwise.vim: bitwise shift operator
- Vim9: support change Vim 8.1/8.2 to Vim 8.2/9.0 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vital.vim.