git-messenger.vim icon indicating copy to clipboard operation
git-messenger.vim copied to clipboard

Use Vim8.1 popup feature

Open rhysd opened this issue 5 years ago • 14 comments

https://github.com/vim/vim/blob/master/runtime/doc/popup.txt

It seems about to be being implemented. If it works and sufficient for this plugin, using it would be better for Vim users.

rhysd avatar May 29 '19 14:05 rhysd

As far as I understand a popup window cannot be focused so it wouldn't be possible to use the mappings etc.

airblade avatar Sep 02 '19 12:09 airblade

Yeah, the point is a blocker. Currently I don't have good idea to workaround that.

rhysd avatar Sep 02 '19 12:09 rhysd

I think if the user wants to use popups to see the blame info, it's useful even if they can't do anything with it. I suppose you can make the popup as big as the blame info, up to the size of the window, to minimise scrolling.

airblade avatar Sep 02 '19 12:09 airblade

Current implementation determines size of float window following contents. However, sometimes commit body is too big. And if user wants to see diff of the commit, it would be not fit to window (diff is usually bigger).

Another point is local key maps in the float window. This plugin provides some mappings such as o (show older commit). I also don't have good idea to provide the mappings without focusing (entering) a popup. Neovim's float window allows to move cursor into popup, so we can define window-local mappings. But that seems not available in Vim.

rhysd avatar Sep 02 '19 12:09 rhysd

https://github.com/vim/vim/issues/4577 https://github.com/mhinz/vim-signify/pull/302

blayz3r avatar Sep 18 '19 23:09 blayz3r

:help previewpopup

tracyone avatar Oct 07 '19 02:10 tracyone

bump

blayz3r avatar Nov 15 '19 16:11 blayz3r

I think operation likely that. bfrg/vim-qf-preview: Vim plugin to preview current quickfix item in a popup window (Vim-only)

(skip into preview; direct operation.)

tsuyoshicho avatar Dec 06 '19 00:12 tsuyoshicho

Also the window currently opened immediately closes... I don't know why

sheerun avatar Aug 06 '20 07:08 sheerun

@sheerun That's not related to this issue. See https://github.com/rhysd/git-messenger.vim/issues/54#issuecomment-667542845

rhysd avatar Aug 06 '20 07:08 rhysd

nmap <silent><Leader>g :call setbufvar(winbufnr(popup_atcursor(split(system("git log -n 1 -L " . line(".") . ",+1:" . expand("%:p")), "\n"), { "padding": [1,1,1,1], "pos": "botleft", "wrap": 0 })), "&filetype", "git")<CR>

image

co -> https://www.reddit.com/user/sheerun/

blayz3r avatar Aug 06 '20 22:08 blayz3r

Are Vim 8.1 and 8.2's popup windows the same?

Just asking because with Vim 8.2 along with FZF you can set let g:fzf_layout = { 'window': { 'width': 0.5, 'height': 0.6 } } which gives you a floating window style popup that you can focus, interact with and move the cursor in. Even mouse events work.

There's lots of discussion around it and Vim script snippets at https://github.com/junegunn/fzf.vim/issues/821. That's in the context of FZF of course, but maybe that method could be applied here too?

nickjj avatar Aug 07 '20 23:08 nickjj

All right, I'll make time to try to implement this feature this week.

rhysd avatar Aug 09 '20 18:08 rhysd

Discussion here: https://github.com/vim/vim/issues/5639#issuecomment-593419210

blayz3r avatar Oct 05 '20 19:10 blayz3r