zsh-users
 help / color / Atom feed
* Is it worthwhile to use oh-my-zsh?
@ 2019-09-06 18:37 Peng Yu
       [not found] ` <CAO1rNLj9YA+4a+5SV+PURsfPJXNm8xY45i6kbrsPpF2NFY1fsg@mail.gmail.com>
  2019-09-07 13:58 ` Roman Perepelitsa
  0 siblings, 2 replies; 13+ messages in thread
From: Peng Yu @ 2019-09-06 18:37 UTC (permalink / raw)
  To: zsh-users

Hi,

I just have a vanilla ~/.zshrc. I'd like something essential things
like PS1 set to my pwd and hostname, etc. I saw people use things like
oh-my-zsh to make some fancy things like showing git branches, etc.,
if in a git repo. But if I remember it correctly, it could cause a
little sluggish that can be sensed.

So if I just want something essential, and not to want to feel any
sluggishness, I'd better just configure ~/.zshrc on my own without
using things like oh-my-zsh configured by others.

-- 
Regards,
Peng

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Is it worthwhile to use oh-my-zsh?
       [not found] ` <CAO1rNLj9YA+4a+5SV+PURsfPJXNm8xY45i6kbrsPpF2NFY1fsg@mail.gmail.com>
@ 2019-09-06 19:33   ` Peng Yu
  2019-09-07  0:43     ` Danh Doan
  0 siblings, 1 reply; 13+ messages in thread
From: Peng Yu @ 2019-09-06 19:33 UTC (permalink / raw)
  To: Tom Boyd; +Cc: zsh-users

I just tried it. I commented out this in my ~/.zshrc.
#plugins=(git)

In a .git repo, it shows the git branch and the basename of the parent
directory. But this is not the formation that I need. I almost always
in the master branch, in which case I don't care showing the branch
name. I have many directory with the same basename, just showing the
basename of my currently is not informative.

How to get rid off these features?

On 9/6/19, Tom Boyd <tvboyd23@gmail.com> wrote:
> Yes very much so. Omz is tremendously powerful and is loaded with features
> that completely change the game in terms of productivity. Once you start
> using it it's actually really hard to go back once you've got the common
> usage in muscle memory. I've never had any issues with sluggishness either,
> with the config I currently have I find it just as fast as vanilla zsh.
>
> On Fri, Sep 6, 2019, 2:38 PM Peng Yu <pengyu.ut@gmail.com> wrote:
>
>> Hi,
>>
>> I just have a vanilla ~/.zshrc. I'd like something essential things
>> like PS1 set to my pwd and hostname, etc. I saw people use things like
>> oh-my-zsh to make some fancy things like showing git branches, etc.,
>> if in a git repo. But if I remember it correctly, it could cause a
>> little sluggish that can be sensed.
>>
>> So if I just want something essential, and not to want to feel any
>> sluggishness, I'd better just configure ~/.zshrc on my own without
>> using things like oh-my-zsh configured by others.
>>
>> --
>> Regards,
>> Peng
>>
>


-- 
Regards,
Peng

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Is it worthwhile to use oh-my-zsh?
  2019-09-06 19:33   ` Peng Yu
@ 2019-09-07  0:43     ` Danh Doan
  2019-09-07  0:49       ` Yaro Kasear
                         ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Danh Doan @ 2019-09-07  0:43 UTC (permalink / raw)
  To: zsh-users, Peng Yu, Tom Boyd

On September 6, 2019 7:33:31 PM UTC, Peng Yu <pengyu.ut@gmail.com> wrote:
>I just tried it. I commented out this in my ~/.zshrc.
>#plugins=(git)
>
>In a .git repo, it shows the git branch and the basename of the parent
>directory. But this is not the formation that I need. I almost always
>in the master branch, in which case I don't care showing the branch
>name. I have many directory with the same basename, just showing the
>basename of my currently is not informative.
>
>How to get rid off these features?
>
>On 9/6/19, Tom Boyd <tvboyd23@gmail.com> wrote:
>> Yes very much so. Omz is tremendously powerful and is loaded with
>features
>> that completely change the game in terms of productivity. Once you
>start
>> using it it's actually really hard to go back once you've got the
>common
>> usage in muscle memory. I've never had any issues with sluggishness
>either,
>> with the config I currently have I find it just as fast as vanilla
>zsh.
>>
>> On Fri, Sep 6, 2019, 2:38 PM Peng Yu <pengyu.ut@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I just have a vanilla ~/.zshrc. I'd like something essential things
>>> like PS1 set to my pwd and hostname, etc. I saw people use things
>like
>>> oh-my-zsh to make some fancy things like showing git branches, etc.,
>>> if in a git repo. But if I remember it correctly, it could cause a
>>> little sluggish that can be sensed.
>>>
>>> So if I just want something essential, and not to want to feel any
>>> sluggishness, I'd better just configure ~/.zshrc on my own without
>>> using things like oh-my-zsh configured by others.
>>>
>>> --
>>> Regards,
>>> Peng
>>>
>>

I don't like oh-my-zsh.
IMHO, it's too slow.
If you simply want to show current directory, zsh come with some pre-installed prompt
Use:
prompt -h
to show the available options and prompts.
-- 
Danh

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Is it worthwhile to use oh-my-zsh?
  2019-09-07  0:43     ` Danh Doan
@ 2019-09-07  0:49       ` Yaro Kasear
  2019-09-07  1:40       ` Peng Yu
  2019-09-07 12:22       ` Daniel Shahaf
  2 siblings, 0 replies; 13+ messages in thread
From: Yaro Kasear @ 2019-09-07  0:49 UTC (permalink / raw)
  To: zsh-users

I used to use oh-my-zsh. I switched to Antigen which is a lot less slow,
but has compatibility with the OMZ stuff.

Yaro

On 9/6/19 7:43 PM, Danh Doan wrote:
> On September 6, 2019 7:33:31 PM UTC, Peng Yu <pengyu.ut@gmail.com> wrote:
>> I just tried it. I commented out this in my ~/.zshrc.
>> #plugins=(git)
>>
>> In a .git repo, it shows the git branch and the basename of the parent
>> directory. But this is not the formation that I need. I almost always
>> in the master branch, in which case I don't care showing the branch
>> name. I have many directory with the same basename, just showing the
>> basename of my currently is not informative.
>>
>> How to get rid off these features?
>>
>> On 9/6/19, Tom Boyd <tvboyd23@gmail.com> wrote:
>>> Yes very much so. Omz is tremendously powerful and is loaded with
>> features
>>> that completely change the game in terms of productivity. Once you
>> start
>>> using it it's actually really hard to go back once you've got the
>> common
>>> usage in muscle memory. I've never had any issues with sluggishness
>> either,
>>> with the config I currently have I find it just as fast as vanilla
>> zsh.
>>> On Fri, Sep 6, 2019, 2:38 PM Peng Yu <pengyu.ut@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> I just have a vanilla ~/.zshrc. I'd like something essential things
>>>> like PS1 set to my pwd and hostname, etc. I saw people use things
>> like
>>>> oh-my-zsh to make some fancy things like showing git branches, etc.,
>>>> if in a git repo. But if I remember it correctly, it could cause a
>>>> little sluggish that can be sensed.
>>>>
>>>> So if I just want something essential, and not to want to feel any
>>>> sluggishness, I'd better just configure ~/.zshrc on my own without
>>>> using things like oh-my-zsh configured by others.
>>>>
>>>> --
>>>> Regards,
>>>> Peng
>>>>
> I don't like oh-my-zsh.
> IMHO, it's too slow.
> If you simply want to show current directory, zsh come with some pre-installed prompt
> Use:
> prompt -h
> to show the available options and prompts.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Is it worthwhile to use oh-my-zsh?
  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
  2 siblings, 1 reply; 13+ messages in thread
From: Peng Yu @ 2019-09-07  1:40 UTC (permalink / raw)
  To: Danh Doan; +Cc: zsh-users, Tom Boyd

> I don't like oh-my-zsh.
> IMHO, it's too slow.
> If you simply want to show current directory, zsh come with some pre-installed prompt
> Use:
> prompt -h
> to show the available options and prompts.

I don't see it. Where is it?

➜  ~ prompt -h
zsh: command not found: prompt

-- 
Regards,
Peng

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Is it worthwhile to use oh-my-zsh?
  2019-09-07  1:40       ` Peng Yu
@ 2019-09-07  1:59         ` Danh Doan
  0 siblings, 0 replies; 13+ messages in thread
From: Danh Doan @ 2019-09-07  1:59 UTC (permalink / raw)
  To: Peng Yu; +Cc: zsh-users, Tom Boyd

On September 7, 2019 1:40:51 AM UTC, Peng Yu <pengyu.ut@gmail.com> wrote:
>> I don't like oh-my-zsh.
>> IMHO, it's too slow.
>> If you simply want to show current directory, zsh come with some
>pre-installed prompt
>> Use:
>> prompt -h
>> to show the available options and prompts.
>
>I don't see it. Where is it?
>
>➜  ~ prompt -h
>zsh: command not found: prompt

You need to load promptinit first.
autoload promptinit && promptinit && prompt -h
-- 
Danh

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Is it worthwhile to use oh-my-zsh?
  2019-09-07  0:43     ` Danh Doan
  2019-09-07  0:49       ` Yaro Kasear
  2019-09-07  1:40       ` Peng Yu
@ 2019-09-07 12:22       ` Daniel Shahaf
  2 siblings, 0 replies; 13+ messages in thread
From: Daniel Shahaf @ 2019-09-07 12:22 UTC (permalink / raw)
  To: Danh Doan; +Cc: zsh-users, Peng Yu, Tom Boyd

Danh Doan wrote on Sat, Sep 07, 2019 at 00:43:50 +0000:
> I don't like oh-my-zsh.
> IMHO, it's too slow.
> If you simply want to show current directory, zsh come with some pre-installed prompt
> Use:
> prompt -h
> to show the available options and prompts.

For git information, see vcs_info in zshcontrib(1), and Misc/vcs_info-examples
in the source distribution.  Minimal example:

cd …/.git(:h)
autoload vcs_info
vcs_info && print -rP - ${vcs_info_msg_0_}

(sic)

To change the information printed, start with the 'formats' style.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Is it worthwhile to use oh-my-zsh?
  2019-09-06 18:37 Is it worthwhile to use oh-my-zsh? Peng Yu
       [not found] ` <CAO1rNLj9YA+4a+5SV+PURsfPJXNm8xY45i6kbrsPpF2NFY1fsg@mail.gmail.com>
@ 2019-09-07 13:58 ` Roman Perepelitsa
  2019-09-07 20:18   ` Frank Terbeck
  1 sibling, 1 reply; 13+ messages in thread
From: Roman Perepelitsa @ 2019-09-07 13:58 UTC (permalink / raw)
  To: Peng Yu; +Cc: zsh-users

On Fri, Sep 6, 2019 at 8:38 PM Peng Yu <pengyu.ut@gmail.com> wrote:
>
> Hi,
>
> I just have a vanilla ~/.zshrc. I'd like something essential things
> like PS1 set to my pwd and hostname, etc.

If you are asking how this can be done, see
http://zsh.sourceforge.net/Intro/intro_14.html and
http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html.

Here's a prompt with magenta hostname, blue current directory and a
prompt character. The latter is red on error, green on success; # if
running with privileges, % if without.

  PROMPT='%F{magenta}%m %F{blue}%~ %F{%(?.green.red)}%# %f'

The docs linked above should allow you to easily customize this prompt
to your needs.

> I saw people use things like
> oh-my-zsh to make some fancy things like showing git branches, etc.,
> if in a git repo. But if I remember it correctly, it could cause a
> little sluggish that can be sensed.

ZSH files and/or functions that set PROMPT and other prompt-related
parameters are usually called themes. For example, here's a theme
called foobar:

  function prompt_foobar_setup() {
    PROMPT='%F{magenta}%m %F{blue}%~ %F{%(?.green.red)}%# %f'
  }

To enable theme foobar you can call prompt_foobar_setup. If you make
this function autoloadable, you'll also be able to enable it with
`prompt foobar`. There is little value in defining prompt_foobar_setup
as opposed to simply assigning PROMPT='...' in ~/.zshrc.

ZSH comes with a few builtin themes -- that is, with a few functions
similar to the above. The prompts they define are fairly simple, and
they are all fast. You can access them by typing the following
command:

  autoload promptinit
  promptinit
  prompt -h

Oh My Zsh is a collection of ZSH configuration files. These files may
define aliases, functions, key bindings, completion options, etc. Oh
My Zsh also contains lots of themes:
https://github.com/robbyrussell/oh-my-zsh/wiki/Themes. Some of them
are quite sophisticated and most are slow.

You can use a theme from Oh My Zsh without using any other
configuration scripts from it. Likewise, you can use any theme
(including one of your own making) while simultaneously using some
configuration files from Oh My Zsh.

On Sat, Sep 7, 2019 at 2:23 PM Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> For git information, see vcs_info in zshcontrib(1), and Misc/vcs_info-examples
> in the source distribution.

Note that vcs_info is likely to make your prompt noticeably sluggish.

Roman.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Is it worthwhile to use oh-my-zsh?
  2019-09-07 13:58 ` Roman Perepelitsa
@ 2019-09-07 20:18   ` Frank Terbeck
  2019-09-08  0:33     ` Bart Schaefer
  0 siblings, 1 reply; 13+ messages in thread
From: Frank Terbeck @ 2019-09-07 20:18 UTC (permalink / raw)
  To: Roman Perepelitsa; +Cc: Peng Yu, zsh-users

Roman Perepelitsa wrote:
[...]
> On Sat, Sep 7, 2019 at 2:23 PM Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
>> For git information, see vcs_info in zshcontrib(1), and Misc/vcs_info-examples
>> in the source distribution.
>
> Note that vcs_info is likely to make your prompt noticeably sluggish.

Depends on configuration. The defaults avoid most features that are
particularly expensive.

Regards, Frank

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Is it worthwhile to use oh-my-zsh?
  2019-09-07 20:18   ` Frank Terbeck
@ 2019-09-08  0:33     ` Bart Schaefer
  2019-09-08 15:41       ` Roman Perepelitsa
  0 siblings, 1 reply; 13+ messages in thread
From: Bart Schaefer @ 2019-09-08  0:33 UTC (permalink / raw)
  To: Frank Terbeck; +Cc: Roman Perepelitsa, Peng Yu, zsh-users

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.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Is it worthwhile to use oh-my-zsh?
  2019-09-08  0:33     ` Bart Schaefer
@ 2019-09-08 15:41       ` Roman Perepelitsa
  2019-09-08 19:05         ` Nick Cross
  0 siblings, 1 reply; 13+ messages in thread
From: Roman Perepelitsa @ 2019-09-08 15:41 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Frank Terbeck, Peng Yu, zsh-users

On Sun, Sep 8, 2019 at 2:33 AM Bart Schaefer <schaefer@brasslantern.com> wrote:
>
> 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":
>
> ...

I ran a few benchmarks to measure prompt latency induced by vcs_info
with conservative settings. By prompt latency I mean the time it takes
for prompt to appear after you hit ENTER. I've measured 3
configurations:

- bart: plain bart theme.
- bart + vcs_info: the config posted by Bart on this thread.
- bart + gitstatus: functionally equivalent to bart + vcs_info but
using gitstatus instead of vcs_info [1].

Prompt latency in zsh Git repo on a high-end desktop running Linux:

- bart: 0.28ms
- bart + vcs_info: 28ms
- bart + gitstatus: 0.81ms

The slowdown from vcs_info is significant but the overall prompt
latency is still reasonably low. If you pay attention, you can notice
the lag but it's not jarring. Most people start being annoyed by
prompt lag when it reaches around 50ms.

The same machine running WSL:

- bart: 2.1ms
- bart + vcs_info: 87ms
- bart + gitstatus: 4.9ms

Here the lag induced by vcs_info cannot be ignored. Local shell feels
like SSH across the continent. bart + gitstatus stays far below the
perceptible lag threshold and feels instant.

A typical laptop running Linux or macOS falls somewhere in between my
two benchmark setups, with slower macbooks being close in performance
to WSL on my desktop.

To sum up, vcs_info with conservative settings adds enough prompt
latency to make it perceptible without any instruments. Whether it
makes prompt lag annoyingly high depends on the OS and hardware.

Interactive ZSH has a reputation for being slow primarily due to slow
themes, which are in turn slow primarily due to suboptimal Git
integration. The difference in performance between fast and slow ZSH
bindings for Git is over an order of magnitude. vcs_info, while being
flexible, is one of the slowest. It's convenient to use vcs_info
thanks to its being bundled with zsh but but this convenience comes at
a great cost.

Roman.

[1] bart + gitstatus configuration can be obtained by appending the
following code to bart + vcs_info.

if [[ ! -d ~/gitstatus ]]; then
  git checkout https://github.com/romkatv/gitstatus.git ~/gitstatus
fi

source ~/gitstatus/gitstatus.plugin.zsh

# Start gitstatusd in the background and give it ID 'MY'.
# It'll terminate when the parent shell terminates.
gitstatus_start MY

vcs-info-v() {
  if gitstatus_query -p MY && [[ $VCS_STATUS_RESULT == 'ok-sync' ]]; then
    # The current directory is inside a Git repo.
    RPS1='%F{5}(%fgit%F{5})%F{3}-%F{5}['
    # Branch or tag or commit.
    local b=$VCS_STATUS_LOCAL_BRANCH
    : ${b:=$VCS_STATUS_TAG}
    : ${b:=$VCS_STATUS_COMMIT[1,8]}
    [[ -o prompt_subst ]] && b='${:-'${(qqq)b}'}'
    RPS1+="%F{2}${b//\%/%%}%f"
    # Add '<'/'>' after branch name if there are changes to pull/push.
    (( VCS_STATUS_COMMITS_BEHIND )) && RPS1+='<'
    (( VCS_STATUS_COMMITS_AHEAD )) && RPS1+='>'
    # Action, a.k.a. state. For example, 'merge'.
    [[ -n $VCS_STATUS_ACTION ]] && RPS1+="%F{3}|%F{1}$VCS_STATUS_ACTION"
    RPS1+='%F{5}]%f'
  else
    # Not a Git repo. Call vcs_info in case it's a sv[nk]|bzr repo.
    vcs_info
    RPS1=${vcs_info_msg_0_% }
  fi
}

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Is it worthwhile to use oh-my-zsh?
  2019-09-08 15:41       ` Roman Perepelitsa
@ 2019-09-08 19:05         ` Nick Cross
  2019-09-08 19:41           ` Roman Perepelitsa
  0 siblings, 1 reply; 13+ messages in thread
From: Nick Cross @ 2019-09-08 19:05 UTC (permalink / raw)
  To: Roman Perepelitsa, Bart Schaefer; +Cc: Frank Terbeck, Peng Yu, zsh-users



I've tried various VCS prompts out and my favourite so far is 
https://github.com/woefe/git-prompt.zsh which is fast and also asynchronous.

Nick



On 08/09/2019 16:41, Roman Perepelitsa wrote:
> On Sun, Sep 8, 2019 at 2:33 AM Bart Schaefer <schaefer@brasslantern.com> wrote:
>>
>> 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":
>>
>> ...
> 
> I ran a few benchmarks to measure prompt latency induced by vcs_info
> with conservative settings. By prompt latency I mean the time it takes
> for prompt to appear after you hit ENTER. I've measured 3
> configurations:
> 
> - bart: plain bart theme.
> - bart + vcs_info: the config posted by Bart on this thread.
> - bart + gitstatus: functionally equivalent to bart + vcs_info but
> using gitstatus instead of vcs_info [1].
> 
> Prompt latency in zsh Git repo on a high-end desktop running Linux:
> 
> - bart: 0.28ms
> - bart + vcs_info: 28ms
> - bart + gitstatus: 0.81ms
> 
> The slowdown from vcs_info is significant but the overall prompt
> latency is still reasonably low. If you pay attention, you can notice
> the lag but it's not jarring. Most people start being annoyed by
> prompt lag when it reaches around 50ms.
> 
> The same machine running WSL:
> 
> - bart: 2.1ms
> - bart + vcs_info: 87ms
> - bart + gitstatus: 4.9ms
> 
> Here the lag induced by vcs_info cannot be ignored. Local shell feels
> like SSH across the continent. bart + gitstatus stays far below the
> perceptible lag threshold and feels instant.
> 
> A typical laptop running Linux or macOS falls somewhere in between my
> two benchmark setups, with slower macbooks being close in performance
> to WSL on my desktop.
> 
> To sum up, vcs_info with conservative settings adds enough prompt
> latency to make it perceptible without any instruments. Whether it
> makes prompt lag annoyingly high depends on the OS and hardware.
> 
> Interactive ZSH has a reputation for being slow primarily due to slow
> themes, which are in turn slow primarily due to suboptimal Git
> integration. The difference in performance between fast and slow ZSH
> bindings for Git is over an order of magnitude. vcs_info, while being
> flexible, is one of the slowest. It's convenient to use vcs_info
> thanks to its being bundled with zsh but but this convenience comes at
> a great cost.
> 
> Roman.
> 
> [1] bart + gitstatus configuration can be obtained by appending the
> following code to bart + vcs_info.
> 
> if [[ ! -d ~/gitstatus ]]; then
>    git checkout https://github.com/romkatv/gitstatus.git ~/gitstatus
> fi
> 
> source ~/gitstatus/gitstatus.plugin.zsh
> 
> # Start gitstatusd in the background and give it ID 'MY'.
> # It'll terminate when the parent shell terminates.
> gitstatus_start MY
> 
> vcs-info-v() {
>    if gitstatus_query -p MY && [[ $VCS_STATUS_RESULT == 'ok-sync' ]]; then
>      # The current directory is inside a Git repo.
>      RPS1='%F{5}(%fgit%F{5})%F{3}-%F{5}['
>      # Branch or tag or commit.
>      local b=$VCS_STATUS_LOCAL_BRANCH
>      : ${b:=$VCS_STATUS_TAG}
>      : ${b:=$VCS_STATUS_COMMIT[1,8]}
>      [[ -o prompt_subst ]] && b='${:-'${(qqq)b}'}'
>      RPS1+="%F{2}${b//\%/%%}%f"
>      # Add '<'/'>' after branch name if there are changes to pull/push.
>      (( VCS_STATUS_COMMITS_BEHIND )) && RPS1+='<'
>      (( VCS_STATUS_COMMITS_AHEAD )) && RPS1+='>'
>      # Action, a.k.a. state. For example, 'merge'.
>      [[ -n $VCS_STATUS_ACTION ]] && RPS1+="%F{3}|%F{1}$VCS_STATUS_ACTION"
>      RPS1+='%F{5}]%f'
>    else
>      # Not a Git repo. Call vcs_info in case it's a sv[nk]|bzr repo.
>      vcs_info
>      RPS1=${vcs_info_msg_0_% }
>    fi
> }
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Is it worthwhile to use oh-my-zsh?
  2019-09-08 19:05         ` Nick Cross
@ 2019-09-08 19:41           ` Roman Perepelitsa
  0 siblings, 0 replies; 13+ messages in thread
From: Roman Perepelitsa @ 2019-09-08 19:41 UTC (permalink / raw)
  To: Nick Cross; +Cc: Bart Schaefer, Frank Terbeck, Peng Yu, zsh-users

On Sun, Sep 8, 2019 at 9:05 PM Nick Cross <nick@goots.org> wrote:
>
> I've tried various VCS prompts out and my favourite so far is
> https://github.com/woefe/git-prompt.zsh which is fast and also asynchronous.

It's pretty good. Much faster than vcs_info but still 10 times slower
than gitstatus. It's less flexible than either, though.

Roman.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, back to index

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-06 18:37 Is it worthwhile to use oh-my-zsh? 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
2019-09-08 15:41       ` Roman Perepelitsa
2019-09-08 19:05         ` Nick Cross
2019-09-08 19:41           ` Roman Perepelitsa

zsh-users

Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-users

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.users


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git