README.md

July 17, 2026 ยท View on GitHub

fzf-oil.nvim

fzf-oil-demo

Neovim Lua License

A tiny (~400 LOC) plugin combining fzf-lua and oil.nvim for finding and file browsing, with seamless toggling between them.

Features

  • Browse directories with fzf-lua, navigate into subdirectories or up to parent.
  • Go back through visited directories in either mode.
  • Toggle into oil.nvim for full directory editing, toggle back to fzf.
  • Seamless transitions, query and position are preserved when toggling.
  • Fuzzy find files across all subdirectories with a single toggle.
  • Sizing, backdrop, border, and preview are inherited from your fzf-lua config.
  • The same navigation keys work in both modes, all of them configurable.

Requirements

Installation

With vim.pack (Neovim 0.12+):

vim.pack.add({
    "https://github.com/ibhagwan/fzf-lua",
    "https://github.com/stevearc/oil.nvim",
    "https://github.com/ingur/fzf-oil.nvim",
})

With lazy.nvim:

{
    "ingur/fzf-oil.nvim",
    dependencies = {
        "ibhagwan/fzf-lua",
        "stevearc/oil.nvim",
    },
}

Quickstart

-- use fzf-oil's helpers so oil matches fzf-lua's styling
require("oil").setup({
    float = require("fzf-oil").float,
    preview_win = require("fzf-oil").preview_win,
})

local browser = require("fzf-oil").setup()

vim.keymap.set("n", "<leader>fb", browser.browse, { desc = "File browser" })

Tip

The float and preview_win helpers sync oil's floating windows with your fzf-lua config (size, border, title, preview styling). You can also use require("fzf-oil").override directly in your own oil float config.

Defaults

local defaults = {
    cmd = "fd --max-depth 1 --hidden --exclude .git --type f --type d --type l",
    find_cmd = "fd --hidden --exclude .git --type f --type l",
    cwd = function() -- falls back to getcwd() for non-file buffers
        local dir = vim.fn.expand("%:p:h")
        if dir ~= "" and vim.fn.isdirectory(dir) == 1 then
            return dir
        end
        return vim.fn.getcwd()
    end,
    start_mode = "fzf", -- "fzf" or "oil"
    zindex = 40,
    border = "rounded",
    keys = {
        parent = "<C-h>",
        child = "<C-l>",
        down = "<C-j>",
        up = "<C-k>",
        toggle_find = "<C-f>",
        edit = "<C-e>",
        home = "<C-g>",
        back = "<C-o>",
        quit = "q",
    },
    fzf_exec_opts = {},
}

Note

fzf_exec_opts is deep-merged into the options passed to fzf-lua's fzf_exec, so you can override any fzf-lua picker option (previewer, layout, actions, ...).

Keybindings

fzf mode

KeyAction
<CR>Open file or enter directory
<C-h>Go to parent directory
<C-l>Enter directory
<C-j> / <C-k>Move down / up
<C-f>Toggle find mode
<C-e>Switch to oil
<C-g>Jump to home directory
<C-o>Go to previous directory

oil mode

KeyAction
<C-h>Go to parent directory
<C-l>Enter directory
<C-j> / <C-k>Move down / up
<C-f>Switch to fzf in find mode
<C-e>Switch back to fzf
<C-g>Jump to home directory
<C-o>Go to previous directory
qQuit the browser

All keys are configurable through setup({ keys = { ... } }).