Vim - A Powerful and Customizable Text Editor

Vim is a free and open-source text editor program. Vim is highly customizable and one of the more popular editors among power users in various industry sectors. It‘s core mechanic is based around improving productivity when writing code.

Become a Vim Pro with these expert guides

Vim's Beginner Quick Start Guide

NOTE: These are just a few commands to get you started. Visit our Vim Commands Cheat Sheet to view a complete guide of Vim Commands. You‘ll become a Vim expert in no time!

Movement

The first thing to learn in Vim is how to move around a file. When you're in command mode, use the following keys to move around the file:

h - moves the cursor one character to the left.

j - moves the cursor down one line.

k - moves the cursor up one line.

l - moves the cursor one character to the right.

0 - moves the cursor to the beginning of the line..

$ - moves the cursor to the end of the line..

w - move forward one word..

b - move backward one word..

G - move to the end of the file..

gg - move to the beginning of the file..

Editing

From replacing, yanking (Vim word for 'copying') and pasting, there are many ways you can edit your code:

i - enter Insert mode before the cursor.

I - enter Insert mode at the beggining of line.

o - append a new line below the current line in insert mode.

s - substitute character under cursor.

S - substitute line.

v - start visual mode at cursor.

V - start visual mode and select entire line.

d - delete selection in Visual mode.

dd - delete current line.

p - paste after cursor.

y - yank (copy) selected text.

Workflows

Speed up your coding by using Vim's split window functionality, built in search and other useful macros:

u - undo.

. - repeat previous command.

:q - quit Vim.

:w - write (save) file.

:wq - write (save) and quit Vim.

:vimtutor - use it to learn your first Vim commands.

/pattern - search for pattern.

:syntax on - turn on syntax highlighting.

:split - horizontally split window.

:vsplit - vertically split window.

:close - close current window.