junegunn / fzf

:cherry_blossom: A command-line fuzzy finder
https://junegunn.github.io/fzf/
MIT License
65.48k stars 2.41k forks source link

Installation from Git should not depend on local repo dir #1561

Open jamadagni opened 5 years ago

jamadagni commented 5 years ago

Hello. Currently, the installation of FZF from Git sets up the shell to look for the binary, completion and key bindings from the Git repository:

# Setup fuzzy-finder
# ---------
if [[ ! "$PATH" == */home/samjnaa/sr/_repos/git/fuzzy-finder/bin* ]]; then
export PATH="${PATH:+${PATH}:}/home/samjnaa/sr/_repos/git/fuzzy-finder/bin"
fi

# Auto-completion
# ---------------
[[ $- == *i* ]] && source "/home/samjnaa/sr/_repos/git/fuzzy-finder/shell/completion.bash" 2> /dev/null

# Key bindings
# ------------
source "/home/samjnaa/sr/_repos/git/fuzzy-finder/shell/key-bindings.bash"

However, if I do anything that affects the path of the Git repository such as rearrange the tree, the paths are invalidated. Normally whenever I install something from a repo, I expect everything to go to a place other than the repo so it can exist/work even if the repo is deleted.

I request that fzf also be made this way so one can continue to use it and rearrange one's git repos as per one's convenience. Just like .fzf.bash is copied to $HOME, other files can also be placed in a similar place just like all other installed apps create.

Currently the README suggests to clone to ~/.fzf but I keep all my cloned repos in one place because I have a script to keep them up-to-date etc.

The point is to follow the common practice of installation not generating depending on the source tree. So I suggest that the cloning can be done elsewhere. and the files be installed to ~/.fzf instead if you don't want to require superuser permission.

jmriego commented 5 years ago

I like this idea. At the moment I'm using minpac in vim and it keeps all the cloned repos in once place. As a workaround I'm using a link to have it also in ~/.fzf but it probably would be cleaner if it worked the way you mention