Open In App

Customising vim From Scratch Without Plug-Ins

Improve
Improve
Like Article
Like
Save
Share
Report

Prerequisite: Vi/Vim text editor 

Vim is a modal(mode based), hyper-efficient text editor. Customization of vim can happen at two levels: 

  1. System-level: Vim will be customized for every user. To customize vim at system-level changes are made in /etc/vim/vimrc file.
  2. User level: Vim will be customized for a unique user. To customize vim at user level changes are made in the .vimrc file.

We will be customizing vim at the user level in this article. Follow the steps below: 

Step 1: Open terminal and type following command:

touch .vimrc

Creates a .vimrc file in the home folder. Vim looks for its configurations in .vimrc file. 

Step 2: Now type following commands on the terminal:

echo "syntax on" >> .vimrc

Enable syntax highlighting in vim. 

echo "set autoindent" >> .vimrc
echo "set smartindent" >> .vimrc

Enables auto indentation in vim. 

echo "set number" >> .vimrc

This command displays the line number of code at the left margin in vim. 

echo "set mouse=a" >> .vimrc

Enables usage of the mouse in all the modes of vim. 

Step 3: Customize the monotonous and dull color scheme of vim. We have to deal with .vim/colors folder. 

Grab the terminal and fire commands given below: 

mkdir .vim

A hidden folder is created in the home directory with the name .vim. 

cd .vim

The present working directory becomes .vim. 

mkdir colors

A folder of name colors in created, in hidden folder .vim. 

Step 4: Now, to apply the sublime color scheme to vim. Download the sublime-color scheme. Move the downloaded sublimemonokai.vim file from downloads to .vim/colors folder. 

Step 5: Open new terminal session and type command: 

echo "colorscheme sublimemonokai" >> .vimrc

Sets the color scheme of vim like the color scheme of the sublime. After this, the vim editor should be looking like this:

Sublime color scheme

Apart from the sublime color scheme. One can download a variety of color schemes from Vim Colors.


Last Updated : 17 Jul, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads