Fish-style file paths in zsh with agnoster 26 Nov 2020
For users using the agnoster theme on zsh that wish to use the path style from the shrink-path
plugin, there isn’t a straightforward way yet to enable this (As of now there is a PR open for this).
A quick workaround could be to just add the plugin output in the theme itself. We’ll edit the theme to add the output in the shell prompt.
I’m using oh-my-zsh
in this case, so the shrink-path
plugin is located in the oh-my-zsh
folder. To change the file prompt we have to modify the prompt_dir()
function in agnoster.zsh-theme
, the following is a modified version with the prompt added.
prompt_dir() {
setopt prompt_subst
source ~/.oh-my-zsh/plugins/shrink-path/shrink-path.plugin.zsh
prompt_segment blue $CURRENT_FG "$(shrink_path -f)"
}
Which results in this prompt: