Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Is it worthwhile to use oh-my-zsh?



On Sat, Sep 7, 2019 at 1:19 PM Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx> wrote:
>
> Roman Perepelitsa wrote:
> > Note that vcs_info is likely to make your prompt noticeably sluggish.
>
> Depends on configuration. The defaults avoid most features that are
> particularly expensive.

I've been using the following lately ... note that I am pathologically
allergic to "setopt prompt_subst":

###

autoload -Uz add-zsh-hook
autoload -Uz vcs_info
vcs-info-v() { vcs_info; RPS1=${vcs_info_msg_0_% } }
add-zsh-hook precmd vcs-info-v

zstyle ':vcs_info:*' enable git cvs
zstyle ':vcs_info:*' actionformats \
   '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f '
zstyle ':vcs_info:*' formats       \
   '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{5}]%f '
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'

# Add up/down arrows after branch name, if there are changes to pull/to push
# Credit Danial Shahaf, edited to remove hardwired Unicode arrows
zstyle ':vcs_info:git+post-backend:*' hooks git-post-backend-updown
+vi-git-post-backend-updown() {
  git rev-parse @{upstream} >/dev/null 2>&1 || return
  local -a x; x=( $(git rev-list --left-right --count HEAD...@{upstream} ) )
  hook_com[branch]+="%f" # end coloring
  # Edit if terminal supports Unicode arrows
  (( x[2] )) && hook_com[branch]+='<' # $'\u2193'
  (( x[1] )) && hook_com[branch]+='>' # $'\u2191'
  return 0
}

PS1='%# '
autoload promptinit
promptinit
prompt bart green white yellow
git-chpwd () {
  prompt_bart_ps1
  local remote=$(git config --get remote.origin.url)
  # Hack PS1 from bart theme to insert git origin in place of current directory
  # This tells me which repository the "master" branch belongs to
  PS1=${PS1:s/%8~/${remote:-%8~}}
}
add-zsh-hook chpwd git-chpwd

###

Regarding oh-my-zsh, if I were going to start using a plugin system,
I'd probably use the one Sebastian has been working on instead.



Messages sorted by: Reverse Date, Date, Thread, Author