Template:NotesOnVi

From Computer Laboratory System Administration
Jump to navigationJump to search

GENERAL NOTES on vi
Note: Best to press <escape> before using these to put you back in "command" mode rather than editing

  • /string and [Enter] (search for the string)
  • /^<char> and [Enter] (search for character char at the start of a line)
  • : for command prompt
  • :1 to go to line 1
  • :wq and [Enter] is write & quit
  • :q! and [Enter] is quit without writing (if you mess up!)
  • :help and [Enter] for help
  • Arrow-keys scroll around text
  • Ctrl+F to page-Forward through text
  • Ctrl+B to page-Back through text
  • Shift+A to go into -- INSERT -- mode at end of line
  • i to go into -- INSERT -- mode at the cursor
  • Shift+R to enter -- REPLACE -- or "Overtype" mode
  • [Esc] escape out of -- INSERT -- & -- REPLACE -- mode
  • u undo last change
  • dd deletion (if pressed twice the object is the current line)
  • U undelete (to undelete the last deletion)
  • P paste (to paste the last delete)
  • w move forward by a word (a word is any string - this includes white space)