-
Notifications
You must be signed in to change notification settings - Fork 0
/
fish_prompt.fish
46 lines (37 loc) · 1.26 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
#
# Aeron theme for Fish.
# Inspired by Kenneth Reitz’ original theme for Oh-my-ZSH.
#
# Author: Eugene “Aeron” Glybin <[email protected]>
#
# Comment: Not using it much because of Starship <https://starship.rs>
#
function fish_prompt -d 'Writes out the prompt'
set git_branch (git symbolic-ref --short HEAD 2> /dev/null) # fastest way
set git_modified (git status -suno 2> /dev/null) # fastest way
if test -n "$VIRTUAL_ENV" -a -n "$VIRTUAL_ENV_DISABLE_PROMPT"
set_color magenta
else
set_color green
end
echo -n (basename (prompt_pwd))
if test -n "$git_branch"
echo -n (set_color normal) ''
if test -n "$__fish_git_prompt_shorten_branch_len" \
-a (string length $git_branch) \
-gt $__fish_git_prompt_shorten_branch_len
set git_branch (
string sub --length=$__fish_git_prompt_shorten_branch_len $git_branch
)
set git_branch "$git_branch…"
end
echo -n (set_color yellow) $git_branch
if test -n "$git_modified"
echo -n (set_color brred) '±'
end
end
if set -q SUDO_USER
echo -n (set_color brred) '⚡'
end
echo -n (set_color red) '❯' (set_color normal)
end