Customising vim From Scratch Without Plug-Ins
Prerequisite: Vi/Vim text editor
Vim is a modal(mode based), hyper-efficient text editor. Customization of vim can happen at two levels:
- System-level: Vim will be customized for every user. To customize vim at system-level changes are made in /etc/vim/vimrc file.
- 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:
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:
A hidden folder is created in the home directory with the name .vim.
The present working directory becomes .vim.
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:
Apart from the sublime color scheme. One can download a variety of color schemes from Vim Colors.