Vim: A Beginner's Guide

Selecting a good text editor is a very crucial decision for a programmer as it plays an important role in the overall development process.
There are numerous open source text editors but today, I am going to discuss a vim text editor.
It is a fully customized editor.
It comes from “VI iMproved” which is a non-graphical text editor that is widely distributed in Unix systems.

It is an extremely powerful text editor that lets you do almost everything using keyboard shortcuts. Vim takes time to get started with, but the more you use it, the better and more productive you will be.
It is like an investment.

How to Install Vim

Let us know that how this new editor can be installed. Well, it is pretty easy and simple. You just execute some commands depending on your operating system. Have a look:

For Ubuntu

apt-get update && apt-get install vim

For CentOS

yum install vim

For Arch Linux

pacman -S vim

Modes of Vim

In a nutshell, Vim has four basic modes of operation.

  • Normal Mode: In this mode, you can use all the command keys to navigate around the file and start editing. When you start Vim, it is in normal mode.
  • Insert Mode: Insert mode is used to type in vim. You can use a, A, i, I, o, and O commands to enter in insert mode. When you want to exit from this mode press Esc key.
  • Visual Mode: You can enter in visual mode by pressing v, V, and Ctrl-v commands from normal mode.
  • Command Mode: It is a default mode in which one can pass commands to vim in order to manipulate the document. When you open a vim file, you found yourself in command mode.

The Basics of Moving in Vim

Here I am going to tell you that how to move from one place to another in a vim file. You have to remember the following keys and what they do; When you're in command mode:

  • b move backward one word.
  • G move to the end of the file.
  • gg move to the beginning of the file.
  • h moves the cursor one character to the left.
  • l moves the cursor one character to the right.
  • j moves the cursor down one line.
  • k moves the cursor up one line.
  • 0 moves the cursor to the beginning of the line.
  • $ moves the cursor to the end of the line.
  • w move forward one word.
  • `. Move to the last edit.

So guys here are some basic information about Vim for beginners. It is not a complete tutorial but it has basic fundamentals that are necessary to know for every new user. Hope you like it!



Boostlog is an online community for developers
who want to share ideas and grow each other.

Delete an article

Deleted articles are gone forever. Are you sure?