diff options
Diffstat (limited to '.config/fish/functions/_tide_item_context.fish')
-rw-r--r-- | .config/fish/functions/_tide_item_context.fish | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/.config/fish/functions/_tide_item_context.fish b/.config/fish/functions/_tide_item_context.fish index 9dfa56d7..575c438c 100644 --- a/.config/fish/functions/_tide_item_context.fish +++ b/.config/fish/functions/_tide_item_context.fish @@ -1,9 +1,15 @@ function _tide_item_context if set -q SSH_TTY - tide_context_color=$tide_context_color_ssh _tide_print_item context $USER@$hostname + set -lx tide_context_color $tide_context_color_ssh + test "$tide_context_hostname_parts" = 0 && _tide_print_item context $USER || + h=(string split . $hostname) _tide_print_item context $USER@(string join . $h[..$tide_context_hostname_parts]) else if test "$EUID" = 0 - tide_context_color=$tide_context_color_root _tide_print_item context $USER@$hostname + set -lx tide_context_color $tide_context_color_root + test "$tide_context_hostname_parts" = 0 && _tide_print_item context $USER || + h=(string split . $hostname) _tide_print_item context $USER@(string join . $h[..$tide_context_hostname_parts]) else if test "$tide_context_always_display" = true - tide_context_color=$tide_context_color_default _tide_print_item context $USER@$hostname + set -lx tide_context_color $tide_context_color_default + test "$tide_context_hostname_parts" = 0 && _tide_print_item context $USER || + h=(string split . $hostname) _tide_print_item context $USER@(string join . $h[..$tide_context_hostname_parts]) end end |