1
1
Fork 0

fish: Better prompt for root

This commit is contained in:
Jonathan Schleifer 2020-01-21 23:04:07 +00:00
parent ec8b51c80f
commit 300eab47a3
4 changed files with 6 additions and 19 deletions

View file

@ -13,7 +13,6 @@ SETUVAR fish_color_cancel:normal
SETUVAR fish_color_command:003cb3 SETUVAR fish_color_command:003cb3
SETUVAR fish_color_comment:6600cc SETUVAR fish_color_comment:6600cc
SETUVAR fish_color_cwd:209060 SETUVAR fish_color_cwd:209060
SETUVAR fish_color_cwd_root:800000
SETUVAR fish_color_end:730099 SETUVAR fish_color_end:730099
SETUVAR fish_color_error:ff0000 SETUVAR fish_color_error:ff0000
SETUVAR fish_color_escape:00a6b2 SETUVAR fish_color_escape:00a6b2
@ -28,13 +27,13 @@ SETUVAR fish_color_quote:ff751a
SETUVAR fish_color_redirection:bf4080 SETUVAR fish_color_redirection:bf4080
SETUVAR fish_color_search_match:ffff00 SETUVAR fish_color_search_match:ffff00
SETUVAR fish_color_selection:c0c0c0 SETUVAR fish_color_selection:c0c0c0
SETUVAR fish_color_suffix:6ddfad SETUVAR fish_color_suffix:29bc7d
SETUVAR fish_color_user:00ff00 SETUVAR fish_color_user:00ff00
SETUVAR fish_color_valid_path:normal SETUVAR fish_color_valid_path:normal
SETUVAR fish_color_vcs:43d696 SETUVAR fish_color_vcs:43d696
SETUVAR fish_color_vcs_braces:29bc7d SETUVAR fish_color_vcs_braces:29bc7d
SETUVAR fish_greeting: SETUVAR fish_greeting:
SETUVAR fish_key_bindings:hybrid_bindings SETUVAR fish_key_bindings:fish_default_key_bindings
SETUVAR fish_pager_color_completion:normal SETUVAR fish_pager_color_completion:normal
SETUVAR fish_pager_color_description:B3A06D\x1eyellow SETUVAR fish_pager_color_description:B3A06D\x1eyellow
SETUVAR fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline SETUVAR fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline

View file

@ -1,16 +1,9 @@
function fish_prompt --description 'Write out the prompt' function fish_prompt --description 'Write out the prompt'
set -l color_cwd
set -l suffix set -l suffix
switch "$USER" switch "$USER"
case root toor case root toor
if set -q fish_color_cwd_root set suffix (set_color ff0000)'#'
set color_cwd $fish_color_cwd_root
else
set color_cwd $fish_color_cwd
end
set suffix '#'
case '*' case '*'
set color_cwd $fish_color_cwd
set suffix '>' set suffix '>'
end end
@ -24,6 +17,6 @@ function fish_prompt --description 'Write out the prompt'
end end
echo -n -s (set_color $fish_color_host) (prompt_hostname) ' ' \ echo -n -s (set_color $fish_color_host) (prompt_hostname) ' ' \
(set_color $color_cwd) (prompt_pwd) (string join "" $vcs) \ (set_color $fish_color_cwd) (prompt_pwd) (string join "" $vcs) \
(set_color $fish_color_suffix) "$suffix " (set_color $fish_color_suffix) "$suffix "
end end

View file

@ -11,4 +11,6 @@ function fish_right_prompt
set_color $fish_color_error set_color $fish_color_error
echo "$code " echo "$code "
end end
set_color normal
end end

View file

@ -1,7 +0,0 @@
function hybrid_bindings --description 'Vi bindings with a bit of Emacs bindings'
for mode in default insert visual
fish_default_key_bindings -M $mode
end
fish_vi_key_bindings --no-erase
end