See Your Full File Path Using Oh My Zsh

May 11, 2020

Oh My Zsh is easily one of my favorite tools as a web developer. If you’re not familiar with it I highly recommend that you take a look. It’s honestly one of the first things I install on a new computer. The only complaint I can make is that in the default theme the prompt just shows the current folder, rather than the full path. I’m too lazy to be typing pwd all the time, so if you are too lets take a look at how to update the default theme.

Once you’ve installed Oh My Zsh you can find the themes in ~/.oh-my-zsh/themes. There are a lot there but most of them are either way too busy or kinda ugly, so that’s why I want to stick with the default one and just make this one change. The default is robbyrussell.zsh-theme, so make a copy - renaming it to whatever you want - and open it up in your favorite text editor.

Themes aren’t exactly made for human readability. That’s okay, you’re just making one simple change here. Look for %c on the second line. That’s the part of the prompt we’re trying to change and currently it represents just the working directory. Change it to %~. That’s all there is to it, you’ll now get the full path. You could also use %d which doesn’t shorten your home directory; so /Users/yourname/.oh-my-zsh/themes instead of ~/.oh-my-zsh/themes, but I prefer the shortened version.

Now, if you go back to your terminal you actually won’t see the change yet. First you need to point to your new theme and then you need to reload your profile. Open ~/.zshrc in your code editor. The theme is set on line 11. Change robbyrussell to whatever you named your copy. Now type source ~/.zshrc in the terminal to reload the profile and you’ll see the change take effect.


Blog/Tutorials from Justin Blaisdell, a UI Developer living in Austin Texas. Contact Me!

© 2020 Justin Blaisdell