The power of vim or vi editor


If you are a developer this article going to be very useful for you. So basically vim or vi is a very powerful and popular text editor. Vim is a clone of vi editor and written by Bram Moolenaar. It supports all major platform like a window, Linux, mac.

Vim is designed for use both from a command-line interface and as a standalone application in a graphical user interface. Vim is an improved version of vi editors.

Vim or vi have basically two modes one is for command and another is text mode nowadays we have a visual mode. So here will work on the command line interface.

In this article, we are going to talk about vim as well as vi editors. Here we are using command-centric approach so in the initial phase, you can be in trouble because you need to memorise these commands but when you are perfect in this then you can faster.


  1. Vim or vi (linux based system have vi editor but for vim we need to download vim editor).
  2. Vim cheat sheet

Notes – Inside window we need set environment variable to access vim using command-line.

Get Started

To start we need to open command-line. If we want to create new file then we will use –

vim # is file name  

Now vim or vi editor will open like this image –
and if you want to open a file then the same command will work.

Vim or vi modes

Vim or vi modes are the main power of vim. So we have several modes those modes enhance the power of vim. These are –

1. Insert Mode

Using this mode we can insert text inside our file. The shortcut is i (insert text where the cursor is), o (insert text beginning of line), a ( insert text end of line) key for insert mode.

2. Visual Mode

Using this we can use mouse inside command-line. Like we want to select a lot of line at once so this is very useful that time. The shortcut is v key for visual mode.

3. Command Mode

Using this we can use commands inside our file. But we need to be careful if we are using this because at the starting of command we need to use : symbol. The shortcut is esc key for visual mode.

Basic follow of vim or vi editor

To use vim or vi editor we have to follow these steps –

  1. Open or create file using vim filename command.
  2. Go to insert mode using i key and write code, text whatever you want.
  3. Now come again into command mode using ese key
  4. Save file using :w inside command mode.
  5. Exit from editor using :q inside command mode.

Basic vim or vi command

Operation Command
save :w
save and exit :wq
exit :q
force ! (ex :w! :q!)
copy y
copy a line yy
paste p
cut d
cut a line dd
vertical split open the specified document and split the screen so you can see multiple documents.

You can follow this link to complete vim cheat sheet. Read more about linux.

You May Also Like

About the Author: Pankaj Bisht