Improve your terminal with suggestions from your history with zsh
If you want enable command prediction on your terminal, a good option is to install zsh.
sudo apt-get install zsh
Now, replace bash by zsh with the following instruction:
USER=`whoami`
chsh -s /bin/zsh $USER
Now, install Oh My Zsh:
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
And finally install Fish-like autosuggestions for zsh:
git clone http://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
Edit your ~/.zshrc file and add zsh-autosuggestions as a plugin:
plugins=(git zsh-autosuggestions)
If you like, you can change your terminal theme. I like cobalt2:
git clone https://github.com/powerline/fonts.git
cd fonts
./install.sh
cd ..
git clone https://github.com/wesbos/Cobalt2-iterm.git
cd Cobalt2-iterm
mv cobalt2.zsh-theme ~/.oh-my-zsh/themes
vim ~/.zshrc
ZSH_THEME="cobalt2"
Now, we can restart zshell with the following command:
zsh --
If you want compatibility with your root user, you must do the following steps:
sudo su
sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
ln -s /home/$USER/.oh-my-zsh /root/.oh-my-zsh
cd /root/.oh-my-zsh
cp /home/$USER/.oh-my-zsh/themes/cobalt2.zsh-theme .
mv /root/.zshrc /root/.zshrc.bak
ln -s /home/$USER/.zshrc /root/.zshrc
zsh --
Now re-login your session
HINT: Probably, when you try to autocomplete in your terminal you would see the following error:
_store_cache:46: permission denied: .oh-my-zsh/cache/DEBS_avail
To solve it just execute this command:
sudo chown $USER:$USER /home/$USER/.oh-my-zsh/cache/DEBS_avail
Now re-login your session
HINT: Probably, when you try to autocomplete in your terminal you would see the following error:
_store_cache:46: permission denied: .oh-my-zsh/cache/DEBS_avail
To solve it just execute this command:
sudo chown $USER:$USER /home/$USER/.oh-my-zsh/cache/DEBS_avail
Enjoy it!
Comments
Post a Comment