Skip to content

Instantly share code, notes, and snippets.

@audreyfeldroy
Last active March 27, 2025 19:15
Show Gist options
  • Save audreyfeldroy/4bf1a4afe34ab4629b00d05b237ccd2c to your computer and use it in GitHub Desktop.
Save audreyfeldroy/4bf1a4afe34ab4629b00d05b237ccd2c to your computer and use it in GitHub Desktop.
Vim Cheat Sheet for Beginners

Vim Cheat Sheet for Beginners

Modes

Key Mode
i Insert
Esc Normal
v Visual
: Command-line

Navigation (Normal mode)

Key Action
h j k l Left, Down, Up, Right
w / b Next / prev word
0 / $ Start / end of line
gg / G First / last line

Editing

Key Action
i / a Insert before / after
o / O New line below / above
x Delete character
dd Delete line
yy Copy line
p / P Paste after / before

Search and Replace

Command Action
/pattern Search forward
?pattern Search backward
n / N Next / previous occurrence
:%s/old/new/g Replace all 'old' with 'new'

File Operations

Command Action
:w Save
:q Quit
:wq or :x Save and quit
:q! Force quit

Multiple Files

Command Action
:e filename Edit file in buffer
:bn / :bp Next / prev buffer
:bd Close buffer

Window Management

Command Action
:split filename Split horizontally
:vsplit filename Split vertically
Ctrl-w w Switch windows
Ctrl-w q Close window

Text Objects

Key Object
iw Inner word
it Inner tag
i" Inner quotes
ip Inner paragraph

Useful Commands

Key Action
u Undo
Ctrl-r Redo
. Repeat last cmd
> / < Indent right/left

Tips

  1. Practice in Normal mode
  2. Combine commands (e.g., dw)
  3. Use :help for documentation
  4. Customize your .vimrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment