📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials Linux Command Line Text Editors — vim

Text Editors — vim

5 min read Quiz at the end
vim has Normal and Insert modes. Press i to insert text and Esc to return to Normal. :w saves, :q quits, :wq saves and quits. /pattern searches, dd deletes a line, yy copies it, and p pastes it.

vim Basics

vim file.txt

# Modes
# Normal mode  — default (press Esc)
# Insert mode  — press i to type
# Command mode — press : to run commands

# Essential commands
i       # enter insert mode
Esc     # back to normal
:w      # save
:q      # quit
:wq     # save and quit
:q!     # force quit (discard changes)
/word   # search
n       # next match
dd      # delete line
yy      # copy line
p       # paste
Topic Quiz · 5 questions

Test your understanding before moving on

1. How do you enter insert mode in vim?
💡 Press i to enter insert mode and start typing in vim.
2. How do you save and quit vim?
💡 :wq writes the file and quits. ZZ also works.
3. How do you quit without saving?
💡 :q! force-quits vim discarding all unsaved changes.
4. What does dd do in vim?
💡 dd in normal mode deletes the entire current line.
5. How do you search in vim?
💡 / searches forward; ? searches backward in vim.