junegunn / fzf-git.sh

bash and zsh key bindings for Git objects, powered by fzf
612 stars 53 forks source link

Question: how is this supposed to work? #29

Closed nkh closed 1 year ago

nkh commented 1 year ago

Are the bindings supposed to immediately open a tmux window or are they supposed to add, eg, _fzf_git_hashes to the command line and to be run as a part of the command?

I get the later behavior but expected the former.

junegunn commented 1 year ago

The former.

nkh commented 1 year ago

Any idea why I get the later? Probably something in my config, I digged around but can't find a reason.

I'm working on another solution using tmux bind and tmux set/paste-buffer that's more generic, and I already use forgit, I'll post a link to a gist if you are interested.

junegunn commented 1 year ago

No clue. You on zsh? You might want to try it on bash and see if it works there.

nkh commented 1 year ago

I don't use zsh. I just sourced the file.

junegunn commented 1 year ago

Then you can bash --rcfile fzf-git.sh and see if it works without other stuff.

nkh commented 1 year ago

That worked, now I have a point where I can start debugging, thanks.

Here's how I do the same thing as with your bindings.

$> tmux bind -n C-g bind -n C-h popup -w 80% -h 80% -E -d $PWD "./tmux-insert"

tmux-insert: buffer=fd --color always | fzf -m --ansi --cycle | quote_lines | tr '\n' ' ' [[ "$buffer" ]] && { tmux set-buffer "$buffer" ; tmux paste-buffer ; }

This uses tmux for the bindings and gives the flexibility to run whatever one wants. The only thing that I haven't worked out yet is how to run commands that themselves use tmux windows (my file manager does), I hope to fix that.