我尝试按照此处的步骤配置提示:https ://nixos.wiki/wiki/Fish
结合此处有关基本文件位置和内容的信息:https ://fishshell.com/docs/current/faq.html#how-do-i-set-my-prompt
如果我理解正确,内容fish_prompt.fish
应该是:
set -l nix_shell_info (
if test -n "$IN_NIX_SHELL"
echo -n "<nix-shell> "
end
)
function fish_prompt
set_color $fish_color_cwd
echo -n (prompt_pwd)
set_color normal
echo -n -s ' $nix_shell_info ~>'
end
以这种方式设置后,无论是否在 a 中,提示都是相同的,nix-shell
并且变量$nix_shell_info
没有被设置。
如何设置它以使其按预期工作?