mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-27 19:53:36 +08:00
parent
c18614552d
commit
01fb830bf5
|
@ -2,7 +2,7 @@
|
|||
# author: Ivan Tham <ivanthamjunhoe@gmail.com>
|
||||
|
||||
function fish_prompt
|
||||
test $SSH_TTY; and printf (set_color red)$USER(set_color brwhite)'@'(set_color yellow)(prompt_hostname)' '
|
||||
test $SSH_TTY; and printf (set_color red)(whoami)(set_color white)'@'(set_color yellow)(hostname)' '
|
||||
|
||||
test $USER = 'root'; and echo (set_color red)"#"
|
||||
|
||||
|
@ -15,10 +15,10 @@ function fish_right_prompt
|
|||
test $status != 0; and printf (set_color red)"⏎ "
|
||||
|
||||
if git rev-parse ^ /dev/null
|
||||
# Magenta if branch detached else green
|
||||
git branch -qv | grep "\*" | string match -rq detached
|
||||
and set_color brmagenta
|
||||
or set_color brgreen
|
||||
# Purple if branch detached else green
|
||||
git branch -qv | grep "\*" | grep -q detached
|
||||
and set_color purple --bold
|
||||
or set_color green --bold
|
||||
|
||||
# Need optimization on this block (eliminate space)
|
||||
git name-rev --name-only HEAD
|
||||
|
@ -32,9 +32,9 @@ function fish_right_prompt
|
|||
(git status --porcelain | cut -c 1-2 | uniq)
|
||||
switch $i
|
||||
case "*[ahead *"
|
||||
printf (set_color magenta)⬆' '
|
||||
printf (set_color purple)⬆' '
|
||||
case "*behind *"
|
||||
printf (set_color magenta)⬇' '
|
||||
printf (set_color purple)⬇' '
|
||||
case "."
|
||||
printf (set_color green)✚' '
|
||||
case " D"
|
||||
|
@ -42,12 +42,13 @@ function fish_right_prompt
|
|||
case "*M*"
|
||||
printf (set_color blue)✱' '
|
||||
case "*R*"
|
||||
printf (set_color brmagenta)➜' '
|
||||
printf (set_color purple)➜' '
|
||||
case "*U*"
|
||||
printf (set_color bryellow)═' '
|
||||
printf (set_color brown)═' '
|
||||
case "??"
|
||||
printf (set_color brwhite)◼' '
|
||||
printf (set_color white)◼' '
|
||||
end
|
||||
end
|
||||
set_color normal
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user