forked from oh-my-fish/theme-agnoster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfish_right_prompt.fish
62 lines (58 loc) · 1.45 KB
/
fish_right_prompt.fish
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
61
62
# right prompt for agnoster theme
# shows vim mode status
set right_segment_separator \uE0B2
set -g agnoster_right_current_bg NONE
function right_prompt_segment -d "Function to draw a right segment"
set -l bg
set -l fg
if [ -n "$argv[1]" ]
set bg $argv[1]
else
set bg normal
end
if [ -n "$argv[2]" ]
set fg $argv[2]
else
set fg normal
end
if [ "$agnoster_right_current_bg" != 'NONE' -a "$argv[1]" != "$agnoster_right_current_bg" ]
set_color -b $agnoster_right_current_bg
set_color $bg
echo -n " $right_segment_separator"
set_color -b $bg
set_color $fg
else
set_color -b $bg
set_color $fg
end
set agnoster_right_current_bg $argv[1]
if [ -n "$argv[3]" ]
echo -n -s " " $argv[3]
end
end
function end_right_prompt
if [ -n $agnoster_right_current_bg ]
set_color -b normal
set_color $agnoster_right_current_bg
end
set -g agnoster_right_current_bg NONE
end
function prompt_vi_mode -d 'vi mode status indicator'
switch $fish_bind_mode
case default
right_prompt_segment green black "N"
case insert
right_prompt_segment normal normal ""
case visual
right_prompt_segment red black "V"
end
end
function fish_right_prompt -d 'Prints right prompt'
if test $__fish_active_key_bindings = 'fish_vi_key_bindings'
set -l first_color black
set_color $first_color
echo "$right_segment_separator"
prompt_vi_mode
end_right_prompt
end
end