-
Notifications
You must be signed in to change notification settings - Fork 0
/
fish_prompt.fish
51 lines (47 loc) · 1.25 KB
/
fish_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
# ===========================
# han depends on the vi mode!
# ===========================
function han_vi
set -l cwd (prompt_pwd)
if [ $fish_key_bindings = fish_vi_key_bindings ]
switch $fish_bind_mode
case default
set_color white
echo -n "$cwd "
set_color red
echo "< "
case insert
set_color white
echo -n "$cwd "
set_color green
echo "> "
case visual
set_color white
echo -n "$cwd "
set_color yellow
echo "v "
case replace_one
set_color white
echo -n "$cwd "
set_color magenta
echo "_ "
end
end
end
function han_git
set -l git_branch (command git symbolic-ref HEAD 2> /dev/null | sed -e 's|^refs/heads/||')
set -l git_dirty (command git status -s --ignore-submodules=dirty 2> /dev/null)
if test -n "$git_branch"
if test -n "$git_dirty"
set_color yellow
echo -n "[$git_branch] "
else
set_color green
echo -n "[$git_branch] "
end
end
end
function fish_prompt
han_git
han_vi
end