Vim Practical Reference

Introduction

Vim is a highly configurable text editor built to enable efficient text editing. It is an improved version of the vi editor distributed with most UNIX systems.

Creating or Editing a File

To open or create a new file with Vim, type:

vim filename.txt

To quit Vim, type :q.

A Basic Example

  • Open a file in Vim, vim my-file.txt
  • Once opened, you're in "Normal" mode. You can navigate using arrow keys or h, j, k, l.
  • To edit text you need to enter "Insert" mode by pressing i.
  • After editing, press Esc to return to "Normal" mode.
  • Type :w to save the file.
  • Type :q to exit Vim.