Skip to content

Tmux config example #62

@Nathan-ma

Description

@Nathan-ma
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions