sudo apt install zsh
After installing it, type zsh
zsh will ask you to choose some configuration.
We will do this later on while installing oh-my-zsh, so choose option 0
to create the config file and prevent this message from showing again.
Use curl to install oh-my-zsh:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
This will clone the repo and replace the existing ~/.zshrc with a template from oh-my-zsh.
First, we need to make sure zsh is executed by default for Bash on Ubuntu. This is not mandatory, but if not done you need to type zsh every time. For this, edit the .bashrc file with nano: nano ~/.bashrc and paste this right after the first comments:
if test -t 1; then
exec zsh
fi
Save it and restart your Ubuntu shell. You should be on zsh by default now.
To view or edit your Zsh configuration you will edit the .zshrc file from now on:
nano ~/.zshrc
First, install the plugin by cloning in the zsh-nvm repo.
git clone https://github.com/lukechilds/zsh-nvm ~/.oh-my-zsh/custom/plugins/zsh-nvm
Then add it as a plugin in the ~/.zshrc file.
plugins=(git zsh-nvm)
Then reload the .zshrc file, and you’ll see nvm being installed:
source ~/.zshrc
Usage :
nvm install node
Test that Node is installed by running:
node -v
npm -v
npm install --global yarn
Test that Yarn is installed by running:
yarn -v
Obviously you can install whichever theme you prefer. You can see plenty of choices here: https://github.com/ohmyzsh/ohmyzsh/wiki/External-themes
I personally prefer Purer: https://github.com/DFurnes/purer
Install Purer using NPM:
npm install --global purer-prompt
Add the following to your .zshrc if not automagically symlinked:
fpath+=($fpath '/home/tineyi/.nvm/versions/node/v21.1.3.0/lib/node_modules/purer-prompt/functions')
To initialize the prompt system (if not so already) and choose Purer, add this to your .zshrc file:
autoload -U promptinit; promptinit
prompt purer
Clone the repository into $ZSH_CUSTOM/plugins (by default ~/.oh-my-zsh/custom/plugins)
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
Add the plugin to the list of plugins for Oh My Zsh to load (inside ~/.zshrc):
You may want to add other plugins. For example, ssh-agent plugin will start the ssh-agent automatically if it’s not running the first time that you fire up the WSL. (You'll be prompted for your SSH key passphrase every time WSL is started fresh. So basically anytime you reboot your computer.)
plugins=(git vscode zsh-nvm zsh-autosuggestions ssh-agent)
Start a new terminal session, or reload the .zshrc file again, and you should be all set.