zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Frank Terbeck <ft@bewatermyfriend.org>
Cc: Roman Perepelitsa <roman.perepelitsa@gmail.com>,
	Peng Yu <pengyu.ut@gmail.com>,  zsh-users <zsh-users@zsh.org>
Subject: Re: Is it worthwhile to use oh-my-zsh?
Date: Sat, 7 Sep 2019 17:33:15 -0700	[thread overview]
Message-ID: <CAH+w=7aX-W2RRtZeMwedxD3gTQyT+ZzK7XPcVEHHoZ0nJuMMVg@mail.gmail.com> (raw)
In-Reply-To: <87woejhnct.fsf@ft.bewatermyfriend.org>

On Sat, Sep 7, 2019 at 1:19 PM Frank Terbeck <ft@bewatermyfriend.org> 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.

  reply	other threads:[~2019-09-08  0:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-06 18:37 Peng Yu
     [not found] ` <CAO1rNLj9YA+4a+5SV+PURsfPJXNm8xY45i6kbrsPpF2NFY1fsg@mail.gmail.com>
2019-09-06 19:33   ` Peng Yu
2019-09-07  0:43     ` Danh Doan
2019-09-07  0:49       ` Yaro Kasear
2019-09-07  1:40       ` Peng Yu
2019-09-07  1:59         ` Danh Doan
2019-09-07 12:22       ` Daniel Shahaf
2019-09-07 13:58 ` Roman Perepelitsa
2019-09-07 20:18   ` Frank Terbeck
2019-09-08  0:33     ` Bart Schaefer [this message]
2019-09-08 15:41       ` Roman Perepelitsa
2019-09-08 19:05         ` Nick Cross
2019-09-08 19:41           ` Roman Perepelitsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7aX-W2RRtZeMwedxD3gTQyT+ZzK7XPcVEHHoZ0nJuMMVg@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=ft@bewatermyfriend.org \
    --cc=pengyu.ut@gmail.com \
    --cc=roman.perepelitsa@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).