skip to Main Content

Good morning, please I installed fish (version 3.6.1) with tide (version 5.5.1) on Debian.
I configured tide with the following options selected …
Prompt Style (3) Rainbow
Prompt Colors (1) True color
Show current time? (1) No
Prompt Separators (2) Vertical
Prompt Heads (2) Blurred
Prompt Tails (2) Blurred
Prompt Height (1) One line
Prompt Spacing (2) Sparse
Icons (2) Many icons

All is well with this prompt for me until I go into several directories, like
cd ~/Development/freecodecamp/ResponsiveWebDesign/C01 Learn HTML/
and the result is
░▒▓    ~/Development/freecodecamp/ResponsiveWebDesign/C01 Learn HTML   master ▓▒░
I would desire to have … ░▒▓    C01 Learn HTML   master ▓▒░

The only modification from the default fish/tide installation

cat ~/.config/fish/conf.d/10-camechi-config.fish
# My configurations for fish shell   20230615

function fish_greeting
    fortune
end

if type -q exa
    alias ll "exa -l -g --icons"
    alias lla "ll -a"
end

set -gx PATH $HOME/bin $HOME/.local/bin $PATH

My Screen
I would need necessary assistance to get the desired prompt.

I have read the documentations and tried some old hints from the forums/websites.
Using basename (pwd) or basename ($PWD) give me a text-like prompt.

I desire the current directory only with the fancy prompt in the image 😉

Thank you

2

Answers


  1. Chosen as BEST ANSWER

    I succeeded in getting my desired prompt, showing only the current directory name. Thanks to @faho for the helpful hint.

    I created a fish script, 15-camechi_tide_pwd.fish, in the conf.d directory rather than directly changing the _tide_pwd.fish in functions directory. Below is the content of 15-camechi_tide_pwd.fish

    set_color -o $tide_pwd_color_anchors | read -l color_anchors
    set_color $tide_pwd_color_truncated_dirs | read -l color_truncated
    set -l reset_to_color_dirs (set_color normal -b $tide_pwd_bg_color; set_color $tide_pwd_color_dirs)
    
    set -l unwritable_icon $tide_pwd_icon_unwritable' '
    set -l home_icon $tide_pwd_icon_home' '
    set -l pwd_icon $tide_pwd_icon' '
    
    eval "function _tide_pwd
        if set -l split_pwd (string replace -r '^$HOME' '' -- $PWD | string split /)
            test -w . && set -f split_output "$pwd_icon$split_pwd[1]" ||
                set -f split_output "$unwritable_icon$split_pwd[1]"
            set split_output[-1] "$color_anchors$split_output[-1]$reset_to_color_dirs"
        else
            set -f split_output "$home_icon$color_anchors"
        end
        string join -- / "$reset_to_color_dirs$split_output[1]$(basename (prompt_pwd))"
    end"
    

    Image of my terminal


  2. This is not a thing that tide does. It doesn’t have an option for it – see their wiki.

    That being said, tide is just a bunch of fish script, so you can adjust it if you want. However, it’s written in a fairly peculiar style that isn’t very amenable to overriding specific functions.

    You can try changing _tide_pwd to

    function _tide_pwd
        path basename -- $PWD
    end
    

    (using fish’s path builtin to avoid the often surprisingly slow basename command)

    The easiest way to do this is funced _tide_pwd and funcsave _tide_pwd once it works.

    This might work unless tide throws a wrench in the way.

    Other than that, consider opening an issue on the tide repo.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search