Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open fzf.vim in split instead of floating window

I've just setup Neovim v0.4.4 with fzf.vim (commit) on a new machine running Manjaro using sudo pacman -Sy neovim. Previously (unknown version) the window for FZF has appeared in a split at the bottom but now it appears as a window in the middle of the window as in the screenshot below. How do I configure it to be a split at the bottom instead?

.vimrc:

call plug#begin('~/.vim/plugged')


" PlugInstall and PlugUpdate will clone fzf in ~/.fzf and run install script
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'


" Initialize plugin system
call plug#end()

map <C-F> :Files<CR>

enter image description here

like image 411
Oskar Persson Avatar asked Sep 15 '20 16:09

Oskar Persson


People also ask

Is there a way to open a split file in Vim?

There's a number of these available, but fzf (and the matching Vim plugin) does allow you to open in splits with a keybind. Unfortunately, both the above options don't really care about the directory of the file you're editing, unless it happens to be the current working directory.

How to create a floating window using breakhabitswindow?

Here we especially make use of width and height to define the size of the window and anchor, col and row to define where on the screen we will place it. Calling this function with :call BreakHabitsWindow () will spawn a simple empty floating window: My second requirement is to have a box drawn in the buffer to show the borders of the window.

Why can't I create a test file in fzf?

If you have several files relative to your current working directory with the same name, you may need to scroll or search for the path to find what you're actually looking for. Also note that FZF doesn't allow file creation or manipulation (see #107 ), which may be a problem if you have a .ts file you'd like to make a test file from.

How do I open a file in a split file?

and type the file you actually want. If you're open to using fzf-vim, then you can use CTRL + h to open a file in a split. Show activity on this post.


1 Answers

There are five kinds of layout for fzf according to documentation:

  • window (your actual behavior)
  • down / up / left / right

For your requested setup, you should add in your .vimrc or where you are putting your settings the following line: let g:fzf_layout = { 'down': '~40%' } where the ~40% is the percentage of all your nvim window

like image 199
Jacob Tuz Avatar answered Sep 28 '22 18:09

Jacob Tuz