Floating Windows Support VIM Popup · Issue #821 · junegunn/fzf.vim · GitHub
source link: https://github.com/junegunn/fzf.vim/issues/821#issuecomment-581273191
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upFloating Windows Support VIM Popup #821
Closed
blayz3r opened this issue on Jun 7, 2019 · 41 comments
Closed
Floating Windows Support VIM Popup #821
blayz3r opened this issue on Jun 7, 2019 · 41 comments
Comments
Does the new VIM popup feature enable FZF to float in VIM |
Owner
junegunn commented on Jun 8, 2019
If floating windows of Neovim is what you meant, see #664. |
Author
blayz3r commented on Jun 8, 2019
I meant Vim proper. Can the same be achieved with Vim's Popup feature? |
I don't know about "the new VIM popup feature". Can you explain what it is? Any reference? |
Author
blayz3r commented on Jun 9, 2019
There was discussion here vim/vim#4063 and possible with use with FZF like plugins here vim/vim#4063 (comment) |
@junegunn it looks something like this: It is supported in both NeoVim and Vim. Plugins such as denite.nvim, coc.nvim, vimgon-quest-menu, etc have already implemented it if you are curious to see how it's done. |
Author
blayz3r commented on Oct 7, 2019
like liuchengxu/vim-clap |
for those of you who are still looking, check out this config from the creator of FZF (@junegunn): junegunn/dotfiles@9545174 |
if has('nvim') && exists('&winblend') && &termguicolors Only for neovim, but we want vim too |
Right. Didn't realize that - my bad. |
Would love to this setup/feature possible with Vim8! Any news? |
I spent a few hours on this today, but ended up with nothing: The results from fzf is printed in the background with the popup (floating window) hovering on top of it. I couldn’t get the result to fill the popup, so it seems I’ll have to leave this to someone more experienced than myself. |
@runar can you share your code please? I don’t have so much experience on vim plugin but if I can help :) |
@damofthemoon There’s not really any code to share, as all I did was read the Vim documentation on popup windows and try to convert this function to use I don’t understand what the second parameter (
|
No better result than you @runar... I can't figure out how it could work for Vim8, I suspect Nvim handles differently pop-up feature |
@lightalchemist I'm aware of that, which is why I’m referencing the same commit (where What I don't know, is what kind of values |
@junegunn Just what I needed, thank you! I will take a new look at this later. |
I can only create a popup with Vim8 but not fill it with FZF output. Another thing disturbing me is the popup needs to be clear with popup_clear() function, it doesn't disappear automatically. Can we access a kind of callback to clean that @junegunn? Any idea why we can't fill the popup with FZF? |
Owner
junegunn commented on Dec 2, 2019
I'm a Neovim user, and I have no experience with Vim popups. You might want to read the linked issue above. Bram doesn't seem to understand why we want to open a terminal buffer (running fzf) inside a popup window. |
Thanks for pointing this problem @junegunn, now I understand the problem better. I see in the issue tracking a solution could exist but it sounds to me tricky while it's simple to open FZF in a pane (I did try with |
Owner
junegunn commented on Dec 4, 2019
@blayz3r They are native Vim plugins unlike fzf, so they don't have the problem. |
FWIW, this seems to make fzf display its terminal buffer in a Vim popup window:
The code is similar to the one for Nvim documented in the wiki. You can configure the width and the height of the window (as a percentage of the total width/height available), as well as the color of the border, by changing the arguments passed to
To support both Vim and Neovim:
|
@lacygoill Excellent works flawlessly |
@lacygoill Thanks, I'll consider adding that to the main fzf repo so anyone can easily use it. |
Popup support added in junegunn/fzf@7ceb58b. let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6 } } " Border color let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6, 'highlight': 'Todo' } } " Border style (rounded / sharp / horizontal) let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6, 'highlight': 'Todo', 'border': 'sharp' } } Works for me fine both on Vim and Neovim. |
Contributor
jesseleite commented on Feb 4
Is it still possible to align the fzf results at the bottom, but still as a popup to prevent fzf from pushing the active buffer upwards off the screen? |
@mhanberg Yes, I will. But there are some nice stuff on the review queue that I'd like to include in the next release, so it will take a few more days. You might already know this, but you can still use the latest vim plugin of fzf even if you installed the binary via Homebrew. @jesseleite While the above dictionary form ( |
henrebotha commented on Feb 4
The new feature crashed my machine before I updated my Vim to 8.2. I think a feature guard of some description is in order! |
chris-kahn commented on Feb 4
How to make it float relative to the current buffer/window rather than the entire editor? |
I am able to get this to work in NeoVim, but when using Vim I run into the following error when calling The following was produced using the current Vim as installed by Homebrew (MacVim is not updated as of yet). Any ideas? Thanks! This is the fzf configuration that I use " .vimrc function! RipgrepFzf(query, fullscreen) let command_fmt = 'rg --column --line-number --no-heading --color=always --smart-case %s || true' let initial_command = printf(command_fmt, shellescape(a:query)) let reload_command = printf(command_fmt, '{q}') let spec = {'options': ['--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command], 'window': { 'width': 0.9, 'height': 0.6 }} call fzf#vim#grep(initial_command, 1, fzf#vim#with_preview(spec), a:fullscreen) endfunction command! -nargs=* -bang RG call RipgrepFzf(<q-args>, <bang>0) silent! nnoremap <c-p> :Files<cr> nnoremap gl :BLines<cr> nnoremap <leader>a :RG<cr> let g:fzf_layout = { 'window': { 'width': 0.5, 'height': 0.6 } } # .zshrc export FZF_DEFAULT_COMMAND="rg --files --hidden --glob '!.git/'" Vim Version ⚡︎/usr/local/bin/vim --version VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Feb 3 2020 01:40:55) macOS version Included patches: 1-200 Compiled by Homebrew Huge version without GUI. Features included (+) or not (-): +acl -farsi -mouse_sysmouse -tag_old_static +arabic +file_in_path +mouse_urxvt -tag_any_white +autocmd +find_in_path +mouse_xterm -tcl +autochdir +float +multi_byte +termguicolors -autoservername +folding +multi_lang +terminal -balloon_eval -footer -mzscheme +terminfo +balloon_eval_term +fork() +netbeans_intg +termresponse -browse +gettext +num64 +textobjects ++builtin_terms -hangul_input +packages +textprop +byte_offset +iconv +path_extra +timers +channel +insert_expand +perl +title +cindent +job +persistent_undo -toolbar -clientserver +jumplist +popupwin +user_commands +clipboard +keymap +postscript +vartabs +cmdline_compl +lambda +printer +vertsplit +cmdline_hist +langmap +profile +virtualedit +cmdline_info +libcall -python +visual +comments +linebreak +python3 +visualextra +conceal +lispindent +quickfix +viminfo +cryptv +listcmds +reltime +vreplace +cscope +localmap +rightleft +wildignore +cursorbind +lua +ruby +wildmenu +cursorshape +menu +scrollbind +windows +dialog_con +mksession +signs +writebackup +diff +modify_fname +smartindent -X11 +digraphs +mouse -sound -xfontset -dnd -mouseshape +spell -xim -ebcdic +mouse_dec +startuptime -xpm +emacs_tags -mouse_gpm +statusline -xsmp +eval -mouse_jsbterm -sun_workshop -xterm_clipboard +ex_extra +mouse_netterm +syntax -xterm_save +extra_search +mouse_sgr +tag_binary system vimrc file: "$VIM/vimrc" user vimrc file: "$HOME/.vimrc" 2nd user vimrc file: "~/.vim/vimrc" user exrc file: "$HOME/.exrc" defaults file: "$VIMRUNTIME/defaults.vim" fall-back for $VIM: "/usr/local/share/vim" Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X -DMACOS_X_DARWIN -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 Linking: clang -L. -fstack-protector-strong -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/[email protected]/lib -L/usr/local/opt/readline/lib -L/usr/local/lib -o vim -lncurses -liconv -lintl -framework AppKit -L/usr/local/opt/lua/lib -llua5.3 -mmacosx-version-min=10.15 -fstack-protector-strong -L/usr/local/lib -L/usr/local/Cellar/perl/5.30.1/lib/perl5/5.30.1/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc -L/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/config-3.7m-darwin -lpython3.7m -framework CoreFoundation -lruby.2.6 |
No one assigned
None yet
No milestone
Successfully merging a pull request may close this issue.
None yet
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK