Vim Editor

Overview

  • Time: 25 min

  1. Learn how to use Vim editor.

  2. Understand basic Vim commands for text editing.

Vim is a powerful text editor available in most Linux distributions. Here are some basic commands to get started:

Basic Vim Commands

Command

Description

i

Enter insert mode to start editing.

Esc

Exit insert mode.

:w

Save the file.

:q

Quit Vim.

:wq

Save and quit Vim.

:q!

Quit without saving changes.

dd

Delete the current line.

yy

Copy the current line.

p

Paste the copied or deleted content (in normal mode), or paste copied/cut text (in visual mode).

u

Undo the last action.

:set number

Enable line numbers.

:set nonumber

Disable line numbers.

v

Enter visual mode to select text.

y

Copy the selected text in visual mode.

d

Cut the selected text in visual mode.

Key Points

  1. Vim is a powerful text editor available in most Linux distributions.

  2. It has a steep learning curve but is very efficient once mastered.