Vim text editor: Getting started

Vim is my favorite text editor on the terminal. After playing for a little while with nano and emacs, I finally settled with vim for its simplicity (bare with me please). Although it can be customized and used like an entire IDE, I use it mostly for editing files on my servers and making small but crucial changes. Let's not get into Editor war and get started.

Vim Text editor

VIM text editor

This is not an extensive tutorial. Learning all the features vim has to offer is like trying to learn all the features Microsoft Excel has to offer. Although Excel is a powerful tool, the average user mostly use it to create a table. So this is what I will try to teach you: How to use it for your basic needs.


This will differ from system to system. This method should cover any flavor of Linux that uses aptitude (Debian Based). Open your terminal and enter this command:

sudo apt-get install vim

That's it really, you should have the latest version installed now.

Creating and editing files

Let's create a simple file:

vim simple.txt

This creates a new file but doesn't save it to disk yet. The file is now open and ready for editing.

Vim has different modes. In this tutorial we will use only two of them: The normal mode and the insert mode. When you open a file or start the program, you are in normal mode (sometimes called standard mode). You can always come back to this mode from other places by pressing the ESC key on the keyboard. In this mode you can navigate through the document and run some commands. Here are a few things to know:

Action Description

You can use the arrow keys to move around or these keys:

  • K for up
  • J for down
  • H for left
  • L for right
  • :q to quit
  • :w to save
  • :wq to save and quit
  • :q! force quit without saving
  • /text - (forward slash and some text) to search for a string
  • :0 - (colon and zero) to go to the beginning of the file
  • shift+G to go to the end of the file
  • :37 - (colon and number) to go to a line number
  • :wq to save and quit
Vim line number

:32 Jump to line 32

This is all done while in normal mode. To start writing text in the document, we go into insert mode. you can enter the mode by pressing the i key:

Vim Insert mode

Insert mode

On the bottom of the editor it will say -- INSERT --. While in this mode we can write text you want just like in a regular text editor. In order to save the document or run any command, we will have to exit insert mode and go back to the normal mode. Press the ESC key for that.

That's all there is to vim really. You can use it now to modify files and settings in your machine.

Editing a file

Editing a file with vim


There are no comments added yet.

Let's hear your thoughts

For my eyes only