-
-
Notifications
You must be signed in to change notification settings - Fork 587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Floating Windows Support VIM Popup #821
Comments
If floating windows of Neovim is what you meant, see #664. |
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? |
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. |
like liuchengxu/vim-clap |
for those of you who are still looking, check out this config from the creator of FZF (@junegunn): https://github.com/junegunn/dotfiles/commit/9545174d0e34075d16c1d6a01eed820bce9d6cc0 |
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 |
@runar Please read through https://github.com/junegunn/fzf/blob/master/README-VIM.md |
@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? |
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 |
Yggdroot/LeaderF and liuchengxu/vim-clap have workarounds |
@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. |
e.g. let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6 } } Based on the code from junegunn/fzf.vim#821 (comment) by @lacygoill.
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. 😄 |
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? |
@junegunn will you be releasing a new version of Thanks! |
@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 ( |
@junegunn, if you don't mind, I'm not exactly getting why Just trying to clarify the structure in my head :) Thanks. |
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! |
I have a local
|
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/openssl@1.1/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 |
@mhanberg I have the same problem. Workaround for me is to do |
@mhanberg @ardenzhan Added junegunn/fzf@0896036 to workaround the issue. |
@junegunn thank you! That solves the problem for me as well. |
@josefson make sure you have this patch vim/vim@3c01c4a |
Does the new VIM popup feature enable FZF to float in VIM
The text was updated successfully, but these errors were encountered: