I've got used to the path shortening strategy used by prezto, which shortens all directories to first character except for the last segment. Is there a way to add a custom shorten strategy without having to modify p10k code?
Please try the following:
~/.p10k.zsh.anchor_files and set the value of this parameter to ().local anchor_files=()
POWERLEVEL9K_DIR_MAX_LENGTH and set the value of this parameter to 1.typeset -g POWERLEVEL9K_DIR_MAX_LENGTH=1
You can also optionally adjust colors. Look for POWERLEVEL9K_DIR_FOREGROUND, POWERLEVEL9K_DIR_SHORTENED_FOREGROUND, POWERLEVEL9K_DIR_ANCHOR_FOREGROUND and POWERLEVEL9K_DIR_ANCHOR_BOLD.
There is one difference compared to what Prezto does. Directory names are truncated to the shortest unique prefix rather than always to a single character. This makes truncation reversible: you can copy-paste the directory from prompt and TAB-expand it to the original.
For details about directory truncation in powerlevel10k, see https://github.com/romkatv/powerlevel10k#current-directory-that-just-works and read comments in ~/.p10k.zsh under [ dir: current directory ] banner.
Let me know if this is sufficient for your needs. If not, there are other options.
Yeah, it's not exactly the same but I guess "shorter" enough. Thanks!
Glad it's worked out for you.
If you are feeling adventurous, try restoring anchor_files to its original value. This way important directories such as roots of Git repositories won't be shortened.
~/work/project/src/backend~/w/p/s/backend~/w/project/s/backend
Most helpful comment
Please try the following:
~/.p10k.zsh.anchor_filesand set the value of this parameter to().POWERLEVEL9K_DIR_MAX_LENGTHand set the value of this parameter to1.You can also optionally adjust colors. Look for
POWERLEVEL9K_DIR_FOREGROUND,POWERLEVEL9K_DIR_SHORTENED_FOREGROUND,POWERLEVEL9K_DIR_ANCHOR_FOREGROUNDandPOWERLEVEL9K_DIR_ANCHOR_BOLD.There is one difference compared to what Prezto does. Directory names are truncated to the shortest unique prefix rather than always to a single character. This makes truncation reversible: you can copy-paste the directory from prompt and TAB-expand it to the original.
For details about directory truncation in powerlevel10k, see https://github.com/romkatv/powerlevel10k#current-directory-that-just-works and read comments in
~/.p10k.zshunder[ dir: current directory ]banner.Let me know if this is sufficient for your needs. If not, there are other options.