virtualfish的文档说明,为了使fish提示显示当前的virtualenv,您应该更新全局fish_prompt函数并保存它(funced fish_prompt和FunctionSavefish_prompt)。我不认为这种方法特别优雅,因为我希望在config.fish中实现所有的自定义。因此,我的问题是,仅在virtualenv中进行更改,在fish prompt中显示当前config.fish名称的最简单方法是什么?
因此,如果foobar是当前环境的名称,那么如何将其显示为:
(foobar) gedefar@Jakobs-MacBook-Pro ~/w/pyprototypes`发布于 2014-03-28 08:54:02
我发现的最简单的方法是在fish_prompt中重写config.fish函数。
functions -c fish_prompt _old_fish_prompt
function fish_prompt
if set -q VIRTUAL_ENV
echo -n -s (set_color -b blue white) "(" (basename "$VIRTUAL_ENV") ")" (set_color normal) " "
end
_old_fish_prompt
endhttps://stackoverflow.com/questions/22708064
复制相似问题