tmux-fzf: Won't launch

When ever I try to launch this, I get the following error message:

'/home/my-user-name/.tmux/plugins/tmux-fzf/scripts/.sh' returned 127

I notice the part of the filename before the extension is missing.

I’m running tmux 2.6 on WSL.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 19 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Okay, so here’s what I’ve got so far:

The mentioned error occurs when ITEM is empty at main.sh:18. This can basically only happen if something is going wrong in .fzf-tmux. My first guess was that the embedded script might be outdated (and it is) but that’s not the issue.

In my case, the issue is that tmux could not find fzf (more on that below). This results in the fallback at .fzf-tmux:10 which sets fzf="$(dirname "$0")/fzf. This fallback makes perfectly sense for the original script along with the compiled binary which is stored at this exact location. Obviously though, the fzf binary is not present in this folder (since it’s not part of this repo), so the next line fails with fzf executable not found. This error however is printed to stderr, so it’s not only not propagated up to the calling command substitution but also eaten up by tmux (i.e. tmux doesn’t print stderr, e.g. tmux run-shell 'echo foo >&2' has no output). This made the error very difficult to spot.

So why is fzf not found? To begin with, I’m currently running zsh as my default shell and configured zplugin to manage lots of scripts, tools and helpers, one of which is fzf. Zplugin is very careful to not pollute global directories, so it stores all binaries in user-local paths and only propagates them to the current shell. The problem is that tmux somehow still uses bash instead of zsh, so zplugin is not loaded and therefore fzf is not in $PATH. The only thing I still don’t get is why (any hints on this are appreciated). I’ve set the corresponding options (at least the ones I know of) but it doesn’t work:

~ $ tmux show-options -g | grep default-
default-command "/usr/bin/zsh"
default-shell "/usr/bin/zsh"
~ $ tmux run 'echo $SHELL'
/bin/bash

So technically, it’s not an issue with tmux-fzf, but all of the above is very specific to my case. For others it might be best to start checking whether tmux is able to find fzf: tmux run-shell 'command -v fzf'

I finally got it to work on all my setups. In the end I it was not the wrong shell being executed but rather a combination of zplugin’s turbo mode (which delays plugin loading and executes it in the background to improve shell startup time) and the autostart setting of the tmux zsh plugin (which automatically starts a tmux session or attaches to an existing one on plugin load). So basically tmux was started automatically before the zplugin background process was able to load fzf into the PATH. I currently fixed it by simply disabling the turbo mode for fzf again.

To me, this issue is fixed now (as it never actually was an issue with tmux-fzf), but I’m happy to help out anyone else who is still having issues.