mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-20 09:33:42 -05:00
fshow using execute action
15
Examples.md
15
Examples.md
@@ -276,15 +276,12 @@ fcoc() {
|
|||||||
```sh
|
```sh
|
||||||
# fshow - git commit browser
|
# fshow - git commit browser
|
||||||
fshow() {
|
fshow() {
|
||||||
local out sha q
|
git log --graph --color=always \
|
||||||
while out=$(
|
--format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" |
|
||||||
git log --decorate=short --graph --oneline --color=always |
|
fzf --ansi --no-sort --reverse --tiebreak=index --toggle-sort=\` \
|
||||||
fzf --ansi --multi --no-sort --reverse --query="$q" --print-query); do
|
--bind "ctrl-m:execute:
|
||||||
q=$(head -1 <<< "$out")
|
echo '{}' | grep -o '[a-f0-9]\{7\}' | head -1 |
|
||||||
while read sha; do
|
xargs -I % sh -c 'git show --color=always % | less -R'"
|
||||||
[ -n "$sha" ] && git show --color=always $sha | less -R
|
|
||||||
done < <(sed '1d;s/^[^a-z0-9]*//;/^$/d' <<< "$out" | awk '{print $1}')
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user