bling / fzf.el

A front-end for fzf
GNU General Public License v3.0
360 stars 50 forks source link

FZF_DEFAULT_COMMAND not set correctly in Eshell buffers on first use #119

Closed Doodler8888 closed 2 weeks ago

Doodler8888 commented 3 months ago

I have a function like this:

(defun fzf-from-home-no-prompt ()
(interactive)
(setenv "FZF_DEFAULT_COMMAND" "fd --hidden --follow --exclude .git .  ~/")
(fzf))

Usually, it works correctly, but if I try to use it in an Eshell buffer and I haven't used the function in the current session, then the fzf window gets invoked as if I would run the (fzf) function without setting the "FZF_DEFAULT_COMMAND" variable.

Emacs version: 29.2

Doodler8888 commented 3 months ago

Additionally, I tried defines the functions like this, but it doesn't solve the problem.:

(defun fzf-from-root-no-prompt ()
  (interactive)
  (fzf-with-command "fd --hidden --follow --exclude .git --exclude .snapshots --exclude opt --exclude lib --exclude lib64 --exclude mnt --exclude proc --exclude run --exclude sbin --exclude srv --exclude sys --exclude tmp . /"
                    (lambda (selected)
                      (when selected
                        (find-file selected)))))

(defun fzf-from-home-no-prompt ()
  (interactive)
  (fzf-with-command "fd --hidden --follow --exclude .git . ~/"
                    (lambda (selected)
                      (when selected
                        (find-file selected)))))