I\'m having a lot of trouble getting zsh to shorten my prompt. I\'m currently using zsh with the agnoster theme and oh-my-zsh package manager.
My prompt currently gets a
First you would have to copy the theme into a different one in order to customize it to your liking.
agnoster.zsh-theme
to e.g. mytheme.zsh-theme
and select it in your .zshrc
I looked at the agnoster theme and found a place where you could save space.
prompt_dir() {
prompt_segment blue $CURRENT_FG ' %~ '
}
could be changed to
prompt_dir() {
prompt_segment blue $CURRENT_FG ' %25<...<%~%<< '
}
This will truncate your path to 25 characters and replacing more with ...
How this works is described in the zsh manual (linked below).
Short explanation is:
%25<...<
will truncate everything that is longer than 25 characters to ...
%<<
will basically tell zsh that anything after this should not be truncated (limiting the truncation to the path part)I leave it to you to find more places where you can save space by.
And for more customization needs take a look at zsh: 13 Prompt Expansion