Installing and Configuring Vim
This quick recipe is to install and personalise Vim with themes from Airline. I reckon Vim is a bit hard to learn, but once you know how it works it will empower your hands, also there are tons of command combinations to do cool things.
Installing Vim
The first thing is to install Vim, for that in Debian you can use apt
; first update the packages database and then proceed to install the app, as:
|
|
!!! NOTE: in MacOS it probably is already installed, check with vi --version
, if is not, then install with brew install vim
.
Now let’s install the plugin manager VIM-plug from the repository junegunn/vim-plug in GitHub, with:
|
|
Once VIM-Plug is installed in the autoload directory, edit the ~/.vimrc
file (vi ~/.vimrc
) and add the following lines:
|
|
With that we will be asking VIM-Plug to install vim-airline
and the themes vim-airline-themes
, save the changes and exit Vim (:wq!
).
Now reopen Vim and type in :PlugInstall
and hit Enter, by now both Vim Airline and Vim Airline Themes should be installed.
If you open a file, you should be able to see the status bar with the details of the file, git and location, similar to what you have with powerlevel10k.
The theme installation need some touches and you will need to install the powerline fonts, for that do the follwoing:
|
|
Finally, edit ~/.vimrc as before and add the following line at the end:
|
|
Now your Vim should look nice and have a nice status bar, but if you prefer you can change the theme using the command :AirlineTheme <theme_name>
; if you press the Tab
key you can cycle through the available themes or visit the GitHub repository of the theme for details and screenshots https://github.com/vim-airline/vim-airline/wiki/Screenshots.
To make the theme change permanent you can add let g:airline_theme='<theme_name>'
to the ~/.vimrc
file, for example:
|
|
Install and Configure NERDTree plugin
If you need a quick way to browse files and navigate around the file system, you probably will love to have NERDTree
. Let’s install it, edit ~/.vimrc
and add the following line:
|
|
Close and open Vim and run :PlugInstall
command as before to install NERDTree
Now NERDTree plugin is installed, to see the directory tree in Vim editor, type in command :NERDTree
to launch it.
Colour Scheme (optional)
Some times I don’t want to install Airline themes, but I like to have a dark theme in my Vim, and the colour scheme onedark from joshdick/onedark.vim is the one I use, to install it is super easy, just do the following:
|
|
Then edit ~/.vimrc
and add the following lines at the end:
|
|
G