mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-29 18:51:15 -03:00
Add a "prompt_login" helper function
This prints a description of the "host". Currently that's `(chroot:debianchroot) $USER@$hostname` with the chroot part when needed. This also switches the default and terlar prompts to use it, the other prompts have slightly different coloring or logic here.
This commit is contained in:
@@ -16,12 +16,6 @@ function fish_prompt --description 'Write out the prompt'
|
||||
set suffix '#'
|
||||
end
|
||||
|
||||
# If we're running via SSH, change the host color.
|
||||
set -l color_host $fish_color_host
|
||||
if set -q SSH_TTY
|
||||
set color_host $fish_color_host_remote
|
||||
end
|
||||
|
||||
# Write pipestatus
|
||||
# If the status was carried over (e.g. after `set`), don't bold it.
|
||||
set -l bold_flag --bold
|
||||
@@ -34,5 +28,5 @@ function fish_prompt --description 'Write out the prompt'
|
||||
set -l statusb_color (set_color $bold_flag $fish_color_status)
|
||||
set -l prompt_status (__fish_print_pipestatus "[" "]" "|" "$status_color" "$statusb_color" $last_pipestatus)
|
||||
|
||||
echo -n -s (set_color $fish_color_user) "$USER" $normal @ (set_color $color_host) (prompt_hostname) $normal ' ' (set_color $color_cwd) (prompt_pwd) $normal (fish_vcs_prompt) $normal " "$prompt_status $suffix " "
|
||||
echo -n -s (prompt_login)' ' (set_color $color_cwd) (prompt_pwd) $normal (fish_vcs_prompt) $normal " "$prompt_status $suffix " "
|
||||
end
|
||||
|
||||
@@ -4,17 +4,7 @@
|
||||
function fish_prompt --description 'Write out the prompt'
|
||||
set -l last_status $status
|
||||
|
||||
# User
|
||||
set_color $fish_color_user
|
||||
echo -n $USER
|
||||
set_color normal
|
||||
|
||||
echo -n '@'
|
||||
|
||||
# Host
|
||||
set_color $fish_color_host
|
||||
echo -n (prompt_hostname)
|
||||
set_color normal
|
||||
prompt_login
|
||||
|
||||
echo -n ':'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user