This is me coding

hire me back

Make the oh-my-zsh theme agnoster multiline

I’m a big fan of oh-my-zsh and in particular of the agnoster theme you can install.

The regular setup is single line and looks something like this: agnoster regular

My own setup looks more like this: agnoster multiline

I like to use a larger font and split my screens. My screensize is somewhat smalls (MacBook Pro 13 inch from 2011). So I decided I should make agnoster multiline which gives me back some of my screen real estate ;)

This is the code I used to make agnoster multiline.

prompt_newline() {
  if [[ -n $CURRENT_BG ]]; then
    echo -n "\%{\%k\%F{$CURRENT_BG}\%}$SEGMENT_SEPARATOR
\%{\%k\%F{blue}\%}$SEGMENT_SEPARATOR"
  else
    echo -n "\%{\%k\%}"
  fi

  echo -n "\%{\%f\%}"
  CURRENT_BG=''
}

(Note: remove the backslashes \ when copying this in. Or get it from my github page github)

The code above creates the arrow like seperator after which you can start typing your terminal commands.

Now we only need to add this newline funtction to the one that combines all the functions.

## Main prompt
build_prompt() {
  RETVAL=$?
  prompt_status
  prompt_virtualenv
  prompt_context
  prompt_dir
  prompt_git
  prompt_hg
  prompt_newline
  prompt_end
}

Now your terminal should look more like this.

agnoster multiline

Hope you enjoyed this post :smile:

Written on March 6, 2015