Print this Post

vi commands for cygwin

i started running cygwin for sshd on a windows VM and tried to edit a file using vi and got super frustrated. why is it not the same as regular unix vi??!!! why why??!

anyway, to save you the same headache here is a list of basic vi commands for cygwin

  • i                      – insert is similar to �a� but is to the left of where the cursor is.
  • a                      – appends to the data, after typing �a� you can use the keyboard to type in letter/numbers like a normal word processing program.  When you are done typing what you want at that location, you need to hit the �Esc� button before you can return to the regular mode.
  • Esc                 – escape ends the current mode you are in (i.e. typing mode) and takes you back to the original.
  • x                      – Typing �x� lowercase will erase the character on the cursor, like the �Backspace� key does in a normal word processing program.  The �Delete� button will do the same thing in the regular mode.
  • :w                   – saves all the changes you made to a existing file name.
  • :w new-filename           – saves all the changes you made to a new filename you specify.
  • ZZ                   – Capital ZZ.  This will save and quit the �vi� program and bring you back to the command line.
  • :q!                 – This will quite the �vi� program without saving the last changes you made.
  • u                      – This is undo, and will undo the last action you have completed.
  • dd                   – This will erase the entire line.  Tying a number before typing �dd� will remove the number of lines chosen.
  • :se nu         – This is to �set number lines� which will temporarily number the lines of the document for you.
  • Ctrl f         – This will page down the document by one screen length.
  • Ctrl b         – This will page up the document by one screen length.
  • G                      – This will move the cursor to the end (bottom) of the document
  • 1G                   – This will move the cursor to the top of the document



About devnumbertwo

IT consultant, software developer, technical writer, nba basketball spectator, tea (and occasionally coffee) drinker, cheese enthusiast, dog lover, and a person who once spotted heather locklear at the mall. chiggity check me out on twitter and
vi commands for cygwin was last modified: May 26th, 2015 by devnumbertwo

Permanent link to this article: http://devnumbertwo.com/vi-commands-for-cygwin/