Table of contents
A table of contents of this series can be found here.
Yesterday I wrote a Post called A brief introduction to vim 7/9, explaining advanced configurations, key mappings and mapleader in vim.
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 intalled 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 7/9.
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!
Here is the ninth part of this series: A brief introduction to vim 9/9