Skip to content

Commit

Permalink
feat: fzf.vim's global history folder (#1127)
Browse files Browse the repository at this point in the history
Use fzf.vim's `g:fzf_history_dir` to store a history file per
command.
  • Loading branch information
zyd2001 authored and ibhagwan committed Apr 8, 2024
1 parent e6b2bb6 commit 4555533
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lua/fzf-lua/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,17 @@ function M.normalize_opts(opts, globals, __resume_key)
opts.fzf_opts["--delimiter"] = string.format("[%s]", utils.nbsp)
end

-- fzf.vim's `g:fzf_history_dir` (#1127)
if vim.g.fzf_history_dir and opts.fzf_opts["--history"] == nil then
local histdir = vim.fn.expand(vim.g.fzf_history_dir)
if vim.fn.isdirectory(histdir) == 0 then
pcall(vim.fn.mkdir, histdir)
end
if vim.fn.isdirectory(histdir) == 1 and type(opts.__resume_key) == "string" then
opts.fzf_opts["--history"] = path.join({ histdir, opts.__resume_key })
end
end

-- prioritize fzf-tmux split pane flags over the
-- popup flag `-p` from fzf-lua defaults (#865)
opts._is_fzf_tmux_popup = true
Expand Down

0 comments on commit 4555533

Please sign in to comment.