[plug] Vi cheat sheet

Arie Hol arie99 at ozemail.com.au
Mon Aug 19 12:42:22 WST 2002


Hello Lazy,


Is this what your looking for ??

At 09:38 AM 19-08-2002 +0800, you wrote:
>Does anyone have a Vi cheet sheet (1 A4 page) that I can give to a newbie?
>


                          The vi Commands


 The following is a list of frequently used vi commands. This is by no
 means exhaustive. Question mark ? stands for a number, like 4 and 10
 throughout. Comas , is used to separate two commands.

   1) enter insert mode

      i 			to insert mode, before the cursor
      a 			to insert mode, after the cursor
      o, O 			expand one line below, up
      R 			change one line      

   2) cursor movement
 
      h, j, k, l    		to left, down, up, right one character 
      ?h, ?j, ?k, ?l    	to left, down, up, right ? characters 
      w, W, e, E    		to the begining, end of the next word
      ?w, ?W, ?e, ?E    	to the begining, end of the ?th word
      b, B  	    		to the previous word
      ?b, ?B  	    		to the ?th word before the cursor
      G, ?G 			to the last, ?th line of the file 
      0 (zero, not o), $ 	to the beginnig, end of a line
      ctrl-u, ctrl-d 		up, down half a screen
      ctrl-f, ctrl-b 		up, down one screen

      /string			search for the string
      n				continue the search

   3) editing (note: the last deletion goes to an internal buffer)
  
      r, R 			change one character, or one line
      x, ?x 			delete character(s)
      dw, dW, de, dE 		delete the next word 
      ?dw, ?dW, ?de, ?dE 	delete the next ? words 
      db, dB 			delete the preceeding word
      ?db, ?dB 			delete the preceeding ? words
      dd, ?dd 			delete one or more lines
      D				delete the line right to the cursor 
      J 			joint two lines into one

   4) cut and paste

      Y, ?Y 			yank 1 or ? lines into internal buffer  
      p, P 			paste internal buffer at cursor 
      
   5) repeat and undo the last modification

      ., ?. 			repeat last modification for 1 or more times
      u 			undo the last editing command

   6) reading and writing a file

      :r filename 		include the file after the cursor
      :w 			save the current file
      :w filename 		write to the specified file
      :q, :q!			quit, conditional, and unconditional 
      :wq 			save and quit

   7) set styles

      :set nu, :set nonu 	display, not display line numbers
      :set ai, :set noai 	enable, disable automatoc indentation 

Regards Arie

>--------------------------------------------<

For the concert of life, nobody has a program.

>--------------------------------------------<



More information about the plug mailing list