CLI Part 1: Base Zsh Setup
Why Zsh?
- sane, easy extensibility (plugins basically work like npm modules/package.json)
- flexible prompts (able to have multiline prompt and make use of right side of screen, OSS theme frameworks)
Also, if you’re on a Mac, Zsh is now the default on MacOS since Catalina.
Change shell to zsh (if needed)
Note: If you’re on a Mac, and MacOS >= Catalina, zsh should already be the default.
# if needed install the 'zsh' package with your package manager
$ chsh -s $(which zsh)
Make sure to exit and start a new session.
Completions
Tab completions for commands are pretty awesome, so let’s enable that capability for your shell:
# enable completions
autoload -Uz compinit && compinit -du
autoload -U bashcompinit && bashcompinit # support bash completions
Prettify
Powerlevel10k is a great shell prompt framework that provides easy, interactive configuration out of the box.
Clone the repo into your home directory:
# theme framework
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc
Load your zshrc again to install: $ source ~/.zshrc
or simply open a new terminal window.