如果在Git repo中删除当前目录

时间:2015-07-30 10:43:53

标签: zsh zshrc oh-my-zsh iterm2

我在iTerm2中使用了Agnoster主题与Oh-my-zsh。是否可以隐藏当前目录,如果你在Git仓库中以避免不必要的重复,如果是这样的话怎么办?

Here is a gist of my zsh setup

enter image description here

有趣的是,the actual Agnoster theme screenshot不会复制目录(正如我所料)

1 个答案:

答案 0 :(得分:0)

@4ae1e1所述,您可以分叉主题并包含条件。

在目录提示符here中,

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

包含一个条件,只有当它不在git目录中时才显示目录信息,如

prompt_dir() {
  if ! (git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
     prompt_segment blue black '%~'
  fi
}
相关问题