I have been a typical bash
user for almost 30 years. Recently I became curious about zsh
and decided to give a try on my Manjaro Linux. The most Linux distributions have zsh
installed by default. Here, I’ll directly introduce how to get the fancy plugins setup, with ohmyzsh
> https://github.com/ohmyzsh/ohmyzsh
Install through command line
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
After the install, your default SHELL should switch to zsh
. You can verify it
echo $0 ps -p $$ lsof -p $$
Edit `~/.zshrc`
You can edit theme
> https://github.com/ohmyzsh/ohmyzsh/wiki/Themes or configure plugins
, like mine
plugins=(
git
history-substring-search
colored-man-pages
zsh-autosuggestions
zsh-syntax-highlighting
)
After saving the edit, you’d install the plugins
on operating system. Here’s the command on Manjaro, for example
sudo pacman -S zsh-autosuggestions zsh-syntax-highlighting
Source your `~/.zshrc`
source ~/.zshrc
Check `bindkey`
bindkey | fgrep history
"^[OA" history-substring-search-up
"^[OB" history-substring-search-down
"^[[5~" up-line-or-history
"^[[6~" down-line-or-history
"^[[A" up-line-or-history
"^[[B" down-line-or-history
If you have `conda` installed, you’d run `init`
cd ~/miniconda3/bin
./conda init zsh
It will update ~/.zshrc
If you want to search in `vi` mode
I’m a proud and traditional vim
user and wish to search in vi
mode in command line. You can add the following into ~/.zshrc
bindkey -M vicmd '/' history-incremental-search-backward
If you want to go back to default setting of `zsh`
Execute the following command
/etc/skel/.zshrc