-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy path.blerc
60 lines (42 loc) · 1.68 KB
/
.blerc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# https://github.com/akinomyoga/ble.sh
bleopt term_index_colors=16
ble-import -d contrib/fzf-completion
ble-import -d contrib/fzf-key-bindings
ble-import contrib/prompt-git
function blerc/define-sabbrev-branch {
function blerc/sabbrev-git-branch {
ble/util/assign-array COMPREPLY "git branch | sed 's/^\*\{0,1\}[[:space:]]*//'" 2>/dev/null
}
ble-sabbrev -m '\branch'=blerc/sabbrev-git-branch
}
blehook/eval-after-load complete blerc/define-sabbrev-branch
function blerc/define-sabbrev-commit {
ble/color/defface blerc_git_commit_id fg=navy
ble/complete/action#inherit-from blerc_git_commit_id word
function ble/complete/action:blerc_git_commit_id/init-menu-item {
local ret; ble/color/face2g blerc_git_commit_id; g=$ret
}
function blerc/sabbrev-git-commit {
bleopt sabbrev_menu_style=desc-raw
bleopt sabbrev_menu_opts=enter_menu
local format=$'%h \e[1;32m(%ar)\e[m %s - \e[4m%an\e[m\e[1;33m%d\e[m'
local arr; ble/util/assign-array arr 'git log --pretty=format:"$format"' &>/dev/null
local line hash subject
for line in "${arr[@]}"; do
builtin read hash subject <<< "$line"
ble/complete/cand/yield blerc_git_commit_id "$hash" "$subject"
done
}
ble-sabbrev -m '\commit'='blerc/sabbrev-git-commit'
}
blehook/eval-after-load complete blerc/define-sabbrev-commit
function ble/prompt/backslash:X {
local "${_ble_contrib_prompt_git_vars[@]/%/=}"
if ble/contrib/prompt-git/initialize; then
local ret
ble/contrib/prompt-git/describe-head add-hash:check-dirty:check-state
ble/prompt/print "$ret"
fi
return 0
}
bleopt prompt_rps1='\X'