zsh-users
 help / Atom feed
From: Roman Perepelitsa <roman.perepelitsa@gmail.com>
To: Peng Yu <pengyu.ut@gmail.com>
Cc: zsh-users <zsh-users@zsh.org>
Subject: Re: Is it worthwhile to use oh-my-zsh?
Date: Sat, 7 Sep 2019 15:58:18 +0200
Message-ID: <CAN=4vMpL1Mo=sfdVzhnyc-VxK=m7Ku8WMG-M6gvKsFa-LeBT+g@mail.gmail.com> (raw)
In-Reply-To: <CABrM6wn5sfs-PBT3Bt8f4u6u7k6PEv+U0jjdDg3O=Fa66zixMA@mail.gmail.com>

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.

  parent reply index

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 [this message]
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

Reply instructions:

You may reply publically 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='CAN=4vMpL1Mo=sfdVzhnyc-VxK=m7Ku8WMG-M6gvKsFa-LeBT+g@mail.gmail.com' \
    --to=roman.perepelitsa@gmail.com \
    --cc=pengyu.ut@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

zsh-users

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

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