In this tutorial, you will learn to beautify your vim and bash tools with the help of Nightfly and oh-my-bash.
Beautifying Bash via oh-my-bash
Being a handy fork of the renowned oh-my-zsh, Oh-my-bash is an open-source framework for Bash users that is teeming with colorful themes, smart templates, useful plugins, functions, aliases, and so much more that adds to the beauty of the bash. We will be discussing how we can install and use this framework as per our likings.
Getting Started
Use curl or wget to begin the installation process.
Ctrl+Alt+T to start the terminal and type any of the following commands.
For curl users:
For wget users:
The execution of the above commands yields a colorful message that confirms the successful installation of oh-my-bash.
Oh-my-bash Themes and Plugins
This screen output gives you a chance to play with the framework and explore all the themes, plugins, and other functionalities it supports. Since we aim to learn how to beautify the bash, let’s get started with the lovely themes it offers.
To change the themes, choose any available themes in the themes folder. Select any name and open the ~/.bashrc file in your favorite editor. We have been using vim as follows:
Here, in this file, look for the following line of code:
Replace this “font” with the name of the theme you want to choose. For instance, to apply agnoster, it should look like:
This allows users to test and try various themes and choose one that goes with their mood. If you want to keep it cool and charming or if you’re too tired to select one, you can go with “random”. This will keep on changing the themes every once in a while, and your bash will never be the same old boring one.
Source the ~/.bashrc file to apply recent changes:
Oh-my-bash is not about themes only. You can also try various useful plugins. Using these plugins is as easy as applying any of its themes. You just have to mention the plugins you want to use in the ~/.bashrc file and you’re good to go!
For instance, we add git, aws, and brew to the plugins list in the file as follows:
This way you have a highly attractive bash ready for you.
Uninstalling oh-my-bash
In order to uninstall this framework and get back to the default shell, you just have to execute the following command:
The framework will be removed from your pc and previous bash configurations will be reverted. Now, let’s get to the beautification of Vim editor.
Beautifying Vim via Nightfly
Nightfly is one of the most attractive color schemes offered for Vim editors. In order to get that theme on your system, you need to have your favorite plugin manager installed.
The installation of a plugin manager enables users to include plugins that add a lot of functionality and aesthetics to the system. There are a good number of managers available like Dein, Vundle, Vim-plug or Pathogen, etc.
However, in this tutorial, we will be using Vim-plug, as it is one of the easiest and most reliable plugin managers for vim editor. In order to have that fancy vim look, we install the vim-plug manager as follows.
Install vim-plug using the following command:
Once installed, it’s all set to use in order to add the plugins and color schemes you want. The aim is to beautify the vim editor to make it look more captivating. Hence, now, we will see how to apply Nightfly with the help of vim-plug, which is one of the most popular dark-themed color schemes for vim.
Follow the steps mentioned below to download the Nightfly scheme in the .vim directory.
Begin with creating the directory named plugged in the .vim folder as follows:
ubuntu@ubuntu:~$ mkdir plugged
Now cd into the directory and git clone the color scheme via git as follows:
vim-nightfly-guicolors.git
Now that we are all done with the installation of Nightfly, we just have to apply it.
First of all, open the ~/.vimrc file, but if you don’t have it yet, create one by adding a vim-plug section inside it.
Start your section by adding the following function:
Add the desired plugin or scheme using the plug command:
set termguicolors
Then close the function with:
Now run this file in vim using:
Lastly, at the end of the plug declaration, add the name of the color scheme you are going to apply.
For Nightfly, write:
Plug 'bluz71/vim-nightfly-guicolors'
This is how the ordinary python code changes colors:
And the following screenshot will show a C++ code.
Run this file. Then, restart your vim, and in front of you is a vim window with dark mode and colorful code on it. You can experiment with some other themes with the help of these few easy steps. Similarly, you can explore other plugins as well.
Conclusion:
Bash and vim are a vital part of developers’ toolkits in Linux. That raises the urge to beautify these everyday tools and make them look pleasant and impressive. Those who don’t know might think they need some set of expertise to build an impressive terminal. However, a pretty shell and editor are just a few commands away. All you have to do is download the oh-my-bash framework and Nightfly scheme and configure them as per your likings. Then let them do the wonders!