Z-shell productivity: the prompt and title

· Read in about 2 min · (265 Words)
zsh shell github prompt

I’ve recently been playing with a cool project on GitHub: zshkit . It’s a basically just way of organising your zsh config files, but it’s inspired me to look at improving my shell productivity and I hope to post a few times about this.

One of the many changes I made to my fork of zshkit, is to minimise the prompt. It’s something I’ve not really considered before, and I’ve pretty much always used something a lot like gentoo’s default. Here’s a screenshot of my new prompt and title:

Minimalist Prompt

The top line shows the prompt when outside of a git repository and the bottom shows how it looks from within one. Normally, it shows the current directory on the left and the last command’s exit status (a yellow $ means a failure). When I’m inside a git repository, it shows the current branch, with the branch name coloured cyan when the repository is clean and magenta when there are pending changes.

This only really works when coupled with a decent title in your terminal. Whilst looking around, I found _why’s which seems to work really well and is what you can see at the top of the screenshot. The next step would seem to be _why’s screenrc, but I don’t really ever use screen, despite being aware of the awesomeness.

My prompt is it github, with everything else:

  • prompt_git_setup
  • to use it, you need something like this: git-prompt
  • and something like this in your rc files:

    autoload promptinit && promptinit && prompt git
    

It’s probably easier to fork your own zshkit and go from there.

Comments