Vim - Installation And Configuration



Vim is lightweight package and its installation is really simple. In this chapter, we will discuss following items −

  • Installation on Windows platform
  • Installation on Debian based Linux
  • Installation on RPM based Linux

Installation on Windows platform

Vim doesn’t have any specific requirements. It is simple software bundle which provides all dependencies.

Installation

  • To download Vim visit vim.org

  • Click on Download option from left pane

  • Click on PC - MS-DOS and MS-Windows option

  • Download .exe installer from this page. At the time of writing this tutorial installer name was gvim80.exe

  • Double click on installer and follow on screen instructions to complete installation

Configuration

Vim stores its configuration in simple text file namely _vimrc and it is located under home directory of user.

  • To find current user’s home directory execute below command in terminal −

$ echo %userprofile%
  • Navigate to home directory and create a new file namely _vimrc. Ensure that this file doesn’t have any extension.

  • Open this file in text editor, enter following text and save it −

set nu
  • Now Vim will show line numbers when file is opened. We’ll add more options to this file latter on.

Installation on Debian based Linux

Installation on Linux platform is quite simple as compared to Windows. This section describes installation and configuration on Debian based Linux.

Installation

  • Execute below command in terminal −

$ sudo apt-get update 
$ sudo apt-get install vim
  • To ensure Vim is correctly installed execute below command −

$ which vim
  • It should print the location of Vim binary. In my case it was −

/usr/bin/vim

Configuration

Vim stores its configuration in simple text file namely .vimrc and it is located under home directory of user.

  • To find current user’s home directory execute below command in terminal −

$ echo $HOME
  • Navigate to home directory and create a new file namely .vimrc. Ensure that this file doesn’t have any extension.

  • Open this file in text editor, enter following text and save it −

set nu
  • Now Vim will show line numbers when file is opened. We’ll add more options to this file latter on.

Installation on RPM based Linux

This section describes installation and configuration on RPM based Linux.

Installation

  • Execute below command in terminal −

$ su - 
$ yum install vim
  • To ensure Vim is correctly installed execute below command −

$ which vim
  • It should print the location of Vim binary. In my case it was −

/usr/bin/vim

Configuration

Vim stores its configuration in simple text file namely .vimrc and it is located under home directory of user.

  • To find current user’s home directory execute below command in terminal −

$ echo $HOME
  • Navigate to home directory and create a new file namely .vimrc. Ensure that this file doesn’t have any extension.

  • Open this file in text editor, enter following text and save it −

set nu
  • Now Vim will show line numbers when file is opened. We’ll add more options to this file latter on.

Advertisements