mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-11 15:37:24 +00:00
Informative git prompt: Handle root/toor users
Fixes #961 This should probably be in a helper function
This commit is contained in:
parent
fa4ec55c96
commit
c8ac48ff9a
1 changed files with 17 additions and 2 deletions
|
@ -65,8 +65,23 @@ function fish_prompt --description 'Write out the prompt'
|
|||
set -g __fish_prompt_normal (set_color normal)
|
||||
end
|
||||
|
||||
set -l color_cwd
|
||||
set -l prefix
|
||||
switch $USER
|
||||
case root toor
|
||||
if set -q fish_color_cwd_root
|
||||
set color_cwd $fish_color_cwd_root
|
||||
else
|
||||
set color_cwd $fish_color_cwd
|
||||
end
|
||||
set suffix '#'
|
||||
case '*'
|
||||
set color_cwd $fish_color_cwd
|
||||
set suffix '$'
|
||||
end
|
||||
|
||||
# PWD
|
||||
set_color $fish_color_cwd
|
||||
set_color $color_cwd
|
||||
echo -n (prompt_pwd)
|
||||
set_color normal
|
||||
|
||||
|
@ -76,7 +91,7 @@ function fish_prompt --description 'Write out the prompt'
|
|||
set_color $fish_color_error
|
||||
end
|
||||
|
||||
echo -n '$ '
|
||||
echo -n "$suffix "
|
||||
|
||||
set_color normal
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue