I installed fish shell, installed few themes. Applied the theme "agnoster", all good is pretty but I want fish_prompt to override the original one and keep the styles in order to show me full path properly. Currently the full path is a shortcut such as Desktop/Abba
turns to ~D/Abba
and I want to remove the D and will it be ~Desktop/Abba
. How can I override function fish_prompt
properly so that I am able to call the original previous function from the theme to keep up the styles?
Asked
Active
Viewed 524 times
2

Vitali Pomanitski
- 47
- 6
2 Answers
0
The agnoster theme uses fish's prompt_pwd
function to display the pwd.
That shortens each path component to $fish_prompt_pwd_dir_length characters. Set that variable to 0 to inhibit shortening entirely.
Alternatively, you can change the prompt_pwd function however you want it, e.g. via funced prompt_pwd
(and funcsave prompt_pwd
once you're happy with the result).

faho
- 14,470
- 2
- 37
- 47
0
I've had a similar issue, but the chosen answer didn't work for me.
In my case, I've had to source all theme files manually before overriding the fish_prompt
function.
For example
source $OMF_PATH/init.fish # assure omf is loaded before run the following code
# Read current theme
test -f $OMF_CONFIG/theme
and read -l theme < $OMF_CONFIG/theme
or set -l theme default
set -l theme_functions_path {$OMF_CONFIG,$OMF_PATH}/themes*/$theme/functions/
for conf in $theme_functions_path/*.fish
source $conf
end
function fish_prompt
# prompt_theme_foo
# prompt_theme_bar
end
More details on: https://stackoverflow.com/a/72098697/2180456

Alan Alves de Oliveira
- 663
- 1
- 8
- 21