Skip to content
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

Height option in spec does not have an effect #976

Closed
4 tasks done
mroavi opened this issue Apr 5, 2020 · 3 comments
Closed
4 tasks done

Height option in spec does not have an effect #976

mroavi opened this issue Apr 5, 2020 · 3 comments
Labels

Comments

@mroavi
Copy link

mroavi commented Apr 5, 2020

The 'height', '80%' option in the following command does not have any effect.

command! -nargs=? -bang -complete=dir Files call fzf#vim#files(
    \ <q-args>,
    \ fzf#vim#with_preview({'options': ['--no-reverse', '--height', '80%', '--preview-window', 'right:60%']}),
    \ <bang>0)

Initially I had

let g:fzf_layout = { 'down': '~20%' }

on my .vimrc. I removed it to see if it was overriding it. However, it still did not have any effect. Apparently, FZF remembers the old height value assigned to g:fzf_layout. How can I enforce a custom height option for a given command? For example, I prefer :Files or :Gr to have a larger height than :Commands.

@junegunn
Copy link
Owner

junegunn commented Apr 5, 2020

--height option makes sense only when you run fzf outside of Vim. When we run fzf inside Vim, we open it in a terminal buffer, and fzf should use the whole screen estate of the buffer, so we enforce --no-height (i.e. Use the entire screen of the terminal).

Layout options for Vim are described in

https://github.com/junegunn/fzf/blob/master/README-VIM.md#fzfrun

call fzf#run(fzf#vim#with_preview({'options': ['--reverse'], 'down': '80%'}))
call fzf#run(fzf#vim#with_preview({'options': ['--reverse'], 'left': '80%'}))

@mroavi
Copy link
Author

mroavi commented Apr 5, 2020

@junegunn Thanks for the answer, I have it working now. The reason why I got confused was because '--no-height' does have an effect. Would it make sense to ignore that option as well?

@junegunn
Copy link
Owner

junegunn commented Apr 5, 2020

Well, it's complicated, you probably don't really want to know the nitty-gritty :)

On regular Vim, with down layout, fzf does not open in a terminal buffer, but using --height option. So in this particular case, you can get the impression that --height or --no-height has an effect. But it's an exception, because --height cannot support left, right, or up layouts, so we use terminal buffers in those cases.

On the other hand, on Neovim, fzf always opens in a terminal buffer because --height doesn't work well with Neovim. So --height or --no-height doesn't have any effect on Neovim.

You can read more about this in junegunn/fzf#1860

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants