home *** CD-ROM | disk | FTP | other *** search
/ Nebula / nebula.bin / Documents / Others / viCourse+ / vi-Ref.txt < prev    next >
Text File  |  1992-12-20  |  4KB  |  116 lines

  1.                         Unix vi Reference Card
  2.  
  3.       arrow keys move cursor      ^n,^p,<SP>,<BS> same as arrows
  4. <ESC>     escape from text entry      ^g     tell what is going on
  5. :       give ex command          ZZ     write and quit 
  6. <CR>      start of next line          -      start of previous line
  7.  
  8. ^b        go back one page          ^u     scroll back 1/2 page
  9. ^f      go forward one page            ^d     scroll forward 1/2 page
  10.                            or end indent
  11. ^e      scroll down one line        ^y     scroll up one line
  12. H      home screen line          L      last screen line
  13.  
  14. x      delete character          r      replace char with next 
  15.                            typed 
  16. a      append after cursor         A      append after line
  17. i      insert before cursor        I      insert before line
  18. p      put before cursor          P      put before line
  19. u      undo changes            U      undo changes in this 
  20.                            line only
  21. c obj      change object to following text
  22.  
  23.  
  24.                       Object defining characters
  25.  
  26. w      forward one word          W      forward, ignore punctuation
  27. b         backward one word          B         backward, ignore punc.
  28. e         end of current word         <CR>,- as above
  29.  
  30.  
  31.                        Characters using buffers
  32.  
  33. d obj      delete object          dd     delete line
  34. y obj      yanks object          yy     yank line
  35. p      place what is in buffer
  36. "         select buffer
  37.  
  38. NOTE:  There are 26 buffers, each corresponding to a letter of the
  39.        alphabet. To refer to a specific buffer type "<letter> e.g. "a
  40.        refers to buffer a.  Therefore "add would delete the line that
  41.        cursor is on and place it into buffer a.  To place the deleted
  42.        line elsewhere, position cursor and type "ap.
  43.  
  44.        In order to delete or yank a section of text, you must place a
  45.        mark to where the deletion/yank is to stop.  This is done by
  46.        typing: m<letter> (do not use the same buffer to place a mark
  47.        and store text). To return to that location, type `<letter>.
  48.        When deleting or yanking to a mark, say b, position the
  49.        cursor at the beginning of the desired text, and type "ad`b.
  50.        This deletes the text from cursor until mark b, and places it
  51.        in buffer a.  "ad'b will delete until the end of the line in
  52.        which mark b is (note difference in ` and ').
  53.  
  54.  
  55.  
  56.                             Search
  57.  
  58. /text<CR> search forward for text     ?text<CR> search backward
  59. n      next occurance          N         next occurance in 
  60.                           opposite direction
  61.  
  62.                         Miscellaneous
  63.  
  64. J     adjoin current line to line above
  65. !!    place results of command into file i.e. !!cat it.p will place
  66.            the list of it.p in your file.
  67.  
  68.  
  69.  
  70.  
  71.  
  72.                         Unix ex Reference Card
  73.  
  74.  
  75.   n      set pointer to line n
  76.   n,n    specify a range of lines for next command
  77.   $      used to indicate last line in file
  78.   .      print current line or end insertion
  79.  
  80.   p      print specified lines
  81.   p#     print specified lines with line numbers
  82.   a      append lines after this line; end insertion with "."
  83.   i      insert lines after this line; end insertion with "."
  84.   d      delete specified lines
  85.   u      undo last deletion or substitution
  86.   c      change (i.e. replace) specified lines to new text
  87.   ya     yank specified lines into buffer
  88.   pu     lines from buffer before this one
  89.   w      write current text to file
  90.   q      quit edit
  91.   q!     forces quit without write
  92.   wq     write and quit
  93.   vi     enter vi editor
  94.   se     display settings; refer to manual for details
  95.  
  96.  
  97.   /text/        search for text
  98.   //            search for next occurrence
  99.   s/oldtext/newtext/    substitute newtext for oldtext in 
  100.                 specified lines
  101.   n1,n2copy3        copy lines n1-n2 to after n3
  102.   global/pattern/cmds    search file for pattern and do cmds on those 
  103.                 lines.
  104.  
  105.   set nu            insert line numbers
  106.   set nonu        remove line numbers
  107.  
  108.  
  109. -- 
  110.            "...nothing kills that does not know ye."
  111.                   -Meg Davis, `The Elf Glade' 
  112. UUCP: ihnp4!gargoyle!sphinx!d757       d757@sphinx.uchicago.edu    
  113.       Lawrence Lerner    University of Chicago Computation Center   
  114.  
  115.  
  116. obhN R>p.         s—y            dhN R>p.         s—y            dhN R>p.         s—y