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",
},
}
-- 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
floatandpreview_winhelpers sync oil's floating windows with your fzf-lua config (size, border, title, preview styling). You can also userequire("fzf-oil").overridedirectly in your own oil float config.
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>",
quit = "q",
home = "<C-g>",
},
fzf_exec_opts = {},
}
[!NOTE]
fzf_exec_optsis deep-merged into the options passed to fzf-lua'sfzf_exec, so you can override any fzf-lua picker option (previewer, layout, actions, ...).
| Key | Action |
|---|---|
<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 |
| Key | Action |
|---|---|
<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 |
q |
Quit the browser |
<C-g> |
Jump to home directory |
All keys are configurable through setup({ keys = { ... } }).