小编lon*_*its的帖子

如何让鱼壳提示显示主机名?

我试图让我的 Fish 提示看起来像旧的 Gentoo shell。

user@hostname ~ % 其中 user@hostname 为绿色,$PWD 和符号为蓝色。

现在它只显示:user@ ~ %,没有主机名。

aaron@ ~ % su -
Password: 
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
root@ ~ % hostname
rpi
root@ ~ % cat .config/fish/functions/fish_prompt.fish 
function fish_prompt
      if not set -q $__fish_prompt_hostname
        set -g __fish_prompt_hostname (hostname)
     end
     set_color -o red
     echo -n -s "$USER" @ "$__fish_prompt_hostname" " "
     set_color -o blue
     echo -n (prompt_pwd)
     echo -n " % …
Run Code Online (Sandbox Code Playgroud)

shell prompt fish

5
推荐指数
1
解决办法
6239
查看次数

标签 统计

fish ×1

prompt ×1

shell ×1