zsh as default code example

Example 1: zsh default editor

# Examples are for vim, but you can change the path 
# to whatever you want
# e.g: /usr/bin/code for visual studio code

# In bash:
echo "export EDITOR=/usr/bin/vim" >> ~/.bashrc
echo "export VISUAL=/usr/bin/vim" >> ~/.bashrc

# In zsh:
echo "export EDITOR=/usr/bin/vim" >> ~/.zshrc
echo "export VISUAL=/usr/bin/vim" >> ~/.zshrc

# In ksh:
echo "export EDITOR=/usr/bin/vim" >> ~/.kshrc
echo "export VISUAL=/usr/bin/vim" >> ~/.kshrc

Example 2: set zsh as default shell

# Open vim or your favorite code editor
sudo vim ~/.bashrc

# Now we need to edit the file and add the following line to the end of the file remember to add a comment just to remember, what is that line of code task.
exec zsh

# It will execute the command every time you load the terminal and run your zsh shell.