home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / unix / riscbsd / datafile / usd / 15_vi / vi_summary < prev   
Encoding:
Text File  |  1996-10-12  |  9.2 KB  |  397 lines

  1.  
  2.  
  3.  
  4. Ex Quick Reference
  5.  
  6.  
  7. Entering/leaving ex
  8.  
  9. aw(1.4i)b aw(1.8i).  % ex name edit
  10. name,  start  at  end   %   ex   +n
  11. name   ...   at  line  n  %  ex  -t
  12. tag    start at tag % ex  -r   list
  13. saved  files % ex -r name   recover
  14. file  name  %  ex  name   ...  edit
  15. first;  rest  via  :n  % ex -R name
  16.   read only mode : x  exit,  saving
  17. changes   :   q! exit,   discarding
  18. changes
  19.  
  20. Ex states
  21.  
  22. lw(1i) lw(2.0i).  Command   T{ Nor-
  23. mal   and   initial  state.   Input
  24. prompted for by :.  Your kill char-
  25. acter  cancels partial command.  T}
  26. Insert    T{ Entered by a i and  c.
  27. Arbitrary text then terminates with
  28. line having only .  character on it
  29. or  abnormally  with interrupt.  T}
  30. Open/visual    T{ Entered  by  open
  31. or vi, terminates with Q or ^\.  T}
  32.  
  33. Ex commands
  34.  
  35. lw(.45i)     lw(.08i)b     lw(.45i)
  36. lw(.08i)b    lw(.45i)    lw(.08i)b.
  37. abbrev    ab   next n    unabbrev  una
  38. append    a    number    nu   undo u
  39. args ar   open o    unmap     unm
  40. change    c    preserve  pre  version   ve
  41. copy co   print     p    visual    vi
  42. delete    d    put  pu   write     w
  43. edit e    quit q    xit  x
  44. file f    read re   yank ya
  45. global    g    recover   rec  window    z
  46. insert    i    rewind    rew  escape    !
  47. join j    set  se   lshift    <
  48. list l    shell     sh   print
  49. next CR
  50. map       source    so   resubst   &
  51. mark ma   stop st   rshift    >
  52. move m    substitute     s    scroll    ^D
  53.  
  54. Ex command addresses
  55.  
  56. lw(.3i)b     lw(0.8i)      lw(.3i)b
  57. lw(0.8i).  n    line n    /pat next
  58. with pat .    current   ?pat previ-
  59. ous   with   pat   $    last x-n  n
  60. before x +    next x,y  x through y
  61. -    previous  'x   marked  with  x
  62. +n   n    forward     ''   previous
  63. context %    1,$
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. Specifying terminal type
  71.  
  72. aw(1.7i)b  aw(1.5i).  % setenv TERM
  73. type  csh  and  all  version  6   $
  74. TERM=type;  export  TERM sh in Ver-
  75. sion 7 See also tset(1)
  76.  
  77. Some terminal types
  78.  
  79. lw(.4i)  lw(.4i)  lw(.4i)   lw(.4i)
  80. lw(.4i).
  81. 2621 43   adm31     dw1  h19
  82. 2645 733  adm3a     dw2  i100
  83. 300s 745  c100 gt40 mime
  84. 33   act4 dm1520    gt42 owl
  85. 37   act5 dm2500    h1500     t1061
  86. 4014 adm3 dm3025    h1510     vt52
  87.  
  88. Initializing options
  89.  
  90. lw(.9i)b aw(1.5i).  EXINIT    place
  91. set's here in environment var.  set
  92. x enable  option  set nox   disable
  93. option  set  x=val give  value  val
  94. set  show   changed   options   set
  95. all   show    all    options    set
  96. x?    show value of option x
  97.  
  98. Useful options
  99.  
  100. lw(.9i)b      lw(.3i)     lw(1.0i).
  101. autoindent     ai   supply   indent
  102. autowrite aw   write  before chang-
  103. ing  files   ignorecase     ic   in
  104. scanning  lisp      (  ) { } are s-
  105. exp's list      print ^I for tab, $
  106. at end magic          . [ * special
  107. in  patterns  number    nu   number
  108. lines     paragraphs     para macro
  109. names     which      start      ...
  110. redraw         simulate  smart ter-
  111. minal  scroll         command  mode
  112. lines   sections  sect macro  names
  113. ...  shiftwidth     sw   for  <  >,
  114. and  input  ^D  showmatch sm   to )
  115. and } as typed slowopen  slow choke
  116. updates        during        insert
  117. window         visual  mode   lines
  118. wrapscan  ws   around     end    of
  119. buffer?   wrapmargin     wm   auto-
  120. matic line splitting
  121.  
  122.  
  123. Scanning pattern formation
  124.  
  125. aw(.9i)b  aw(1.0i).  ^    beginning
  126. of   line    $    end    of    line
  127. \<   beginning  of word \>   end of
  128. word  [str]     any  char  in   str
  129. [^str]    ...     not     in    str
  130. [x-y]     ...  between  x   and   y
  131. *    any number of preceding
  132.  
  133.  
  134.  
  135.  
  136.         Vi Quick Reference
  137.  
  138.  
  139. Entering/leaving vi
  140.  
  141. aw(1.4i)b aw(1.8i).  % vi name edit
  142. name at top % vi +n  name   ...  at
  143. line  n % vi + name    ... at end %
  144. vi -r   list saved files  %  vi  -r
  145. name   recover  file name % vi name
  146. ...  edit first; rest via :n  %  vi
  147. -t  tag   start  at  tag % vi +/pat
  148. name     search  for  pat  %   view
  149. name    read  only  mode  ZZ   exit
  150. from vi, saving  changes  ^Z   stop
  151. vi for later resumption
  152.  
  153. The display
  154.  
  155. lw(.75i)  lw(2.2i).   Last  line T{
  156. Error messages, echoing input to  :
  157. /  ?  and !, feedback about i/o and
  158. large  changes.   T}  @  lines   On
  159. screen   only,   not  in  file.   ~
  160. lines   Lines  past  end  of  file.
  161. ^x   Control   characters,   ^?  is
  162. delete.   tabs Expand  to   spaces,
  163. cursor at last.
  164.  
  165.  
  166. Vi states
  167.  
  168. lw(.75i)   lw(2.2i).   Command   T{
  169. Normal and initial  state.   Others
  170. return  here.  ESC (escape) cancels
  171. partial command.   T}  Insert    T{
  172. Entered  by  a i A I o O c C s S R.
  173. Arbitrary text then terminates with
  174. ESC  character,  or abnormally with
  175. interrupt.  T} Last line T{ Reading
  176. input  for  :  /  ? or !; terminate
  177. with ESC or CR to  execute,  inter-
  178. rupt to cancel.  T}
  179.  
  180. Counts before vi commands
  181.  
  182. lw(1.5i)   lw(1.7i)b.   line/column
  183. number  z  G  |  scroll  amount  ^D
  184. ^U  replicate  insert    a  i  A  I
  185. repeat effect most rest
  186.  
  187. Simple commands
  188.  
  189. lw(1.5i)b lw(1.7i).  dw   delete  a
  190. word  de   ...  leaving punctuation
  191. dd   delete a line 3dd  ... 3 lines
  192. itextESC  insert      text      abc
  193. cwnewESC  change   word   to    new
  194. easESC    pluralize            word
  195. xp   transpose characters
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. Interrupting, cancelling
  203.  
  204. aw(0.75i)b   aw(1.6i).     ESC  end
  205. insert     or     incomplete    cmd
  206. ^?   (delete or rubout)  interrupts
  207. ^L   reprint screen if ^? scrambles
  208. it
  209.  
  210. File manipulation
  211.  
  212. aw(0.75i)b  aw(1.6i).    :w   write
  213. back  changes  :wq  write  and quit
  214. :q   quit    :q!  quit,     discard
  215. changes  :e  name   edit  file name
  216. :e!  reedit, discard changes  :e  +
  217. name edit,   starting   at  end  :e
  218. +n     edit starting at line  n  :e
  219. # edit  alternate file ^^   synonym
  220. for :e # :w name   write file  name
  221. :w!   name  overwrite   file   name
  222. :sh  run   shell,    then    return
  223. :!cmd     run   cmd,   then  return
  224. :n   edit next file in  arglist  :n
  225. args   specify      new     arglist
  226. :f   show  current  file  and  line
  227. ^G   synonym  for  :f  :ta tag   to
  228. tag file entry tag  ^]   :ta,  fol-
  229. lowing word is tag
  230.  
  231. Positioning within file
  232.  
  233. aw(0.75i)b  aw(1.6i).  ^F   forward
  234. screenfull ^B   backward screenfull
  235. ^D   scroll    down   half   screen
  236. ^U   scroll    up    half    screen
  237. G    goto    line   (end   default)
  238. /pat next   line    matching    pat
  239. ?pat prev    line    matching   pat
  240. n    repeat    last    /    or    ?
  241. N    reverse    last    /    or   ?
  242. /pat/+n   n'th   line   after   pat
  243. ?pat?-n   n'th   line   before  pat
  244. ]]   next          section/function
  245. [[   previous      section/function
  246. %    find matching ( ) { or }
  247.  
  248. Adjusting the screen
  249.  
  250. aw(0.75i)b  aw(1.6i).    ^L   clear
  251. and redraw ^R   retype, eliminate @
  252. lines zCR  redraw, current at  win-
  253. dow top z-   ... at bottom z.   ...
  254. at  center  /pat/z-   pat  line  at
  255. bottom   zn.  use   n  line  window
  256. ^E   scroll  window  down  1   line
  257. ^Y   scroll window up 1 line
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. Marking and returning
  269.  
  270. aw(0.5i)b  aw(2.0i).  ``   previous
  271. context ''   ... at first non-white
  272. in  line  mx   mark  position  with
  273. letter x `x   to mark x 'x   ... at
  274. first non-white in line
  275.  
  276. Line positioning
  277.  
  278. aw(0.5i)b aw(2.0i).  H    home win-
  279. dow  line  L    last  window   line
  280. M    middle  window  line +    next
  281. line, at first non-white  -    pre-
  282. vious   line,  at  first  non-white
  283. CR   return,  same  as   +   v   or
  284. j    next  line,  same  column ^ or
  285. k    previous line, same column
  286.  
  287. Character positioning
  288.  
  289. aw(0.5i)b aw(2.0i).  ^    first non
  290. white    0    beginning   of   line
  291. $    end of line h or  ->   forward
  292. l or <-   backwards ^H   same as <-
  293. space     same as  ->  fx   find  x
  294. forward Fx   f backward tx   upto x
  295. forward    Tx   back     upto     x
  296. ;    repeat   last   f  F  t  or  T
  297. ,    inverse of ; |    to specified
  298. column  %    find matching ( { ) or
  299. }
  300.  
  301. Words, sentences, paragraphs
  302.  
  303. aw(0.5i)b aw(2.0i).  w    word for-
  304. ward  b    back  word  e    end  of
  305. word )    to next sentence  }    to
  306. next  paragraph  (    back sentence
  307. {    back   paragraph    W    blank
  308. delimited  word B    back W E    to
  309. end of W
  310.  
  311. Commands for LISP
  312.  
  313. aw(0.5i)b  aw(2.0i).   )    Forward
  314. s-expression   }    ...  but  don't
  315. stop   at   atoms   (    Back    s-
  316. expression  {    ... but don't stop
  317. at atoms
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. Corrections during insert
  335.  
  336. aw(.5i)b aw(2.0i).  ^H   erase last
  337. character   ^W   erases  last  word
  338. erase     your erase,  same  as  ^H
  339. kill your  kill,  erase  input this
  340. line \    escapes  ^H,  your  erase
  341. and  kill ESC  ends insertion, back
  342. to command  ^?   interrupt,  termi-
  343. nates   insert   ^D   backtab  over
  344. autoindent  ^^D  kill   autoindent,
  345. save  for next 0^D  ... but at mar-
  346. gin  next  also   ^V   quote   non-
  347. printing character
  348.  
  349. Insert and replace
  350.  
  351. aw(.5i)b   aw(2.0i).    a    append
  352. after  cursor  i    insert   before
  353. A    append    at   end   of   line
  354. I    insert before first  non-blank
  355. o    open   line   below  O    open
  356. above rx   replace single char with
  357. x R    replace characters
  358.  
  359. Operators (double to affect lines)
  360.  
  361. aw(0.5i)b   aw(2.0i).   d    delete
  362. c    change     <    left     shift
  363. >    right     shift    !    filter
  364. through  command  =    indent   for
  365. LISP y    yank lines to buffer
  366.  
  367. Miscellaneous operations
  368.  
  369. aw(0.5i)b   aw(2.0i).   C    change
  370. rest of line  D    delete  rest  of
  371. line      s    substitute     chars
  372. S    substitute   lines   J    join
  373. lines     x    delete    characters
  374. X    ...  before  cursor  Y    yank
  375. lines
  376.  
  377. Yank and put
  378.  
  379. aw(0.5i)b  aw(2.0i).  p    put back
  380. lines P    put before "xp  put from
  381. buffer  x  "xy  yank  to  buffer  x
  382. "xd  delete into buffer x
  383.  
  384. Undo, redo, retrieve
  385.  
  386. aw(0.5i)b aw(2.0i).  u    undo last
  387. change  U    restore  current  line
  388. "dp  retrieve d'th last delete
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.