tide/functions/_tide_item_context.fish

15 lines
475 B
Fish
Raw Normal View History

2020-05-20 20:05:33 +03:00
function _tide_item_context
2020-12-26 19:42:21 +03:00
if set -q SSH_TTY
2023-07-07 03:20:14 +03:00
set -fx tide_context_color $tide_context_color_ssh
2022-07-30 00:49:47 +03:00
else if test "$EUID" = 0
2023-07-07 03:20:14 +03:00
set -fx tide_context_color $tide_context_color_root
2021-03-02 20:46:40 +03:00
else if test "$tide_context_always_display" = true
2023-07-07 03:20:14 +03:00
set -fx tide_context_color $tide_context_color_default
else
return
end
2023-07-07 03:20:14 +03:00
2023-07-07 07:14:40 +03:00
string match -qr "^(?<h>(\.?[^\.]*){0,$tide_context_hostname_parts})" @$hostname
_tide_print_item context $USER$h
2021-03-02 20:46:40 +03:00
end