Request for architecture-dependent install location
Checklist
- [x] I have read through the manual page (
man fzf) - [x] I have searched through the existing issues
- [ ] For bug reports, I have checked if the bug is reproducible in the latest version of fzf
Output of fzf --version
0.58.0 (65db735)
OS
- [x] Linux
- [ ] macOS
- [ ] Windows
- [ ] Etc.
Shell
- [x] bash
- [ ] zsh
- [ ] fish
Problem / Steps to reproduce
This isn't quite a bug, but an uncommon use-case I think. I work on systems with different architectures (aarch64 and x86_64) that mount a shared filesystem for their home directories. The current install process for fzf is architecture-independent from what I can find, so fzf works only on the system that it was installed on, while it breaks on the other system due to the incompatible binaries being used.
I use vim-plug to manage my vim plugins, and I'm new to vimscript, so I don't know how to tell vim-plug to install to an architecture-dependent location. My workaround has been to remove fzf from my vim plugins and just manually clone/install it to arch-dependent directories and alter the .fzf.bash script to use the output of uname -m to determine which directory to source.
To Reproduce:
- Have access to 2+ systems with different architectures (aka x86_64 and aarch64) that mount a shared filesystem for their
$HOMEdirectory - Login to one of the systems
- git clone fzf to
~/.fzfand cd to~/.fzf ./install -y- Logout of that system and into the other one
- Source your
.bashrcif it hasn't been done already - Error Output:
bash: /users/$USER/.fzf/bin/fzf: cannot execute binary file: Exec format error
I use vim-plug to manage my vim plugins
Do you use vim-plug to install fzf? Or you manually install it on the shell? How does your Plug command for fzf look like?
Same here, I modify my ~/.fzf.zsh to be:
# Setup fzf
# ---------
ARCH=$(uname -m)
if [[ "$ARCH" == "x86_64" ]]; then
if [[ ! "$PATH" == */home/$USER/.fzf/bin* ]]; then
PATH="${PATH:+${PATH}:}/home/$USER/.fzf/bin"
fi
elif [[ "$ARCH" == "aarch64" ]]; then
if [[ ! "$PATH" == */home/$USER/.fzf-aarch64/bin* ]]; then
PATH="${PATH:+${PATH}:}/home/$USER/.fzf-aarch64/bin"
fi
else
echo "ERROR: $ARCH must be one of x86_64 or aarch64 in order to use fzf"
return 1
fi
source <(fzf --zsh)
My primary issue is that when updating fzf (via git pull && ./install) it overwrites the modified ~/.fzf.zsh
I would suggest that you use a package manager of your system to install fzf, so that fzf is in your $PATH, and just add a single line to your shell configuration file as suggested here instead of relying on the "install" script.
If the main package manager of your distribution does not provide the latest version of fzf, you might want to try something like mise of asdf.
@junegunn my Plug command looks like this:
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
I've tried inserting a variable that is set to the machine architecture into the 'dir': '~/.fzf' bit, but it just gets ignored. I haven't worked on it a lot, so I might be missing some obvious solution.