fzf-git.sh icon indicating copy to clipboard operation
fzf-git.sh copied to clipboard

Allow configuring the keybinding prefix

Open kyanagi opened this issue 1 year ago • 3 comments

fzf-git uses C-g as the keybinding prefix, but I would like to keep C-g for its original use. How about making the keybinding prefix configurable?

For zsh, I have implemented a way to set the prefix using an environment variable FZF_GIT_KEY_PREFIX, as shown below. https://github.com/kyanagi/fzf-git.sh/commit/8ef4a8cb86e9874a35bd58b5302c1b321f7f151b I intended to implement this for bash as well, but I couldn't get it to work, so the implementation is currently limited to zsh only.

kyanagi avatar Oct 22 '24 03:10 kyanagi

Unfortunately, bash and zsh use different notations for key chords. In this case, \C-g vs. ^g. This makes it impossible to provide a simple, consistent option variable we can use across bash and zsh.

# Works in bash, but not in zsh
export FZF_GIT_PREFIX='\C-g'

# The opposite
export FZF_GIT_PREFIX='^g'

🫤

This is probably a non-issue, because few people switch between the two shells, but still, not ideal.

junegunn avatar Oct 25 '24 15:10 junegunn

Yes, I was aware that the configuration strings differ between bash and zsh.

I believe the options are either to prepare a single environment variable and ask users to configure it based on their choice of either bash or zsh, or to provide separate environment variables for bash and zsh. If neither option is acceptable, we would have to give up on implementing it.

kyanagi avatar Oct 26 '24 21:10 kyanagi

fyi, this might be what ur looking for: https://github.com/junegunn/fzf-git.sh/issues/16#issuecomment-2905645909

zachtheyek avatar May 23 '25 19:05 zachtheyek