Make long ZSH path short

When you have a deeply nested folder, working in zsh is problematic

something that looks like this: long zsh path

can be made to look like this: short zsh path

if you ever need to find out the full path, just type $ pwd.

here’s how you do it:

find out your current theme in your .zshrc file


Open up that theme by going to your themes folder

$ cd ~/.oh-my-zsh/themes/

I’m using the cobalt2 theme so I opened that theme up and commented out the existing code (comments are made using #)

prompt_dir() {
  prompt_segment blue black '%2/' 

Since I have the number 2, I will only ever see 2 directories

Leave a Reply

Your email address will not be published. Required fields are marked *