Skip to content

Instantly share code, notes, and snippets.

@taylorreiter
Created July 26, 2023 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taylorreiter/ffa0394fd55f4f15447e9eedd116fdcb to your computer and use it in GitHub Desktop.
Save taylorreiter/ffa0394fd55f4f15447e9eedd116fdcb to your computer and use it in GitHub Desktop.
vim-cheat-sheet.md

Vim Cheat Sheet

Insert vs. command mode

  • i: insert mode
  • o: insert mode, but one line below
  • esc: exit insert mode and return to command mode

Navigation

  • $: go to end of line
  • 0: go to beginning of line
  • gg: skip to the top of the document
  • GG: skip to the bottom of the document
  • gt: toggle to the next tab

Editing commands

  • dd: delete the line
  • d$: delete from wherever your cursor is until the end of the line
  • d0: delete from wherever your cursor is until the beginning of the line
  • d10d: delete 10 lines (or whatever number you use)
  • yy: yank the line (copy)
  • d$: yank from wherever your cursor is until the end of the line
  • d0: yank from wherever your cursor is until the beginning of the line
  • d10d: yank 10 lines (or whatever number you use)
  • p: paste
  • u: undo

Fun commands

  • :tabnew <relative path of file you want to open>: open a new tab
  • :set nu: set line numbers
  • :set nonu: remove line numbers
  • :set rnu: set relative line numbers

Write & quite

  • :wq: write and quite
  • :q: quit, when no changes have been made to the document
  • q!: quit, not writing the changes that have been made to the document
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment