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

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

On Fri, Sep 6, 2019 at 8:38 PM Peng Yu <pengyu.ut@xxxxxxxxx> 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

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

  autoload 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@xxxxxxxxxxxxxxxxxx> 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.


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