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

Tmux config example

Open Nathan-ma opened this issue 11 months ago • 0 comments

set-environment -g FZF_GIT_SCRIPT "$HOME/.config/tmux/scripts/fzf-git.sh"
unbind-key b
bind-key -n M-b run-shell -b "\
  bash -c \"cd \"#{pane_current_path}\"; $FZF_GIT_SCRIPT --list branches\" | \
  fzf --tmux 80%,70%  \
    --ansi \
    --border-label '🌲 Branches ' \
    --header-lines 2 \
    --tiebreak begin \
    --preview-window down,border-top,40% \
    --color hl:underline,hl+:underline \
    --no-hscroll \
    --bind 'ctrl-/:change-preview-window(down,70%|hidden|)' \
    --bind 'ctrl-o:execute-silent:bash $FZF_GIT_SCRIPT --list branch {}' \
    --bind 'alt-a:change-border-label(🌳 All branches)+reload:bash $FZF_GIT_SCRIPT --list all-branchesr' \
    --preview \"git -C #{pane_current_path} log --oneline \
    --graph --date=short --color=always --pretty='format:%C(auto)%cd %h%d %s' \
    \\$(sed s/^..// <<< {} | cut -d' ' -f1) --\" \"$@\" | \
    sed 's/^..//' | cut -d' ' -f1 | xargs -I % git -C #{pane_current_path} checkout % \
     > /dev/null || true \
"

Press option+b and be happy! Took me some time, I link the project and I think this might help someone else looking for this.

Nathan-ma avatar Jan 13 '25 07:01 Nathan-ma