fish-shell/share/functions/prompt_hostname.fish

11 lines
376 B
Fish
Raw Normal View History

2016-10-24 05:56:18 +08:00
# Fetching the host name can be expensive if there is a problem with DNS or whatever subsystem the
# hostname command uses. So cache the answer so including it in the prompt doesn't make fish seem
# slow.
if not set -q __fish_prompt_hostname
set -g __fish_prompt_hostname (hostname | string split '.')[1]
end
2016-10-24 06:02:14 +08:00
function prompt_hostname
2016-10-24 05:56:18 +08:00
echo $__fish_prompt_hostname
end