loading...

re: What’s your default terminal shell? And what do you love the most about it? VIEW POST

FULL DISCUSSION
 

My default shell is Zsh. I did an interesting experiment a few days ago, i uninstalled oh-my-zsh to see if the features i use where a coming from Zsh or they were provided by oh-my-zsh and it turns out that most of them where just a configuration thing built-in in Zsh that had to be "activated."

My favorite thing of Zsh is the completion based on the commands history.

If you start typing a command like git p and press the Up arrow key Zsh will autocomplete the command with the last command you typed that begins with git p. In other words you press git p + Up and you might get git push some-branch.

This is not a default behavior, if you use oh-my-zsh it is activated. This is what they do.

# load functions
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search

# bind them to a key

# start typing + [Up-Arrow] - fuzzy find history forward
bindkey "${terminfo[kcuu1]}" up-line-or-beginning-search

# start typing + [Down-Arrow] - fuzzy find history backward
bindkey "${terminfo[kcud1]}" down-line-or-beginning-search

# before binding they make sure terminfo isn't empty

Another one that i like is something called magic-space, this will "expand" special shell symbols like !! (which means the last command). You press !! + space and it gets autocompleted to your last command, this is useful when you forgot to use sudo before a command.

This isn't activated by default, oh-my-zsh enables it for you.

# [Space] - do history expansion
bindkey ' ' magic-space

I also found out that Zsh has a vi-mode. When enabled it kinda "breaks" some of the default behaviors but it's still cool.

Anyway i extracted all the code that i use from oh-my-zsh and put them in here if anyone is curious.

 

That’s really interesting! I’ve always found it a tad confusing to understand what Oh My Zsh actually contributed to the shell experience, and from your experiment, it seems like among other things, it introduces a bunch of opinionated config for Zsh? That’s useful to know 👍

 

Did you notice a speed up after removing oh-my-zsh in favor of the cherry picked configuration in the gist?

 

I did, it was a while ago but I remember that it felt quite snappy. I do have to say that startup time was never an issue for me when I used oh-my-zsh, the only times it got slow on startup was when checking for updates.

code of conduct - report abuse