A brief introduction to Vim (Part 8)
Vim offers you the possibility to use color schemes. There are some default color schemes, Vim ships with. You can get a list of the available ones by typing
:colorscheme, then a
SPACE character and then press
Now if you for e.g. want to use the color scheme called
evening, simply type
:colorscheme evening followed by
You can also specify your desired color scheme in your config file at
~/.vimrc by adding the command into the file:
Custom color schemes
You can download find custom Vim color schemes at https://vimcolors.com/. When you find a scheme you like, follow the github link and download the
This file has to be saved in the directory
~/.vim/colors. If that directory does not yet exist, simply create it with
mkdir -p ~/.vim/colors. Then move the
.vim file in that directory (e.g.
mv ~/Downloads/night-owl.vim ~/.vim/colors/).
If you now check the available color schemes the newly installed should be available and can be used instantly (Vim does not have to be restarted).
It is possible to expand Vim’s functionality by adding plugins. I will scratch the surface here but there are good resources like vimawesome for diving deeper into that topic.
There are several plugin managers which simplify the process of installing and managing plugins. The most notable ones are probably:
I want to dive a little deeper into the vim-pathogen plugin manager.
You can install it with the following command:
mkdir -p ~/.vim/autoload ~/.vim/bundle && \ curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
Then add the following line into your
Now all plugins which exist in the folder
~/.vimrc/bundle/ will be loaded into Vim.
Fuzzy finder (ctrlp.vim)
A fuzzy finder is a piece of software, which enables you to quickly find a file. One of the most famous fuzzy finder plugins for Vim is called ctrlp.vim.
ctrlp.vim can be installed as described in their documentation.
First of all, we change the directory to
~/.vim/ by entering
Now we clone the git repository to
~/.vim/bundle/ with the following command:
git clone https://github.com/kien/ctrlp.vim.git bundle/ctrlp.vim
Because we installed pathogen in the previous step, we don’t have to set the runtimepath as described in the intallation steps.
Then execute the following command inside Vim:
Finally start Vim in a directory of your choice and press
CTRL+p (hence the name of the plugin ;)).
ctrlp.vim will index the files of the directory. So if your directory has a lot of files in it, this process might take a moment.
After the indexing process is done, you will be prompted to type in something and ctrlp.vim will suggest files matching that input. You can select a file in the list with the arrow keys and finally pressing enter).
Tree explorer (NERDTree)
A tree explorer enables you to view the folder structure of the directory as a tree as shown in the github README of the NERDTree plugin:
To install NERDTree, simply execute the following command:
git clone https://github.com/scrooloose/nerdtree.git ~/.vim/bundle/nerdtree
Then start Vim and execute the following command:
After installing NERDTree you can execute the command
:NERDTreeToggle in Vim.
This command both opens and closes the tree view to on the left side of Vim which you can navigate using either the arrow keys or the usual Vim navigations like
k but also
G for e.g..
To open a file or directory, press
Now because always typing
:NERDTreeToggle to open up the tree view, you can create a key map as described in my last post called A brief introduction to Vim (Part 7).
map <C-n> :NERDTreeToggle<CR> will toggle the tree view when pressing
Ask me questions
I will be happy to answer your questions in the comments section below. Also let me know if you have any tips or ideas for me to improve my post!