From 464e292e0863788548b0752bd6e7efbfbdbfecf5 Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Tue, 27 Sep 2022 14:59:22 -0700 Subject: [PATCH] set up fzf bindings and hack for fzf git branch w/tmux --- runcoms/zshrc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/runcoms/zshrc b/runcoms/zshrc index 1045936..85d2515 100644 --- a/runcoms/zshrc +++ b/runcoms/zshrc @@ -42,8 +42,6 @@ function eject { command hdiutil eject `df | grep Volumes | grep -i "$@" | ruby eval "$(brew shellenv)" -[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh - if [ -e $HOMEBREW_PREFIX/opt/fzf/shell/completion.zsh ]; then source $HOMEBREW_PREFIX/opt/fzf/shell/key-bindings.zsh source $HOMEBREW_PREFIX/opt/fzf/shell/completion.zsh @@ -56,6 +54,9 @@ if [ -x "$(command -v terraform)" ]; then fi if [ $commands[fzf] ]; then + [[ $- == *i* ]] && source "/opt/homebrew/opt/fzf/shell/completion.zsh" 2> /dev/null + source "/opt/homebrew/opt/fzf/shell/key-bindings.zsh" + export FZF_DEFAULT_OPTS='--height 40% --layout=reverse --border' export FZF_DEFAULT_COMMAND="fd --type f" export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" @@ -88,7 +89,8 @@ if [ $commands[fzf] ]; then cut -c4- | sed 's/.* -> //' } - _gb() { + # this B is capitalized so it maybe will work w/tmux? + _gB() { is_in_git_repo || return git branch -a --color=always | grep -v '/HEAD\s' | sort | fzf-down --ansi --multi --tac --preview-window right:70% \ @@ -143,7 +145,7 @@ if [ $commands[fzf] ]; then eval "bindkey '^g^$c' fzf-g$c-widget" done } - bind-git-helper f b t r h s + bind-git-helper f B t r h s unset -f bind-git-helper if [ $commands[fasd] ]; then