Vi Commands

From Null-pointer

(Redirected from VI commands)
Jump to: navigation, search

Contents

Moving the cursor

  • 1G start of file
  • nG go to line n
  • G end of file
  • 0 goto start of line
  • $ goto end of line

Replacing text

  • :g/one/s//two/g replace one with two

Copy and paste

  • yy copy line
  • p paste line

Search

  • /searchTerm search forwards
  • ?searchTerm search backwards
  • n search next

Miscellaneous

  • u undo
  • J join current line with next line
Personal tools