From 2bad8c88d708a542ec1af58c416f56793b3803ad Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Thu, 14 Sep 2023 19:49:55 +0200 Subject: [PATCH] Adding fish config --- fish/config.fish | 6 ++++++ fish/functions/prompt_login.fish | 28 ++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 fish/config.fish create mode 100644 fish/functions/prompt_login.fish diff --git a/fish/config.fish b/fish/config.fish new file mode 100644 index 0000000..d1adafb --- /dev/null +++ b/fish/config.fish @@ -0,0 +1,6 @@ +if status is-interactive + # Commands to run in interactive sessions can go here +end + +set fish_color_user normal +set fish_color_host blue \ No newline at end of file diff --git a/fish/functions/prompt_login.fish b/fish/functions/prompt_login.fish new file mode 100644 index 0000000..5ca4c24 --- /dev/null +++ b/fish/functions/prompt_login.fish @@ -0,0 +1,28 @@ +function prompt_login --description 'display user name for the prompt' + if not set -q __fish_machine + set -g __fish_machine + set -l debian_chroot $debian_chroot + + if test -r /etc/debian_chroot + set debian_chroot (cat /etc/debian_chroot) + end + + if set -q debian_chroot[1] + and test -n "$debian_chroot" + set -g __fish_machine "(chroot:$debian_chroot)" + end + end + + # Prepend the chroot environment if present + if set -q __fish_machine[1] + echo -n -s (set_color yellow) "$__fish_machine" (set_color normal) ' ' + 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) / (set_color $color_host) (prompt_hostname) (set_color normal) +end