Make Linux terminal great again (Terminator + Oh My ZSH + autosuggestions + highlighting + Agnoster theme + powerline fonts + solarized colors)
The terminal is part of every software developer’s life. The terminal carries out routine tasks. Most Linux programs have only console interface. If you have a good terminal you can forget about a boring graphical interface. :)
However, the default terminal is like an old typewriter. It doesn’t have autosuggestions, autocorrect, highlighting. Let’s fix it.
Install Terminator
Well, to start with we are going to update your terminal emulator. We will use Terminator instead of gnome-terminal. Terminator has appearance settings, hotkeys, text search, arrange terminals in a grid.
sudo apt-get install terminator
Install Zsh
Next, we will update our Unix shell. We will use zsh instead of bash. Zsh has autocorrection, history search, plugins, improved bash language.
sudo apt-get install zsh
Zsh should be set as your default shell:
chsh -s $(which zsh)
Restart your terminal. You should see the configuration menu of zsh and choose option 2:
Populate your ~/.zshrc with the configuration recommended by the system administrator and exit
Don’t forget to move your configuration and aliases from .bashrc to .zshrc:
Install Oh My Zsh
Oh my zsh is a framework for managing your zsh. It adds a lot of helper functions, plugins, themes.
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
Install Powerline fonts
We need these fonts to show Unicode chars in the terminal.
sudo apt-get install fonts-powerline
Change theme to Agnoster
You need to change ZSH_THEME="robbyrussell"
to ZSH_THEME="agnoster"
in your .zshrc
Restart your terminal.
Install Solarized color
Next, we will install the color palette for the terminal.
git clone git://github.com/sigurdga/gnome-terminal-colors-solarized.git ~/.solarized
cd ~/.solarized
./install.sh
Choose option 1 (dark theme). Then choose option 1 to download dircolors-solarized. After installation, open .zshrc and add the line:
eval `dircolors ~/.dir_colors/dircolors`
Then we need to activate just installed color palette: In your terminator right click on the terminal
Preferences>Profiles>Colors>Foreground and Background>Built-in schemes
: Solarized dark
Preferences>Profiles>Colors>Palette>Built-in schemes
: Solarized
Restart Terminator. You should see something like this:
Oh My Zsh plugins
Autosuggestions
Autosuggestions work using your zsh history. This greatly increases your typing speed. https://github.com/zsh-users/zsh-autosuggestions
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):
plugins=(zsh-autosuggestions)
Press the right arrow to use the suggestion.
Remove hostname
The username takes some space of your terminal. We’ll remove this. Add this line to your ~/.zshrc
prompt_context() {}
Now it looks more compact.
Syntax highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
echo "source ${(q-)PWD}/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
Vim
This plugin for vim fans.
Add vi-mode
to your plugins array. Press esc to switch to normal mode.
My .zshrc
You can find the latest version of my .zshrc in my repository: https://github.com/maxim-danilov/oh-my-zsh-config-maxim-danilov
Conclusion
We built a beautiful terminal with autosuggestions, autocorrect, highlighting, hotkeys and vim as an input method. The terminal has a potential for further development.