Hinson's blog

𝕰𝖝𝖈𝖊𝖑𝖑𝖊𝖓𝖈𝖊 𝖎𝖓 𝖈𝖑𝖔𝖚𝖉 𝖆𝖗𝖈𝖍𝖎𝖙𝖊𝖈𝖙𝖚𝖗𝖊 𝖆𝖓𝖉 𝖘𝖊𝖈𝖚𝖗𝖎𝖙𝖞 𝖉𝖔𝖒𝖆𝖎𝖓𝖘 𝖎𝖘 𝖙𝖍𝖊 𝖊𝖙𝖊𝖗𝖓𝖆𝖑 𝖕𝖚𝖗𝖘𝖚𝖎𝖙 𝖔𝖋 𝖒𝖞 𝖕𝖗𝖔𝖋𝖊𝖘𝖘𝖎𝖔𝖓𝖆𝖑 𝖌𝖗𝖔𝖜𝖙𝖍

Mastering Vim: The Ultimate Command Conqueror’s Guide

Spread the love

Navigation

  • h, j, k, l – Move left, down, up, right (respectively)
  • gg – Go to the first line of the document
  • G – Go to the last line of the document
  • w – Jump forwards to the start of a word
  • b – Jump backwards to the start of a word
  • 0 – Jump to the start of the line
  • $ – Jump to the end of the line
  • Ctrl + f – Page down
  • Ctrl + b – Page up

Editing

  • x – Cut (delete) the character under the cursor
  • r – Replace the character under the cursor
  • cc or S – Change (replace) an entire line
  • cw – Change (replace) to the end of a word
  • ciw – Change (replace) entire word
  • C – Change (replace) to the end of the line
  • d – Delete
  • dd – Delete an entire line
  • dw – Delete the word

Copy-Paste

  • yy or Y – Yank (copy) a line
  • yw – Yank (copy) the word
  • p – Paste after the cursor
  • P – Paste before the cursor

Undo/Redo

  • u – Undo
  • Ctrl + r – Redo

Search and Replace

  • /pattern – Search for a pattern in the document
  • ?pattern – Search backward for a pattern
  • n – Repeat the search in the same direction
  • N – Repeat the search in the opposite direction
  • :%s/old/new/g – Replace all occurrences of “old” with “new” in the document
  • :%s/old/new/gc – Replace all occurrences with confirmation

Miscellaneous

  • :w – Save the file
  • :q – Quit Vim
  • :wq or :x – Save and quit
  • :q! – Quit without saving
  • :e filename – Open a file
  • :split or :vsp – Split the window
  • :help – Access Vim’s built-in help

Reference: https://vim.rtorr.com/

Leave a Reply

Your email address will not be published. Required fields are marked *