256 Kilobytes

[Infographic] The Beginner's Vim Cheat Sheet

Articles in Professional Tools | By August R. Garcia

Published 6 months agoTue, 30 Apr 2019 16:59:27 -0700

All of the Vim commands and tricks that you actually need to know.

1,870 view, 0 RAMs, and 1 comment

Are you new to Vim, the only legitimate text editor? Good thing you're on this page, since it contains the ultimate cheat sheet for all of the most important Vim commands, keyboard shortcuts, and hotkeys.

Vim Cheat Sheet Infographic

The Beginner's Vim Cheat Sheet by 256 Kilobytes

Vim Commands Cheat Sheet, Copy-Pasteable

Exiting Vim

  • :w  - Write (Save)
  • :wq - Write and quit
  • :q  - Quit, fails if unsaved
  • :q! - Quit, even if unsaved

Modes

  • ESC    - Return to normal mode
  • i      - Insert at cursor position
  • a      - Insert after cursor position
  • o      - Insert on line below cursor
  • v      - Enter visual mode
  • ctrl+v - Enter visual mode (vertical)
  • V      - Enter visual mode (full lines)

Toggling Case

  • u [in visual mode] - To lowercase
  • U [in visual mode] - To uppercase
  • Undo/Redo
  • u      - Undo
  • ctrl+r - Redo

Movement

  • $     - Jump to end of line
  • ^     - Jump to start of line
  • h     - Move left
  • j     - Move down
  • k     - Move up
  • l     - Move right
  • H     - Move to top of screen
  • M     - Move to middle of screen
  • L     - Move to bottom of screen
  • gg    - Move to start of file
  • G     - Move to end of file
  • 420gg - Move to line 420
  • w     - Jump to start of next word
  • b     - Jump to start of prev word

Search

  • /something    - Search for string
  • n             - Jump to next match
  • N             - Jump to prev match
  • /something\c  - Case insensitive search

Copy-Pasting

  • y  [in visual mode] - Copy highlighted text
  • yy                  - Copy the current line
  • d  [in visual mode] - Cut highlighted text
  • dd                  - Cut the current line
  • Ctrl+Shift+V        - Paste from external clipboard

Find-and-Replace

  • Find and Replace All in Document
    • :%s/find/replace/g
  • Find and Replace All on Current Line
    • :s/find/replace/g  [in visual mode]  
  • Find and Replace All in Highlighted Section
    • :'<,'>s/find/replace/g  [in visual mode] 
  • Find and Replace All in Document
    • :%s/address/replace/g

Important Regular Expression (REGEX) Characters

  • . - Any single character
  • * - Up to unlimited characters

Bonus Notes

Also see the infographic "Visualizing the Information Superhighway," learn about the best keyboard to use with Vim, and search for more content tagged as being about Vim.

Download more RAM. 🐏 ⨉ 0 Posted by August R. Garcia 6 months ago 🕓 Posted at 30 April, 2019 16:59 PM PDT

Profile Photo - August R. Garcia August R. Garcia LARPing as a Sysadmi... Portland, OR
🗎 198 🗨 985 🐏 299
Site Owner

Grahew Mattham

August Garcia is some guy who used to sell Viagra on the Internet. He made this website to LARP as a sysadmin while posting about garbage like user-agent spoofing, spintax, the only good keyboard, virtual assitants from Pakistan, links with the rel="nofollow" attributeproxiessin, the developer console, literally every link building method, and other junk.

Available at arg@256kilobytes.com, via Twitter, or arg.256kilobytes.com. Open to business inquiries based on availability.


Account created 11 months ago.
198 posts, 985 comments, and 299 RAMs.

Last active 5 hours ago:
Commented in thread [Discord] Syntax highlighting?

Profile Photo - August R. Garcia August R. Garcia LARPing as a Sysadmi... Portland, OR
🗎 198 🗨 985 🐏 299
Site Owner

Bump with a tangential article that's been going around the Internet:

Download more RAM. 🐏 ⨉ 0 Posted by August R. Garcia 3 months ago 🕓 Posted at 19 July, 2019 23:00 PM PDT

Sir, I can do you a nice SEO.

Post a New Comment

To leave a comment, login to your account or create an account.

Do you like having a good time?

Read Quality Articles

Read some quality articles. If you can manage to not get banned for like five minutes, you can even post your own articles.

View Articles →

Argue with People on the Internet

Use your account to explain why people are wrong on the Internet forum.

View Forum →

Vandalize the Wiki

Or don't. I'm not your dad.

View Wiki →

Ask and/or Answer Questions

If someone asks a terrible question, post a LMGTFY link.

View Answers →

Make Some Money

Hire freelancers and/or advertise your goods and/or services. Hire people directly. We're not a middleman or your dad. Manage your own business transactions.

Register an Account
You can also login to an existing account or recover your password. All use of this site is subject to terms outlined in the terms of service and privacy policy.