From 4f54b9ebfeade6487cd6f2ab8b676ce3c2f27b1f Mon Sep 17 00:00:00 2001 From: Dirk Alders Date: Sun, 2 Mar 2025 16:47:21 +0100 Subject: [PATCH] Added prompt_login for old fish shell and customisation of prompt_login --- fish_cfg/functions/prompt_login.fish | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 fish_cfg/functions/prompt_login.fish diff --git a/fish_cfg/functions/prompt_login.fish b/fish_cfg/functions/prompt_login.fish new file mode 100644 index 0000000..0efb9c6 --- /dev/null +++ b/fish_cfg/functions/prompt_login.fish @@ -0,0 +1,19 @@ +function prompt_login --description 'display user name for the prompt' + # If we're running as root, change the user color and the seperator + if functions -q fish_is_root_user; and fish_is_root_user + if set -q fish_color_cwd_root + set fish_color_user $fish_color_cwd_root + end + set seperator '☠' + else + set seperator '@' + end + + # If we're running via SSH, change the host color. + set -l color_host $fish_color_host + if set -q SSH_TTY; and set -q fish_color_host_remote + set color_host $fish_color_host_remote + end + + echo -n -s (set_color $fish_color_user) "$USER" (set_color normal) $seperator (set_color $color_host) (prompt_hostname) (set_color normal) +end