diff options
-rw-r--r-- | lib/common.nix | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/common.nix b/lib/common.nix index 1b25fb0..a87ebb5 100644 --- a/lib/common.nix +++ b/lib/common.nix @@ -289,12 +289,15 @@ in git rev-parse HEAD > /dev/null 2>&1 } - alias fzf-tmux='fzf-tmux -p "70%"' + fzf_down() { + fzf --height 50% --min-height 20 --border \ + --bind 'ctrl-/:change-preview-window(hidden|90%|)' "$@" + } _gf() { is_in_git_repo || return git -c color.status=always status --short | - fzf-tmux -p "70%" -m --ansi --nth 2..,.. \ + fzf_down -m --ansi --nth 2..,.. \ --preview '(git diff --color=always -- {-1} | sed 1,4d; cat {-1}) | head -500' | cut -c4- | sed 's/.* -> //' } @@ -302,7 +305,7 @@ in _gb() { is_in_git_repo || return git branch -a --color=always | grep -v '/HEAD\s' | sort | - fzf-tmux --ansi --multi --tac --preview-window right:70% \ + fzf_down --ansi --multi --tac --preview-window right:70% \ --preview 'git log --oneline --graph --date=short --color=always --pretty="format:%C(auto)%cd %h%d %s" $(sed s/^..// <<< {} | cut -d" " -f1) | head -'$LINES | sed 's/^..//' | cut -d' ' -f1 | sed 's#^remotes/##' @@ -311,14 +314,15 @@ in _gt() { is_in_git_repo || return git tag --sort -version:refname | - fzf-tmux --multi --preview-window right:70% \ + fzf_down --multi --preview-window right:70% \ --preview 'git show --color=always {} | head -'$LINES } _gh() { is_in_git_repo || return - git log --date=short --format="%C(green)%C(bold)%cd %C(auto)%h%d %s (%an)" --graph --color=always | - fzf-tmux --ansi --no-sort --reverse --multi --bind 'ctrl-s:toggle-sort' \ + git log --date=short --format="%C(green)%C(bold)%cd %C(auto)%h%d %s (%an)" --graph --color=always --no-merges | + fzf_down --ansi --no-sort --reverse --multi --exact \ + --bind 'ctrl-s:toggle-sort' \ --header 'Press CTRL-S to toggle sort' \ --preview 'grep -o "[a-f0-9]\{7,\}" <<< {} | xargs git show --color=always | head -'$LINES | grep -o "[a-f0-9]\{7,\}" @@ -327,7 +331,7 @@ in _gr() { is_in_git_repo || return git remote -v | awk '{print $1 "\t" $2}' | uniq | - fzf-tmux --tac \ + fzf_down --tac \ --preview 'git log --oneline --graph --date=short --pretty="format:%C(auto)%cd %h%d %s" {1} | head -200' | cut -d$'\t' -f1 } |