Oh My Zsh

by praashon 1/23/2024, 6:47 AMwith 147 comments

by pprotason 1/23/2024, 11:27 AM

Do yourself a favor and try to configure your shell without ohmyzsh first. You’d be surprised at how few plugins actually require it, and you save yourself from horrible performance.

by vorticalboxon 1/23/2024, 9:19 AM

I used ohmyzsh with powerlevel10k/powerlevel10k[0] for years though recently i've settled on fish [1]

[0] https://github.com/romkatv/powerlevel10k [1] https://fishshell.com/

by cbarrickon 1/23/2024, 2:03 PM

I never understood how omz was useful.

Zsh already has a module system (autoload), a prompt framework (promptinit), and Git integration (vcs_info) builtin.

I have a pretty extensive Zsh setup in vanilla Zsh: https://github.com/cbarrick/dotfiles

by yla92on 1/23/2024, 9:52 AM

Recently, I moved off from oh-my-zsh after many users, to vanilla zsh with https://starship.rs, mainly due to the loading speed (used https://github.com/romkatv/zsh-bench to measure the speed).

Still wanting to try out fish and hopefully soon!

by radimmon 1/23/2024, 10:12 AM

All good until your ZSH gets heavyweight and slow. Started using fish and never looked back

by Jackevansevoon 1/23/2024, 10:28 AM

The defaults it ships out of the box makes the shell actually usable. Unsure I could ever go back to a regular bash/zsh prompt.

A lot of people will tell you this is slow and you've got to use X,Y,Z instead. If you're new, I'd strongly recommend just sticking with this, it's much easier to configure.

by enwon 1/23/2024, 11:56 AM

The following goes a long way:

    setopt PROMPT_SUBST
    HISTFILE=~/.zsh_history
    HISTSIZE=100000
    SAVEHIST=100000
    PROMPT='%B%(?..%F{red}%?%f )%F{blue}%~ %F{green}%#%f%b '
    RPROMPT='%B%F{red}$(git branch --show-current 2> /dev/null)%f%b'
And if you want autosuggestions:

    brew install zsh-autosuggestions
Then add the following to your ~/.zshrc:

    source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh

by msephtonon 1/23/2024, 9:24 AM

PSA: simply installing this won't get you many benefits until you read about what it can do and then make an effort to use those things in your workflow.

by Zizizizzon 1/23/2024, 10:03 AM

Zsh autosuggestions Zsh syntax highlighting Fzf-tab

Paired with zoxide and fzf for the zsh keyboard shortcuts are all I need to be very productive.

Starship.rs is very useful as well as a theme but pure and pl10k are also great.

by eigenvalueon 1/23/2024, 1:57 PM

I use and like omyzsh, but find it super annoying how it deals with updating. It either nags you constantly to update, or if you set it to "auto," then it's constantly spamming you about how it's updating, and when you create a new shell session (say, in tmux), it causes significant lag before you can use the new shell and pollutes the console with tons of output. There has to be a better way, like some optional mode that just runs an update service in 3am silently using systemd.

by wirrbelon 1/23/2024, 11:02 AM

Grml zsh is all I need https://grml.org/zsh/

by sshineon 1/23/2024, 2:42 PM

For comparison, here is my Zsh configuration in NixOS:

  {
    programs.starship = {
      enable = true;
    };

    programs.zsh = {
      enable = true;
      enableCompletion = true;
      enableBashCompletion = true;
      enableGlobalCompInit = true;
      syntaxHighlighting.enable = true;
      syntaxHighlighting.highlighters = [ "main" "brackets" ];

      histSize = 100000;

      # See `man zshoptions` for more details.
      setOptions = [
        # Remove duplicates continuously from command history (preserve newest entry).
        "HIST_IGNORE_DUPS"

        # Instantly share command history between all active shells.
        "SHARE_HISTORY" # Alternative to: "APPEND_HISTORY", "INC_APPEND_HISTORY",

        # Disable ^S and ^Z for less accidental freezing.
        "FLOW_CONTROL"

        # Save timestamp and duration of each command in command history.
        "EXTENDED_HISTORY"
      ];

      shellAliases = {
        rm = "rm -iv";
        ls = "ls -F --color=auto";
        gs = "git status";
        gd = "git diff";
        gdc = "git diff --cached";
        gap = "git add -p";
        gl = "git log";
        gpr = "git pull --rebase";
      };

      interactiveShellInit = ''
        bindkey '^[[7~' beginning-of-line
        bindkey '^[[8~' end-of-line

        bindkey '^R' history-incremental-search-backward

        eval "$(starship init zsh)"
      '';
      };
  }
My .zshrc used to be bigger, but I've slimmed it down to see what I actually use from it.

by poochkoishi728on 1/23/2024, 11:49 AM

One time, I was cowboy coding and ended up writing `grhh` (`git reset --hard`) and hit enter before I realized that it was a mistake.

by KolenChon 1/24/2024, 3:24 AM

Zprezto is a good alternative which is also faster. I eventually migrated to zim because of its minimalist approach.

I think starting from Oh My Zsh or zprezto can be a good choice. Once you get a feel of what zsh can accomplish, eventually probably you’ll one day find it too slow and/or too complicated and then would switch to something like zim to only load the things you know is useful from then.

by highmastdonon 1/25/2024, 7:02 PM

Do yourself a favour and install fish-shell with starship.rs and call it a day. Make sure to put everything prompt related in a `if status --is-interactive` block. Blazing fast versatile fancy prompt and interactive human friendly shell. What does a man need more?

by joejagon 1/23/2024, 1:51 PM

I followed this advice and my shell went from 1530ms to 35ms startup time.

Main culprits were language switchers (nvm, jabba, pyenv). Which I moved to lazy loading.

If I drop the ohmyzsh plugins startup time is 11ms. But, I want some quality of life.

There's a nice benchmarking command in the article if you want to test yours:

for i in $(seq 1 10); do /usr/bin/time $SHELL -i -c exit; done

by dogmayoron 1/23/2024, 8:15 PM

I prefer sheldon[1] for the few plugins I use

[1] https://github.com/rossmacarthur/sheldon

by MissTakeon 1/23/2024, 11:16 AM

I use omz primarily with the Kubernetes addons - which are now integral to my existence.

Does fish support something similar? If so then I could be encouraged to give it a whirl.

by h4ch1on 1/23/2024, 10:36 AM

zsh autosuggestions has been pretty slow for me compared to fish out of the box, switched a year or so back and have been pretty happy. maybe something has changed now :thinking-emoji:

oh-my-fish is pretty much similar in capabilities and has a good assortment of themes.

All I used that came with zsh were git shortcuts like gc -m "comment", gst for git status which i just recreated in my fish config.

by firexcyon 1/24/2024, 12:42 PM

These days I stick to a minimal profile for the default shell (zsh on macOS and bash on Linux), adding no further than some aliases. When I need more “friendly” interactive features I launch fish which is… friendly and interactive, and exit when I’m done. Thus I get the best of both worlds.

by Charlie_32on 1/23/2024, 9:54 AM

I'm a developer of 10 years, and use the command line for Git, Brew and a few other things, though I'm normally an IDE developer. I believe the CL is as powerful as everyone says, but what are some useful things I can use it for? I use Zsh on a Mac some of the time.

by imdsmon 1/23/2024, 9:29 AM

Been using it for years now, can't fault it, but I don't do too much with it

by peaucon 1/23/2024, 10:33 AM

I would actually recommend using fish with budspencer theme which is really great https://github.com/oh-my-fish/theme-budspencer

by flaxtonon 1/23/2024, 12:20 PM

Loading time is not an issue for me. I run tmux so my sessions stay alive and performance is very quick. M2 MacBook Air with 16GB RAM, using Warp terminal. Using OMZ with Dracula Theme and mosh for remote servers.

by andirkon 1/23/2024, 12:53 PM

Am I the only one with almost nothing custom in my bash/zsh?

by ivanhoeon 1/23/2024, 11:46 AM

OMZ and zsh are great in many ways, but I still miss my CTRL + W from the bash, deleting the whole word regardless of the chars...

by alxndr13on 1/23/2024, 11:24 AM

funny coincidence, just finished re-modding my zsh.

Removing omz, adding antidote and starship. feels (and measureably is) faster and snappier.

by dsegoon 1/23/2024, 11:56 AM

One neat alternative is ohmyposh.dev

by nunezon 1/23/2024, 12:01 PM

Note that most of ohmyzsh can be done in pure Bash

by mbrumlowon 1/23/2024, 5:10 PM

Just use fish.