vim
EditorsFundamentals In real LinuxPowerful text editor (vi improved)
Name: vim = Vi IMproved
This command needs a real Linux system; you can practise it in real Linux mode.
Description
vim is a powerful modal editor: in normal mode keys are commands (move, delete, copy), in insert mode they type text, and Esc switches between them. That design lets practised users edit very efficiently without leaving the keyboard.
To start, remember: i to type, Esc for normal mode, :wq to save and quit, :q! to quit without saving. Run vimtutor to learn the basics.
Syntax
vim [OPTION]... [FILE]...Common options
| i | Enter insert mode |
| Esc | Back to normal mode |
| :w / :q / :wq | Save / quit / save and quit |
| :q! | Quit without saving |
| u / Ctrl+R | Undo / redo |
| dd / yy / p | Delete line / copy line / paste |
| v / V | Visual mode by character / line; then d deletes, y copies |
| /word | Search for word; n for the next match |
| :%s/old/new/g | Replace old with new everywhere (add c to confirm each) |
| gg / G / :N | Go to the first line / the last / line N |
| :set nu | Show line numbers (:set nonu hides them) |
| -R | Open read-only (a command-line option) |
| -d | Compare two files (as vimdiff) |
| -O | Open several files side by side |