是否有鱼交互式外壳为全路径的方式来进行显示。目前,当我浏览到一个目录,我得到了下面的shell。

millermj@Dodore ~/o/workspace

但我宁愿见

millermj@Dodore ~/o-town/workspace
有帮助吗?

解决方案

随着新fishshell(V2.3),你可以做set -U fish_prompt_pwd_dir_length 0。它将使用完整路径。我还使用标枪鱼公司我的主题。参见下面的示例:

其他提示

下面是我prompt_pwd的版本,应该会显示你在找什么:

function prompt_pwd --description 'Print the current working directory, NOT shortened to fit the prompt'
    if test "$PWD" != "$HOME"
        printf "%s" (echo $PWD|sed -e 's|/private||' -e "s|^$HOME|~|")
    else
        echo '~'
    end

end

这将显示在主目录中的波浪,像往常一样,但是移除sed命令,只有当你是一个几个目录是直接从每个目录的第一个字母深。

要编辑prompt_pwd使用funced。它可以让你以交互方式改变功能。在命令行键入funced prompt_pwd。一旦提示显示自己的喜好,使用funcsave prompt_pwd使行为在将来的会话持续。

我个人不喜欢触摸共享/默认值。鱼有很大的功能设计,所以利用这一点。

与内容创建~/.config/fish/functions/prompt_long_pwd.fish

function prompt_long_pwd --description 'Print the current working directory'
        echo $PWD | sed -e "s|^$HOME|~|" -e 's|^/private||'
end

然后,只需编辑~/.config/fish/functions/fish_prompt.fish使用prompt_long_pwd。这里是我使用的自定义提示:

<强>〜/的.config /鱼/ config.fish

set -g __fish_git_prompt_show_informative_status 1
set -g __fish_git_prompt_hide_untrackedfiles 1

set -g __fish_git_prompt_color_branch magenta bold
set -g __fish_git_prompt_showupstream "informative"
set -g __fish_git_prompt_char_upstream_ahead "↑"
set -g __fish_git_prompt_char_upstream_behind "↓"
set -g __fish_git_prompt_char_upstream_prefix ""

set -g __fish_git_prompt_char_stagedstate "●"
set -g __fish_git_prompt_char_dirtystate "✚"
set -g __fish_git_prompt_char_untrackedfiles "…"
set -g __fish_git_prompt_char_conflictedstate "✖"
set -g __fish_git_prompt_char_cleanstate "✔"

set -g __fish_git_prompt_color_dirtystate blue
set -g __fish_git_prompt_color_stagedstate yellow
set -g __fish_git_prompt_color_invalidstate red
set -g __fish_git_prompt_color_untrackedfiles $fish_color_normal
set -g __fish_git_prompt_color_cleanstate green bold

<强>〜/的.config /鱼/功能/ fish_prompt.fish

function fish_prompt --description 'Write out the prompt'

    set -l last_status $status

    if not set -q __fish_prompt_normal
        set -g __fish_prompt_normal (set_color normal)
    end

    # PWD
    set_color $fish_color_cwd
    echo -n (prompt_long_pwd)
    set_color normal

    printf '%s ' (__fish_git_prompt)

    if not test $last_status -eq 0
    set_color $fish_color_error
    end

    echo -n '$ '

end

prompt_pwd函数确定将被显示的功能。你应该能够编写自己的版本,以获得你想要的东西。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top