summaryrefslogtreecommitdiff
path: root/.config/fish/functions/_tide_item_context.fish
diff options
context:
space:
mode:
authorRoger Gonzalez <roger@rogs.me>2023-07-05 17:05:39 -0300
committerRoger Gonzalez <roger@rogs.me>2023-07-05 17:05:39 -0300
commit3913586f678437d6de80bc96c8eea0e1e69a51ac (patch)
tree1d15289894a456229dc7416863b1ad530f467c43 /.config/fish/functions/_tide_item_context.fish
parentac3630acff3a49da55913f4e66d0af4aacdebec8 (diff)
Updated tide
Diffstat (limited to '.config/fish/functions/_tide_item_context.fish')
-rw-r--r--.config/fish/functions/_tide_item_context.fish12
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