comparison dot_config/bash/fzf_aliases @ 257:d726921aaabe

Clean start of dotfiles repo
author zegervdv <zegervdv@me.com>
date Thu, 21 May 2020 11:28:36 +0200
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 257:d726921aaabe
1 # ** vim:ft=sh
2
3 # export FZF_DEFAULT_COMMAND='fd -I --type file --color=always'
4 export FZF_DEFAULT_OPTS='--ansi'
5
6 __git_log () {
7 git log --format="%C(auto)%h %<(15)%C(auto, green)%cr %>(20)%C(auto, magenta)%an %C(auto)%s %D"
8 }
9
10 _fzf_complete_git() {
11 ARGS="$@"
12
13 if [[ $ARGS=='git show'* || \
14 $ARGS=='git cherry-pick'* || \
15 $ARGS=='git checkout'* || \
16 $ARGS=='git commit -a --fixup'* || \
17 $ARGS=='git reset'* ]]; then
18 _fzf_complete "--reverse --multi" "$@" < <(__git_log)
19 fi
20 }
21
22 _fzf_complete_git_post() {
23 sed -e 's/^[^a-z0-9]*//' | awk '{print $1}'
24 }
25
26 complete -F _fzf_complete_git -o default -o bashdefault git
27
28 __hg_log () {
29 hg ls
30 }
31
32 _fzf_complete_hg() {
33 ARGS="$@"
34
35 if [[ $ARGS=='hg rebase'* ]]; then
36 _fzf_complete "--reverse --multi" "$@" < <(hg log --graph --rev=wip --template=oneline)
37 elif [[ $ARGS=='hg ls'* ]]; then
38 _fzf_complete "--reverse --multi" "$@" < <(hg ls -l 100)
39 fi
40 }
41
42 _fzf_complete_hg_post() {
43 sed -e 's/^[^0-9]*//' | awk '{print $1}'
44 }
45
46 complete -F _fzf_complete_hg -o default -o bashdefault hg