oh-my-fish_theme-bobthefish/fish_title.fish

46 lines
1.2 KiB
Fish
Raw Normal View History

2015-10-27 18:05:01 +00:00
# You can override some default title options in your config.fish:
# set -g theme_title_display_process no
# set -g theme_title_display_command no
2015-10-27 18:05:01 +00:00
# set -g theme_title_display_path no
# set -g theme_title_display_user yes
2015-10-27 18:05:01 +00:00
# set -g theme_title_use_abbreviated_path no
function __bobthefish_title_user -S -d 'Display actual user if different from $default_user'
if [ "$theme_title_display_user" = 'yes' ]
2017-01-09 23:55:09 +00:00
if [ "$USER" != "$default_user" -o -n "$SSH_CLIENT" ]
set -l IFS .
hostname | read -l hostname __
echo -ns (whoami) '@' $hostname ' '
end
end
end
function __display_path -d 'Display the full or abbreviated path'
if [ "$theme_title_use_abbreviated_path" = 'no' ]
echo $PWD
else
prompt_pwd
end
end
2013-09-18 06:17:15 +00:00
function fish_title
__bobthefish_title_user
2017-01-09 23:55:09 +00:00
if [ "$theme_title_display_process" = 'yes' -a "$theme_title_display_command" != 'yes' ]
2015-10-27 18:05:01 +00:00
echo $_
[ "$theme_title_display_path" != 'no' ]
and echo ' '
and __display_path
else
if [ "$theme_title_display_path" != 'no' ]
__display_path
echo ' '
end
2015-10-27 18:05:01 +00:00
if [ $_ != 'fish' ]
echo $argv[1]
end
2015-10-27 18:05:01 +00:00
end
end