shell/+fzf: better formatting for fzf-git-* candidates

This commit is contained in:
Henrik Lissner 2017-05-15 20:41:20 +02:00
parent 36104366aa
commit 254e46436c
2 changed files with 7 additions and 8 deletions

View file

@ -1,10 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
git log --graph --color=always \ git log --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" |
--format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" | fzf --ansi --no-sort --tiebreak=index --bind=ctrl-s:toggle-sort \
gui-fzf --ansi --no-sort --tiebreak=index --bind=ctrl-s:toggle-sort \
--bind "ctrl-m:execute: --bind "ctrl-m:execute:
(grep -o '[a-f0-9]\{7\}' | head -1 | (grep -o '[a-f0-9]\{7\}' | head -1 |
xargs -I % sh -c 'git show --color=always % | less -R') << 'FZF-EOF' xargs -I % sh -c 'git show --color=always % | less -R') << 'FZF-EOF'
{} {}
FZF-EOF" FZF-EOF"

View file

@ -6,6 +6,6 @@
# + git checkout `fzf-git-sha` # + git checkout `fzf-git-sha`
# + git commit --fixup `fzf-git-sha` # + git commit --fixup `fzf-git-sha`
commits=$(git log --color=always --pretty=oneline --abbrev-commit --reverse) && commits=$(git log --color=always --abbrev-commit --reverse --format="%C(auto)%h%d %s %C(black)%C(bold)%cr") &&
commit=$(echo "$commits" | fzf --tac +s +m -e --ansi --reverse) && commit=$(echo "$commits" | gui-fzf --tac +s +m -e --ansi) &&
echo -n $(echo "$commit" | sed "s/ .*//") echo -n $(echo "$commit" | sed "s/ .*//")