forked from johngrib/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fish_prompt.fish
58 lines (49 loc) · 1.84 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
52
53
54
55
56
57
58
# You can override some default options with config.fish:
#
# set -g theme_short_path yes
function fish_prompt
set -l last_command_status $status
set -l cwd
if test "$theme_short_path" = 'yes'
set cwd (basename (prompt_pwd))
else
set cwd (prompt_pwd)
end
set -l fish "⋊>"
set -l ahead "↑"
set -l behind "↓"
set -l diverged "⥄ "
set -l dirty "⨯"
set -l none "◦"
set -l normal_color (set_color normal)
set -l success_color (set_color $fish_pager_color_progress ^/dev/null; or set_color cyan)
set -l error_color (set_color $fish_color_error ^/dev/null; or set_color red --bold)
set -l directory_color (set_color $fish_color_quote ^/dev/null; or set_color brown)
set -l repository_color (set_color $fish_color_cwd ^/dev/null; or set_color green)
set -l myname_color (set_color cyan)
set -l hostname_color (set_color purple)
if test $last_command_status -eq 0
echo -n -s $normal_color $fish $normal_color
else
echo -n -s $error_color $fish $normal_color
end
if git_is_repo
if test "$theme_short_path" = 'yes'
set root_folder (command git rev-parse --show-toplevel ^/dev/null)
set parent_root_folder (dirname $root_folder)
set cwd (echo $PWD | sed -e "s|$parent_root_folder/||")
end
# echo -n -s " " $directory_color $cwd $normal_color
# PS1="${YELLOW}${TIMESTAMP} ${GREEN}\u ${B_MAGENTA}\h ${YELLOW}\w ${COLOR_END} ${GIT_BRANCH}\n\$ "
echo -n -s $myname_color (whoami) " " $hostname_color (hostname) " " $directory_color $PWD $normal_color
echo -n -s " on " $repository_color (git_branch_name) $normal_color " "
if git_is_touched
echo -n -s $dirty
else
echo -n -s (git_ahead $ahead $behind $diverged $none)
end
else
echo -n -s " " $directory_color $cwd $normal_color
end
echo -n -s " " \n\$ " "
end