0

I am using the Agnoster theme with Oh-my-zsh in iTerm2. Is it possible to hide the current directory if you're in a Git repo to avoid needless duplication, if so how?

Here is a gist of my zsh setup

enter image description here

Interestingly, the actual Agnoster theme screenshot does not duplicate the directory (as I was expecting)

jshjohnson
  • 157
  • 4
  • 16
  • Of course it's possible. Just fork the thing and add a conditional yourself. – 4ae1e1 Jul 31 '15 at 21:16
  • The part in green should be the current **branch name**. If so it would not really be a duplication of the path. _But still a weird branch name_ – AnimiVulpis Jul 22 '16 at 07:05

1 Answers1

0

As noted by @4ae1e1 you can fork the theme and include a conditional.

In the directory prompt here,

prompt_dir() {
   prompt_segment blue black '%~'
}

Include a conditional which would display directory information only if it was not in a git directory, like

prompt_dir() {
  if ! (git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
     prompt_segment blue black '%~'
  fi
}
salmanulfarzy
  • 1,484
  • 14
  • 18