Neovim extension plugin for fzf-lua to integrate with zoxide.
This provides the capability to open recently used directories, and sync with zoxide when directories are opened in Neovim.
This project depends on fzf-lua, make sure it is set up correctly before continuing.
Using lazy.nvim
{
"calebfroese/fzf-lua-zoxide",
dependencies = { "ibhagwan/fzf-lua" },
config = function()
require('fzf-lua-zoxide').setup()
end
}
Using packer.nvim
use { "calebfroese/fzf-lua-zoxide",
requires = { "ibhagwan/fzf-lua" }
}
:lua require('fzf-lua-zoxide').open()
or assign a keymapping
vim.keymap.set("n", "<c-O>", require('fzf-lua-zoxide').open, { desc = "Fzf Dirs" })
Options can be provided to open
:
require('fzf-lua-zoxide').open({
---@field preview? string The command to run in the preview window
preview = "ls -la {}",
---@field callback? fun(selected: string) Callback to run on select
callback = function()
-- For example, you could open the directory in netrw after selecting one
vim.cmd("e " .. selected)
end,
})
By default the plugin simply calls ls {}
to populate the preview window.
The plugin can be configured with the following options:
require('fzf-lua-zoxide').setup({
---@field zoxide? string Zoxide executable
zoxide = "~/.bin/zoxide",
---@field add_on_dir_changed? boolean Whether to automatically add to Zoxide on nvim DirChanged event
add_on_dir_changed = true,
})
{
zoxide = "zoxide",
add_on_dir_changed = true,
}