home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume33 / vilearn / part01 < prev    next >
Encoding:
Text File  |  1992-11-03  |  56.2 KB  |  1,793 lines

  1. Newsgroups: comp.sources.misc
  2. From: wes.craig@umich.edu (Wes Craig)
  3. Subject:  v33i035:  vilearn - tutorial for vi, v1.0, Part01/01
  4. Message-ID: <1992Nov5.025814.3491@sparky.imd.sterling.com>
  5. X-Md4-Signature: 86b013e13ca33fadeadb515bf3cbfc78
  6. Date: Thu, 5 Nov 1992 02:58:14 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: wes.craig@umich.edu (Wes Craig)
  10. Posting-number: Volume 33, Issue 35
  11. Archive-name: vilearn/part01
  12. Environment: UNIX,vi
  13.  
  14. >From the man page:
  15.  
  16.     vilearn presents a menu of tutorials available for vi.  There are
  17.     five short tutorials, each a text file intended to be edited with
  18.     vi.  The first, Basic Editing, covers the handful of commands
  19.     required to both navigate all five tutorials and do basic editing.
  20.     The second tutorial, Moving Efficiently, covers all of the cursor
  21.     positioning commands.  These are the commands used later as
  22.     arguments to editing commands.  Tutorial three, Cutting and
  23.     Pasting, introduces the first compound commands, numbering, and
  24.     copy buffers.  The Inserting Techniques tutorial continues the
  25.     discussion of compound commands, while completing the list of
  26.     insertion commands first discussed in tutorial one.
  27.  
  28.     The final tutorial, Tricks and Timesavers, is less a tutorial than
  29.     a description of common vi commands which don't fit correctly into
  30.     "normal" vi logic.
  31.  
  32. wes
  33.  
  34. #! /bin/sh
  35. # This is a shell archive.  Remove anything before this line, then unpack
  36. # it by saving it into a file and typing "sh file".  To overwrite existing
  37. # files, type "sh file -c".  You can also feed this as standard input via
  38. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  39. # will see the following message at the end:
  40. #        "End of shell archive."
  41. # Contents:  vilearn-1.0 vilearn-1.0/README vilearn-1.0/Makefile
  42. #   vilearn-1.0/vilearn.man vilearn-1.0/vilearn.sh vilearn-1.0/outline
  43. #   vilearn-1.0/1basics vilearn-1.0/2moving vilearn-1.0/3cutpaste
  44. #   vilearn-1.0/3temp vilearn-1.0/4inserting vilearn-1.0/5tricks
  45. # Wrapped by wes@terminator.rs.itd.umich.edu on Wed Oct 28 00:07:21 1992
  46. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  47. if test ! -d 'vilearn-1.0' ; then
  48.     echo shar: Creating directory \"'vilearn-1.0'\"
  49.     mkdir 'vilearn-1.0'
  50. fi
  51. if test -f 'vilearn-1.0/README' -a "${1}" != "-c" ; then 
  52.   echo shar: Will not clobber existing file \"'vilearn-1.0/README'\"
  53. else
  54. echo shar: Extracting \"'vilearn-1.0/README'\" \(973 characters\)
  55. sed "s/^X//" >'vilearn-1.0/README' <<'END_OF_FILE'
  56. XThis is version 1.0 of vilearn, an interactive vi tutorial.
  57. X
  58. XCopyright (c) 1992 Jill Kliger and Wesley Craig.  All Rights Reserved.
  59. X
  60. XPermission to use, copy, modify, and distribute this software and its
  61. Xdocumentation for any purpose and without fee is hereby granted,
  62. Xprovided that the above copyright notice appears in all copies and that
  63. Xthe copyright notice, this permission notice, and an explicit record of
  64. Xany local changes, appear in supporting documentation.  This software
  65. Xis supplied as is without expressed or implied warranties of any kind.
  66. X
  67. XTo install, edit the Makefile and type
  68. X
  69. X    make install
  70. X
  71. XWe have a mailing list, vilearn-admins@terminator.rs.itd.umich.edu. To
  72. Xbe added to the list, send mail to vilearn-admins-request.  The list is
  73. Xintended to discuss the tutorials, coordinate projects relating to
  74. Xthem, and provide help to those who may need it.
  75. X
  76. XWesley Craig & Jill Kliger
  77. X1317 Packard Street        vilearn@terminator.rs.itd.umich.edu
  78. XAnn Arbor, MI 48104
  79. END_OF_FILE
  80. if test 973 -ne `wc -c <'vilearn-1.0/README'`; then
  81.     echo shar: \"'vilearn-1.0/README'\" unpacked with wrong size!
  82. fi
  83. # end of 'vilearn-1.0/README'
  84. fi
  85. if test -f 'vilearn-1.0/Makefile' -a "${1}" != "-c" ; then 
  86.   echo shar: Will not clobber existing file \"'vilearn-1.0/Makefile'\"
  87. else
  88. echo shar: Extracting \"'vilearn-1.0/Makefile'\" \(1152 characters\)
  89. sed "s/^X//" >'vilearn-1.0/Makefile' <<'END_OF_FILE'
  90. X#
  91. X# Copyright (c) 1992 Jill Kliger and Wesley Craig.  All Rights Reserved.
  92. X#
  93. X
  94. X# BINDIR is where the vilearn shell script will live. It should be in the
  95. X# path of new users.
  96. XBINDIR=    /usr/local/bin
  97. X
  98. X# MANDIR is the man area where vilearn's man page will be installed. It
  99. X# should be somewhere that the default man command will search.
  100. X
  101. XMANDIR=    /usr/local/man
  102. X
  103. X# SEC is the section of the manual that vilearn's man page will be
  104. X# installed in.
  105. X
  106. XSEC=    1
  107. X
  108. X# TUTORIALS is the directory where the master copies of the tutorials
  109. X# will live.
  110. XTUTORIALS=    /usr/local/lib/vilearn
  111. X
  112. X# Shouldn't have to edit below here.
  113. X
  114. XTUTS=    1basics 2moving 3cutpaste 3temp 4inserting 5tricks
  115. X
  116. Xall : vilearn vilearn.${SEC}
  117. X
  118. Xvilearn : vilearn.sh
  119. X    sed -e s@:TUTORIALS:@${TUTORIALS}@ < vilearn.sh > vilearn
  120. X
  121. Xvilearn.${SEC} : vilearn.man
  122. X    sed -e s@:SEC:@${SEC}@ < vilearn.man > vilearn.${SEC}
  123. X
  124. Xinstall : all
  125. X    -mkdir ${TUTORIALS}
  126. X    for i in ${TUTS} ; do \
  127. X        rm -f ${TUTORIALS}/$$i; \
  128. X        install -c -m 444 $$i ${TUTORIALS}/$$i ; \
  129. X    done
  130. X    install -m 755 vilearn ${BINDIR}/vilearn
  131. X    install -m 444 vilearn.${SEC} ${MANDIR}/man${SEC}/vilearn.${SEC}
  132. X
  133. Xclean :
  134. X    rm -f vilearn vilearn.${SEC}
  135. END_OF_FILE
  136. if test 1152 -ne `wc -c <'vilearn-1.0/Makefile'`; then
  137.     echo shar: \"'vilearn-1.0/Makefile'\" unpacked with wrong size!
  138. fi
  139. # end of 'vilearn-1.0/Makefile'
  140. fi
  141. if test -f 'vilearn-1.0/vilearn.man' -a "${1}" != "-c" ; then 
  142.   echo shar: Will not clobber existing file \"'vilearn-1.0/vilearn.man'\"
  143. else
  144. echo shar: Extracting \"'vilearn-1.0/vilearn.man'\" \(1207 characters\)
  145. sed "s/^X//" >'vilearn-1.0/vilearn.man' <<'END_OF_FILE'
  146. X.TH VILEARN ":SEC:" "Oct 25, 1992" "Kliger&Craig"
  147. X.SH NAME
  148. X.B vilearn
  149. X\- present menu of tutorials for vi
  150. X.SH SYNOPSIS
  151. X.B vilearn
  152. X.SH DESCRIPTION
  153. X.B vilearn
  154. Xpresents a menu of tutorials available for
  155. X.BR vi .
  156. XThere are five short tutorials, each a text file intended to be edited
  157. Xwith
  158. X.BR vi .
  159. XThe first,
  160. X.IR "Basic Editing" ,
  161. Xcovers the handful of commands required to both navigate all five
  162. Xtutorials and do basic editing.  The second tutorial,
  163. X.IR "Moving Efficiently" ,
  164. Xcovers all of the cursor positioning commands. These are the commands
  165. Xused later as arguments to editing commands. Tutorial three,
  166. X.IR "Cutting and Pasting" ,
  167. Xintroduces the first compound commands, numbering, and copy buffers.
  168. XThe
  169. X.I "Inserting Techniques"
  170. Xtutorial continues the discussion of compound commands, while
  171. Xcompleting the list of insertion commands first discussed in tutorial
  172. Xone.
  173. X.LP
  174. XThe final tutorial,
  175. X.IR "Tricks and Timesavers" ,
  176. Xis less a tutorial than a description of common
  177. X.B vi
  178. Xcommands which don't fit correctly into normal
  179. X.B vi
  180. Xlogic.
  181. X.SH SEE ALSO
  182. X.BR vi (1).
  183. X.SH BUGS
  184. XStill doesn't cover variables,
  185. X.B ex
  186. Xcommands, or tags. At least one more tutorial is necessary for a
  187. Xcomplete introduction to
  188. X.BR vi .
  189. END_OF_FILE
  190. if test 1207 -ne `wc -c <'vilearn-1.0/vilearn.man'`; then
  191.     echo shar: \"'vilearn-1.0/vilearn.man'\" unpacked with wrong size!
  192. fi
  193. # end of 'vilearn-1.0/vilearn.man'
  194. fi
  195. if test -f 'vilearn-1.0/vilearn.sh' -a "${1}" != "-c" ; then 
  196.   echo shar: Will not clobber existing file \"'vilearn-1.0/vilearn.sh'\"
  197. else
  198. echo shar: Extracting \"'vilearn-1.0/vilearn.sh'\" \(3100 characters\)
  199. sed "s/^X//" >'vilearn-1.0/vilearn.sh' <<'END_OF_FILE'
  200. X#!/bin/sh
  201. X#
  202. X# Copyright (c) 1992 Jill Kliger and Wesley Craig.  All Rights Reserved.
  203. X#
  204. X# Permission to use, copy, modify, and distribute this software and its
  205. X# documentation for any purpose and without fee is hereby granted,
  206. X# provided that the above copyright notice appears in all copies and that
  207. X# the copyright notice, this permission notice, and an explicit record of
  208. X# any local changes, appear in supporting documentation.  This software
  209. X# is supplied as is without expressed or implied warranties of any kind.
  210. X#
  211. X
  212. XTUTORIALS=:TUTORIALS:
  213. X
  214. XTUTORIAL=
  215. X
  216. Xecho "The following tutorials are available:"
  217. Xecho
  218. X
  219. Xecho -n "    Tutorial 1 -- Basic Editing"
  220. Xif [ -f ${HOME}/VILEARN/1basics ]; then
  221. X    echo " (previously viewed)"
  222. Xelse
  223. X    echo
  224. Xfi
  225. X
  226. Xecho -n "    Tutorial 2 -- Moving Efficiently"
  227. Xif [ -f ${HOME}/VILEARN/2moving ]; then
  228. X    echo " (previously viewed)"
  229. Xelse
  230. X    echo
  231. Xfi
  232. X
  233. Xecho -n "    Tutorial 3 -- Cutting and Pasting"
  234. Xif [ -f ${HOME}/VILEARN/3cutpaste ]; then
  235. X    echo " (previously viewed)"
  236. Xelse
  237. X    echo
  238. Xfi
  239. X
  240. Xecho -n "    Tutorial 4 -- Inserting Techniques"
  241. Xif [ -f ${HOME}/VILEARN/4inserting ]; then
  242. X    echo " (previously viewed)"
  243. Xelse
  244. X    echo
  245. Xfi
  246. X
  247. Xecho -n "    Tutorial 5 -- Tricks and Timesavers"
  248. Xif [ -f ${HOME}/VILEARN/5tricks ]; then
  249. X    echo " (previously viewed)"
  250. Xelse
  251. X    echo
  252. Xfi
  253. X
  254. Xecho
  255. Xecho "You will be editing your own copy of the tutorial. Enter the number"
  256. Xecho -n "of the tutorial you'd like to see (or q to quit): "
  257. X
  258. Xwhile [ x$TUTORIAL = x ]; do
  259. X    read _ans
  260. X    case "$_ans" in
  261. X    [qQ]*)
  262. X        echo "You lose. Thanks for playing."
  263. X        exit
  264. X        ;;
  265. X
  266. X    *[0-9][0-9]*)
  267. X        echo "No sir, didn't like it."
  268. X        echo -n "Type 1, 2, 3, 4, 5, or q: "
  269. X        ;;
  270. X
  271. X    *1*|*[Bb]asic*)
  272. X        TUTORIAL=1basics
  273. X        ;;
  274. X
  275. X    *2*|*[Mm]ov*)
  276. X        TUTORIAL=2moving
  277. X        ;;
  278. X
  279. X    *3*|*[Cc]ut*|*[Pp]ast*)
  280. X        TUTORIAL=3cutpaste
  281. X        EXTRA=3temp
  282. X        ;;
  283. X
  284. X    *4*|*[Ii]sert*)
  285. X        TUTORIAL=4inserting
  286. X        ;;
  287. X
  288. X    *5*|*[Tt]rick*)
  289. X        TUTORIAL=5tricks
  290. X        ;;
  291. X
  292. X    *)
  293. X        echo "No sir, didn't like it."
  294. X        echo -n "Type 1, 2, 3, 4, 5, or q: "
  295. X        ;;
  296. X
  297. X    esac
  298. Xdone
  299. X
  300. Xif [ ! -d ${HOME}/VILEARN ]; then
  301. X    mkdir ${HOME}/VILEARN
  302. Xfi
  303. X
  304. Xif [ -f ${HOME}/VILEARN/${TUTORIAL} ]; then
  305. X    echo
  306. X    echo "There is already a copy of the tutorial in your home directory."
  307. X    echo -n "Would you like a fresh copy of the tutorial? "
  308. X    read _ans
  309. X    if [ `expr x"${_ans}" : 'x[Yy].*'` -ne 0 ]; then
  310. X    echo "Copying tutorial..."
  311. X    rm -f ${HOME}/VILEARN/${TUTORIAL}
  312. X    cp ${TUTORIALS}/${TUTORIAL} ${HOME}/VILEARN/${TUTORIAL}
  313. X    chmod +w ${HOME}/VILEARN/${TUTORIAL}
  314. X    if [ x${EXTRA} != x ]; then
  315. X        rm -f ${HOME}/VILEARN/${EXTRA}
  316. X        cp ${TUTORIALS}/${EXTRA} ${HOME}/VILEARN/${EXTRA}
  317. X        chmod +w ${HOME}/VILEARN/${EXTRA}
  318. X    fi
  319. X    sleep 2
  320. X    else
  321. X    echo "Using existing tutorial..."
  322. X    sleep 2
  323. X    fi
  324. Xelse
  325. X    echo "Copying tutorial..."
  326. X    cp ${TUTORIALS}/${TUTORIAL} ${HOME}/VILEARN/${TUTORIAL}
  327. X    chmod +w ${HOME}/VILEARN/${TUTORIAL}
  328. X    if [ x${EXTRA} != x ]; then
  329. X    cp ${TUTORIALS}/${EXTRA} ${HOME}/VILEARN/${EXTRA}
  330. X    chmod +w ${HOME}/VILEARN/${EXTRA}
  331. X    fi
  332. X    sleep 2
  333. Xfi
  334. X
  335. Xcd ${HOME}/VILEARN; vi ${TUTORIAL}
  336. X
  337. Xecho
  338. Xecho "Here endeth the lesson."
  339. Xexit 0
  340. END_OF_FILE
  341. if test 3100 -ne `wc -c <'vilearn-1.0/vilearn.sh'`; then
  342.     echo shar: \"'vilearn-1.0/vilearn.sh'\" unpacked with wrong size!
  343. fi
  344. # end of 'vilearn-1.0/vilearn.sh'
  345. fi
  346. if test -f 'vilearn-1.0/outline' -a "${1}" != "-c" ; then 
  347.   echo shar: Will not clobber existing file \"'vilearn-1.0/outline'\"
  348. else
  349. echo shar: Extracting \"'vilearn-1.0/outline'\" \(1160 characters\)
  350. sed "s/^X//" >'vilearn-1.0/outline' <<'END_OF_FILE'
  351. X
  352. X*
  353. X* tutorial 1        FILENAME:  1basics
  354. X*    basics
  355. X*
  356. X
  357. X^D    down
  358. X^U    up
  359. X
  360. Xh    left
  361. Xj    down
  362. Xk    up
  363. Xl    right
  364. X
  365. Xdd    delete line
  366. Xx    x-out character
  367. X
  368. Xu    undo
  369. X
  370. X:q!    force quit
  371. XZZ    good bye
  372. X
  373. Xo    open
  374. Xi    insert
  375. X
  376. X*
  377. X* tutorial 2        FILENAME:  2moving
  378. X*    objects, finds & marks
  379. X*
  380. X
  381. Xw W    word
  382. Xb B    back
  383. Xe E    end
  384. X
  385. X{ }    paragraph
  386. X( )    sentence
  387. X[ ]    sections
  388. X
  389. X$    end of line
  390. X^    first non-white
  391. X|    column
  392. X0    beginning of line
  393. X
  394. Xf F    find
  395. Xt T    to
  396. X;    repeat fFtT
  397. X,    reverse fFtT
  398. X
  399. XG    goto
  400. X
  401. XH    high
  402. XM    middle
  403. XL    low
  404. X
  405. Xn N    next
  406. X? /    regex
  407. X
  408. X%    match
  409. X
  410. X'    move to marked line
  411. Xm    mark
  412. X
  413. X
  414. X*
  415. X* tutorial 3        FILENAME:  3cutpaste & 3temp
  416. X*
  417. X*    cutting, pasting, buffers, and files
  418. X*
  419. X
  420. Xd D    deletes
  421. Xy Y    yank
  422. Xp P    put
  423. X"    buffer
  424. X:e    edit
  425. X
  426. X*
  427. X* tutorial 4        FILENAME: 4inserting
  428. X*    insertion
  429. X*
  430. X
  431. Xa A    append
  432. Xc C    change
  433. Xi I    insert
  434. Xo O    open
  435. Xr R    replace
  436. Xs S    substitute
  437. X
  438. XJ    join
  439. X
  440. X*
  441. X* tutorial 5        FILENAME: 5tricks
  442. X*    tricks
  443. X*
  444. X
  445. X~    case
  446. X
  447. Xu U    undo
  448. X
  449. X.    do again
  450. X
  451. X^B    back
  452. X^F    forward
  453. X^E    down line
  454. X^Y    up line
  455. Xz    zero
  456. X
  457. X^G    status
  458. X^L    refresh
  459. X
  460. X^Z    suspend
  461. X
  462. X^T    pop tag        proposed
  463. X^]    follow tag    proposed
  464. X
  465. X!    command
  466. X
  467. X< >    shift
  468. X
  469. X*
  470. X* tutorial 6        PROPOSED
  471. X*    commands from hell
  472. X*
  473. X
  474. X:    colon commands
  475. XQ    quit
  476. X^R    redraw
  477. X@    execute buffer as macro
  478. X&    like :&
  479. X
  480. X^T    shift (insert)
  481. X^D    unshift (insert)
  482. END_OF_FILE
  483. if test 1160 -ne `wc -c <'vilearn-1.0/outline'`; then
  484.     echo shar: \"'vilearn-1.0/outline'\" unpacked with wrong size!
  485. fi
  486. # end of 'vilearn-1.0/outline'
  487. fi
  488. if test -f 'vilearn-1.0/1basics' -a "${1}" != "-c" ; then 
  489.   echo shar: Will not clobber existing file \"'vilearn-1.0/1basics'\"
  490. else
  491. echo shar: Extracting \"'vilearn-1.0/1basics'\" \(5941 characters\)
  492. sed "s/^X//" >'vilearn-1.0/1basics' <<'END_OF_FILE'
  493. Xvi tutorial #1: The Basics 
  494. X
  495. XThis lesson lasts 10-15 minutes and teaches simple editing.  Lines
  496. Xwhich begin with  >>>  mark exercises you should try.  When you
  497. Xwant to exit this tutorial type     ZZ  (type capital Z, twice).
  498. X
  499. XWhen you type commands in vi they do not appear on the screen.    If the
  500. Xletters you type unexpectedly appear on the screen, press the ESCAPE key.
  501. X
  502. X
  503. XBASIC CURSOR MOVEMENT 
  504. X---------------------
  505. XTo move through the tutorial use ^D (control d) and ^U (control u).
  506. X
  507. X    ^D    Move DOWN one half-screen
  508. X        (depress the control key and type d)
  509. X
  510. X    ^U    Move UP one half-screen
  511. X        (depress the control key and type u)
  512. X
  513. X>>> Now type ^D (control d) and ^U (control u) to move down and back up.
  514. X
  515. XWhen you are done reading a screen, you are expected to type ^D to move
  516. Xdown to the next screen.  You must remember to type ^D throughout the
  517. Xtutorial.
  518. X
  519. XTo move the cursor line by line, or character by character, use the
  520. Xfour keys h, j, k, and l.
  521. X
  522. X    h    Move left one character
  523. X    j    Move down one line
  524. X    k    Move up one line
  525. X    l    Move right one character
  526. X
  527. XYou will notice that these keys are in a straight line on the
  528. Xkeyboard.  Study the diagram below showing the function of h, j, k, l.
  529. X
  530. X                       UP
  531. X        .......      .......   .......   .......
  532. X        :     :      :    :   :      :   :        :
  533. X      LEFT    :  h  :      :  j    :   :  k  :   :     l  :  RIGHT
  534. X        :.....:      :.....:   :.....:   :.....:
  535. X               DOWN
  536. X
  537. X>>> Now type  j     or  k    a few times to bring the cursor to this line.
  538. X
  539. X>>> Try moving off the right end of a line using  l .  Notice that
  540. X>>> vi will not allow you to move off the end of the line using     l .
  541. X>>> Likewise, you cannot use  h     and  l     on a blank line.
  542. X
  543. X>>> Try moving past the bottom of the screen using  j . Notice how
  544. X>>> how the screen scrolls downward.
  545. X
  546. X>>> Now practice using    k  to move up, and  h  to move left.
  547. X
  548. X
  549. XDELETION
  550. X--------
  551. XTo delete characters and lines, use x and dd.
  552. X
  553. X    x    X-OUT one character
  554. X    dd    DELETE one line
  555. X
  556. XTo undo your changes, use u.
  557. X
  558. X    u    UNDO last change only
  559. X
  560. X>>> Delete this SCRAP line. Move to this line with  j or k , now type  dd .
  561. X>>> Try undoing the deletion with  u .
  562. X
  563. X>>> Move to this line and x-out the Y's with  x : "whY ask whY?"
  564. X
  565. X>>> Try undoing the deletion with  u . Try typing  u  several times. 
  566. X>>> Notice that     u  only undoes the last change.
  567. X
  568. XHere are more lines on which to practice deleting and undoing (use: dd x u )
  569. X
  570. X    Emacs is an evil creation. Emacs is an evil creation.
  571. X    Emacs is an evil creation. Emacs is an evil creation.
  572. X    Emacs is an evil creation. Emacs is an evil creation.
  573. X
  574. X
  575. XQUIT COMMANDS
  576. X-------------
  577. X(DO NOT QUIT the tutorial at this time.)
  578. X
  579. XTo quit a file without saving any changes you have made (for instance,
  580. Xwith the  dd  or  x  commands) use  :q!<RETURN> . To quit and save your
  581. Xchanges, use  ZZ .  When you are editing your own files, you normally
  582. Xuse  ZZ     to quit.
  583. X
  584. X :q!<RETURN>    QUIT without saving changes
  585. X        (type a colon, then the letter q, then an
  586. X        exclamation point, and press RETURN)
  587. X
  588. X    ZZ    Exit and save any changes
  589. X        (type capital Z, twice)
  590. X
  591. X
  592. XINSERTION
  593. X---------
  594. XYou enter insert mode with  i  or  o . Anything you type during insert
  595. Xmode appears on the screen.  When you are done inserting, press ESC
  596. Xto exit insert mode.  Type  ^[ (control [ ), if you do not have an ESC key.
  597. X
  598. X    o    OPEN a line for inserting text
  599. X    i    INSERT starting at the cursor
  600. X
  601. X    ESC    ESCAPE from insert mode
  602. X
  603. XDuring insert mode, use your erase character (usually backspace or
  604. Xdelete) to delete mistakes. The characters you delete will remain on
  605. Xthe screen until you press ESC.     
  606. X
  607. X>>> Insert your name and phone number below the next blank line. To do this:
  608. X>>>    Open a line below using     o . 
  609. X>>>    Type your first and last name. Press RETURN. 
  610. X>>>    Then type your phone number and press ESC.
  611. X>>>    Use  x    to erase part of your phone number.
  612. X
  613. X>>> Type the date below your phone number. To do this:
  614. X>>>    Open another line using     o . 
  615. X>>>    Type the date and press ESC.  
  616. X
  617. X>>> Type  u  to undo the insertion.
  618. X
  619. X>>> Insert a nickname between your first and last names, using i. To do this:
  620. X>>>    Move the cursor to the spot between your names using  h, j, k, l.
  621. X>>>    Press  i . 
  622. X>>>    Type the nickname, use DELETE or BACKSPACE to erase any typos.
  623. X>>>    Then press ESC.     
  624. X
  625. XOn some computers, a line may be longer than the width of the screen.
  626. XThis means that a very long line may appear to be two lines on the
  627. Xscreen.  This happens when you keep typing without pressing RETURN at
  628. Xthe edge of the screen. To avoid any confusion when you're inserting
  629. Xtext, be sure to press RETURN before reaching the right edge of the
  630. Xscreen.
  631. X
  632. X
  633. XFILE BASICS
  634. X-----------
  635. XTo edit a file using vi, at the UNIX command line, type:
  636. X
  637. X    vi filename
  638. X
  639. Xwhere "filename" is the name of the file you want to edit.  When you
  640. Xuse vi to edit a file that does not exist, the file is not immediately
  641. Xcreated.  The file is created the first time you save it, until then it
  642. Xonly exists in temporary space.     If you make a mistake typing the name
  643. Xof a file, just use  :q!<RETURN>  to abandon the new file.
  644. X
  645. X
  646. XSUMMARY       
  647. X-------       
  648. XThese are the vi commands you should know after tutorial #1:
  649. X
  650. X    ^D    Move DOWN one half-screen
  651. X        (depress the control key and type d)
  652. X
  653. X    ^U    Move UP one half-screen
  654. X        (depress the control key and type u)
  655. X
  656. X    h    Move left one character
  657. X    j    Move down one line
  658. X    k    Move up one line
  659. X    l    Move right one character
  660. X
  661. X    dd    DELETE one line
  662. X    x    X-OUT one character
  663. X
  664. X    u    UNDO last change
  665. X
  666. X :q!<RETURN>    QUIT without saving changes
  667. X        (type a colon, then the letter q, then an
  668. X        exclamation point, and press RETURN)
  669. X
  670. X    ZZ    Exit and save any changes
  671. X        (type capital Z, twice)
  672. X
  673. X    o    OPEN a line for inserting text
  674. X    i    INSERT starting at the cursor
  675. X
  676. X    ESC    ESCAPE from insert mode
  677. X
  678. Xand to use vi from a UNIX command line:
  679. X
  680. X    vi filename
  681. X
  682. X
  683. XYou are now prepared to do simple editing on your own files.  Practice
  684. Xusing vi for a few days.  Then take the second vi tutorial to learn
  685. Xmore powerful and useful vi commands.
  686. X
  687. XCopyright (c) 1992 Jill Kliger and Wesley Craig.  All Rights Reserved.
  688. END_OF_FILE
  689. if test 5941 -ne `wc -c <'vilearn-1.0/1basics'`; then
  690.     echo shar: \"'vilearn-1.0/1basics'\" unpacked with wrong size!
  691. fi
  692. # end of 'vilearn-1.0/1basics'
  693. fi
  694. if test -f 'vilearn-1.0/2moving' -a "${1}" != "-c" ; then 
  695.   echo shar: Will not clobber existing file \"'vilearn-1.0/2moving'\"
  696. else
  697. echo shar: Extracting \"'vilearn-1.0/2moving'\" \(9001 characters\)
  698. sed "s/^X//" >'vilearn-1.0/2moving' <<'END_OF_FILE'
  699. Xvi tutorial #2: Moving Through Files Efficiently
  700. X
  701. XThis lesson lasts 15-20 minutes.  The material taught here is used in
  702. Xtutorial #3: Cutting and Pasting.  Lines which begin with  >>>  mark
  703. Xexercises you should try.  When you want to exit this tutorial type  ZZ  .
  704. X
  705. X
  706. XWORDS
  707. X-----
  708. XThere are many ways to move from one word to another. Consider these:
  709. X
  710. X        w       Move to the beginning of the next WORD
  711. X        e       Move to the END of the next word
  712. X        b       Move BACK to the beginning to the previous word
  713. X
  714. XFor  w, e, and b,  a word is delimited by any non-alphanumeric
  715. Xcharacter. The capitalized versions,  W, E, and B,  also move from word
  716. Xto word. The difference is that for  W, E, and B,  a word is delimited
  717. Xby any blank space.
  718. X
  719. X>>>  Try out  w, b, e,  on the lines provided below.
  720. X>>>  Next practice using  B, W, b, E  on the lines provided below.
  721. X
  722. X    EX-PER-IMENT on these lines;test moving back &forth.
  723. X    EX-PER-IMENT on these lines;test moving back &forth.
  724. X
  725. X
  726. XON THE LINE
  727. X-----------
  728. XYou can move immediately to any point on the current line.
  729. X
  730. X        $       Move to the end of the line
  731. X        ^       Move to the first non-white character on the line
  732. X
  733. X    0       Move to the first column on the line (column zero)
  734. X    #|      Move to an exact column on the line (column #) e.g.  5| 12|
  735. X
  736. X>>>  Experiment with  $  and  ^  on the line provided below.  Notice
  737. X>>>  that  ^  moves to the first non-white character, not the beginning.
  738. X
  739. X    This is a PRACTICE LINE.  There is white space at the front.  END
  740. X
  741. X0 (zero) will always take you to the far left edge of the screen.
  742. X
  743. X#| (number vertical-bar) is for moving to an explicit column on a line.
  744. XJust type any number 1-80 and press  | . For example:  5|   20|   30|
  745. XNote that you can't move beyond the last column on a line.
  746. X
  747. X
  748. XFINDING CHARACTERS
  749. X------------------
  750. XOften you want to move to a specific letter or character on a line.
  751. X
  752. X    f char    FIND the next occurrence of char on the line
  753. X    t char    Move 'TIL the next occurrence of char on the line
  754. X
  755. X    F char    FIND the previous occurrence of char on the line
  756. X    T char    Move 'TIL the previous occurrence of char on the line
  757. X
  758. X    ;    Repeat the last  f, t, F, or T
  759. X    ,    Reverse the last  f, t, F, or T
  760. X
  761. Xf and F land on the character.  t and T land next to the character.
  762. Xf and t move forward, while F and T move backward.
  763. X
  764. XIf the specified character is not on the line, vi will beep.
  765. X
  766. X>>>  Move to the beginning of the line below, and try out these commands:
  767. X>>>    fe  fE  ;  ;  ,  ,  t@  TP  te  tE  ,  ;  ,  ;
  768. X
  769. X    "PRACTICE line?" "Each and Every?" "Find thE char@cter and move to it.END
  770. X
  771. X
  772. XMATCHING
  773. X--------
  774. Xvi has a handy way to determine if (), {}, and [] pairs match up.
  775. X
  776. X    %       Show matching () or {} or []
  777. X
  778. X>>>  On the practice lines below, move your cursor over a (,),{,},[, or ].
  779. X>>>  Then type  %  .
  780. X
  781. X    [TRY THIS.  ((Whether) the pairs match up is the question.)  [One] 
  782. X    pair is incomplete].  Can you tell {which one? ]} END
  783. X
  784. X
  785. XWINDOW POSITIONS
  786. X----------------
  787. XYou can move the cursor to the top, middle, or bottom of the vi window.
  788. X
  789. X    H    Move to the HIGHEST position in the window
  790. X    M    Move to the MIDDLE position in the window
  791. X    L    Move to the LOWEST position in the window
  792. X
  793. X>>>  Try out these commands:  type  H  then  M  and  L  and then  M  again.
  794. X
  795. X
  796. XMARKING LOCATIONS
  797. X-----------------
  798. XYou can mark positions in the file and return to them.
  799. X
  800. X     m char     MARK this location and name it char
  801. X     ' char     (quote character) return to line named char
  802. X     ''         (quote quote) return from last movement
  803. X
  804. Xchar can be any lower case letter, a-z.  A mark persists until you:
  805. X     1) use the same char to mark another location
  806. X  or 2) delete the marked line
  807. X
  808. X>>>  Move to this line and type  ma  to mark it  a
  809. X>>>  Move to this line and type  mb  to mark it  b
  810. X>>>  Move to this line and type  mz  to mark it  z
  811. X>>>  Type  'a  to return to line  a
  812. X>>>  Type  'b  to return to line  b
  813. X>>>  Type  'z  to return to line  z
  814. X
  815. XCertain commands can move you large distances. These commands cause
  816. Xyour last position to be remembered in the special mark named ' (quote).
  817. XTo move to this special mark, just type '' (quote quote).
  818. X
  819. X>>>  Try this:  'b  to return to line b, and then  ''  to return here.
  820. X
  821. X
  822. XGO TO A LINE
  823. X------------
  824. X
  825. X         G      GO to the last line in the file
  826. X        #G      GO to line #.  (e.g., 3G , 5G , 124G )
  827. X
  828. XRead these directions carefully:
  829. X>>>  Type  1G  to go to the top of the file, and then  ''  (quote quote)
  830. X>>>  to return here.
  831. X>>>  Now try  G  to go to the end of the file, and then  ''  to return here.
  832. X
  833. X
  834. XBLOCKS OF TEXT
  835. X--------------
  836. XIt is often convenient to move through files jumping from one block of
  837. Xtext to the next.  To do this use braces and parentheses:
  838. X
  839. X    {    (left brace) Move to the beginning of a paragraph
  840. X        }    (right brace) Move to the end of a paragraph
  841. X
  842. X        (    (left paren) Move to the beginning of a sentence
  843. X        )    (right paren) Move to the beginning of the next sentence
  844. X
  845. X>>>  Experiment with  }  and  {  on the two paragraphs provided below.
  846. X>>>  Note that paragraphs are separated by a blank line.
  847. X
  848. X    EXPERIMENT on this first paragraph.  The quick brown fox jumped
  849. X    over the seven lazy dogs.  The fox must have been very large to
  850. X    jump over seven dogs!
  851. X
  852. X    EXPERIMENT on this second paragraph.  The quick brown dog
  853. X    jumped over the seven lazy foxes.  The dog didn't have to be nearly
  854. X    as large, since foxes aren't too big.
  855. X
  856. X>>>  Try out  )  and  (  on the two paragraphs provided above.
  857. X>>>  Notice that sentences are separated by two blank spaces.
  858. X
  859. XC programmers find it useful to move by sections, since sections may be
  860. Xdelimited by a left brace in the first column.  By placing the opening
  861. Xbrace of a C subroutine in the first column, you can move to the top of
  862. Xthe next subroutine, using [[ and  ]] .
  863. X
  864. X        [[      Move to the beginning of a section
  865. X        ]]      Move to the end of a section
  866. X
  867. XNote that if vi does not find a left brace at the far left, it will
  868. Xmove to the top or bottom of the file.
  869. X
  870. X>>>  Now try  ]]  then  ]]  and  [[  on the subroutines provided below:
  871. X
  872. Xmain()
  873. X{
  874. X    helloworld();
  875. X}
  876. X
  877. Xhelloworld()
  878. X{
  879. X    printf( "Hello world\n" );
  880. X}
  881. X
  882. X
  883. XSEARCHING
  884. X---------
  885. XThis enables you to jump to the next occurrence of a string in a file.
  886. XTo initially find the string use:
  887. X
  888. X    /string     Find string looking forward
  889. X    ?string     Find string looking backward
  890. X
  891. XTo find additional occurrences of the string type:
  892. X
  893. X    n     Repeat last / or ? command
  894. X    N     Reverse last / or ? command
  895. X
  896. Xvi may search past the bottom of the file and then start again at the top. 
  897. X(Or, vi may search past the top and then start again at the bottom.)
  898. X
  899. X>>>  You are going to search for a string, find the next three
  900. X>>>  occurrences.  Then flip directions and find the string until you
  901. X>>>  return to this location.  To do this:
  902. X>>>      Type   /the   then press RETURN.  
  903. X>>>     Type  n  three times.
  904. X>>>     Type  N  until you return to this location.
  905. X
  906. X
  907. XSUMMARY
  908. X-------
  909. X
  910. X        w       Move to the beginning of the next WORD
  911. X        e       Move to the END of the next word
  912. X        b       Move BACK to the beginning to the previous word
  913. X
  914. X        $       Move to the end of the line
  915. X        ^       Move to the first non-white character on the line
  916. X
  917. X    0       Move to the first column on the line (column zero)
  918. X    #|      Move to an exact column on the line (column #) e.g.  5| 12|
  919. X
  920. X    f char    FIND the next occurrence of char on the line
  921. X    t char    Move 'TIL the next occurrence of char on the line
  922. X
  923. X    F char    FIND the previous occurrence of char on the line
  924. X    T char    Move 'TIL the previous occurrence of char on the line
  925. X
  926. X    ;    Repeat the last  f, t, F, or T
  927. X    ,    Reverse the last  f, t, F, or T
  928. X
  929. X    %       Show matching () or {} or []
  930. X
  931. X    H    Move to the HIGHEST position in the window
  932. X    M    Move to the MIDDLE position in the window
  933. X    L    Move to the LOWEST position in the window
  934. X
  935. X    m char    MARK this location and name it char
  936. X    ' char    (quote character) return to line named char
  937. X    ''        (quote quote) return from last movement
  938. X
  939. X         G      GO to the last line in the file
  940. X        #G      GO to line #.  (e.g., 3G , 5G , 175G )
  941. X
  942. X    {    (left brace) Move to the beginning of a paragraph
  943. X        }    (right brace) Move to the end of a paragraph
  944. X
  945. X        (    (left paren) Move to the beginning of a sentence
  946. X        )    (right paren) Move to the beginning of the next sentence
  947. X
  948. X        [[      Move to the beginning of a section
  949. X        ]]      Move to the end of a section
  950. X
  951. X    /string     Find string looking forward
  952. X    ?string     Find string looking backward
  953. X
  954. X    n     Repeat last / or ? command
  955. X    N     Reverse last / or ? command
  956. X
  957. XYou should now be able to move around files very efficiently.  These
  958. Xcommands are especially useful if you are using vi over a slow modem.
  959. XPractice the material in this lesson for a few days and then take
  960. Xeither the third vi tutorial to learn how to copy, cut, and paste, or
  961. Xthe forth vi tutorial to learn additional insertion techniques.
  962. X
  963. XCopyright (c) 1992 Jill Kliger and Wesley Craig.  All Rights Reserved.
  964. END_OF_FILE
  965. if test 9001 -ne `wc -c <'vilearn-1.0/2moving'`; then
  966.     echo shar: \"'vilearn-1.0/2moving'\" unpacked with wrong size!
  967. fi
  968. # end of 'vilearn-1.0/2moving'
  969. fi
  970. if test -f 'vilearn-1.0/3cutpaste' -a "${1}" != "-c" ; then 
  971.   echo shar: Will not clobber existing file \"'vilearn-1.0/3cutpaste'\"
  972. else
  973. echo shar: Extracting \"'vilearn-1.0/3cutpaste'\" \(11082 characters\)
  974. sed "s/^X//" >'vilearn-1.0/3cutpaste' <<'END_OF_FILE'
  975. Xvi tutorial #3: Copying, Cutting, and Pasting
  976. X
  977. XThis lesson lasts 15-20 minutes.  This tutorial assumes full knowledge
  978. Xof tutorial #1, and familiarity with tutorial #2.  Lines which begin
  979. Xwith  >>>  mark exercises you should try.
  980. X
  981. XWhen you want to exit this tutorial type  ZZ  to exit and save your
  982. Xchanges.  Or type  :q!<RETURN>  to exit without saving changes.
  983. XRemember that typing  u  will UNDO your last change.
  984. X
  985. X
  986. XCUTTING TEXT
  987. X------------
  988. XThe delete command can be combined with any of the movement commands
  989. Xtaught throughout tutorial #2.  The resulting command is of the form:
  990. X
  991. X    dmovement    DELETE to where the movement command specifies
  992. X
  993. XConsider the following examples:
  994. X
  995. X    dw    DELETE to the beginning of the next WORD
  996. X    d$    DELETE to the end of the line
  997. X    d)    DELETE to the beginning of the next sentence 
  998. X    dte    DELETE 'TIL the next  e
  999. X    dd    DELETE a line (dd is a special case of the d command)
  1000. X
  1001. X>>>  Experiment with  dw  d$  d)  dte  dd  on the paragraph provided below:
  1002. X
  1003. X    PRACTICE here.  Now is the time for all good users to learn the
  1004. X    editor.  The quick brown fox jumped over the seven lazy fish.  Now
  1005. X    is the time for all good users to learn the editor.  The quick
  1006. X    brown computer jumped over the seven lazy users.  END PRACTICE
  1007. X
  1008. X
  1009. XPASTING TEXT
  1010. X------------
  1011. XWhen text is deleted it is put into a buffer which contains the most
  1012. Xrecently deleted text.  To paste the contents of this buffer elsewhere
  1013. Xin the file use the  p  or  P  command.
  1014. X
  1015. X    P    (upper p) PUT the contents of the buffer before the cursor
  1016. X    p    (lower p) PUT the contents of the buffer after the cursor
  1017. X
  1018. X>>>  Try this sequence of commands on the practice lines below:
  1019. X>>>      dd      to delete one line
  1020. X>>>    j    to move down a line
  1021. X>>>    p    (lower p) to PUT the deleted text after the cursor
  1022. X>>>    }    to move to the end of the paragraph
  1023. X>>>    P    (upper p) to PUT the deleted text before the cursor
  1024. X
  1025. X    PRACTICE line.  Cut and Paste this line to the bottom of the
  1026. X    paragraph.  Here is some filler, feel free to cut and paste the
  1027. X    text in this practice region.  Remember that  u  undoes the last
  1028. X    action.  END OF PRACTICE
  1029. X
  1030. X>>>  Try this sequence of commands at the beginning of a word:
  1031. X>>>    dw  w  P
  1032. X
  1033. XThe fastest way to swap two letters is to type:  xp
  1034. X
  1035. X>>>  Use  xp  to correct the misspelled words below:
  1036. X
  1037. X    PRACTICE.  Thier weird quiet recieved an inconvenient shriek.
  1038. X    Thier belief is that to recieve grief from nieghbors outwieghs
  1039. X    all else.  Biege skies lead to wierd science.  END.
  1040. X
  1041. X
  1042. XNUMBERING
  1043. X---------
  1044. XConsider cutting and pasting 3 words.  Based on previous exercises you
  1045. Xwould type  dw , move to the new location, and type  p , and repeat
  1046. Xthis procedure twice more.  There is an easier way to do this:
  1047. X
  1048. X>>>  Using the practice lines below, try the following sequence of commands:
  1049. X>>>    Move to the beginning of the first sentence.
  1050. X>>>    Type  d3w  to DELETE 3 WORDS.
  1051. X>>>    Type  w  to move ahead one WORD. 
  1052. X>>>    Type  P  (upper p) to PUT the three words before the cursor.
  1053. X
  1054. X    PRACTICE Numbering vi commands is easy to do.  Now is the time for
  1055. X    all good users to learn the editor.  The quick brown fox jumped
  1056. X    over the seven lazy dogs.  Numbering vi commands is easy to do.
  1057. X    Now is the time for all good users to learn the editor. END PRACTICE
  1058. X
  1059. X>>>  Type  d2d  to DELETE 2 lines, using the practice paragraph above.
  1060. X>>>  Move to the top of the paragraph.
  1061. X>>>  Type  p  (lower p) to PUT the two lines after of the cursor.
  1062. X
  1063. XNumbering also works for movement commands.
  1064. X
  1065. X>>>  Now try  4w  to move ahead 4 WORDs, on the lines provided above.  
  1066. X>>>  Then use  3b  to move BACK 3 words.
  1067. X
  1068. XWhen you type  4w  THINK "4 words", when you type  d4w  think "delete 4
  1069. Xwords".  In general, we can write
  1070. X
  1071. X    #movement    repeat movement # times
  1072. X    d#movement    DELETE to where the  #movement  command specifies
  1073. X
  1074. X
  1075. XCOPYING TEXT
  1076. X------------
  1077. XThe YANK command works just like the DELETE command, except  y  is used
  1078. Xinstead of  d  .
  1079. X
  1080. X    ymovement    YANK to where the movement command specifies
  1081. X
  1082. XYANK and DELETE are identical except that YANK only copies the specified
  1083. Xtext into the buffer.
  1084. X
  1085. X>>>  Try this sequence of commands on the practice lines below:
  1086. X>>>      yy      to YANK a line (yy is a special case of the y command)
  1087. X>>>    3j    to move down 3 lines
  1088. X>>>    p    (lower p) to PUT the yanked text after the cursor
  1089. X
  1090. X    PRACTICE line.  Copy and Paste this line to the bottom of the
  1091. X    paragraph.  Here is some filler, feel free to copy and paste the
  1092. X    text in this practice region.  Remember that  u  undoes the last
  1093. X    action.  END OF PRACTICE
  1094. X
  1095. XPlease note that copy, cutting, and pasting large blocks of text may
  1096. Xsignificantly alter the tutorial file.  Remember that you can always get
  1097. Xa new copy of the tutorial file and that  u  UNDOes your last change.
  1098. X
  1099. XHere are some examples which show the similarity between  y  and  d .
  1100. X
  1101. X    yw    YANK to the beginning of the next WORD
  1102. X    y$    YANK to the end of the line
  1103. X    y)    YANK to the beginning of the next sentence 
  1104. X    yte    YANK 'TIL the next  e
  1105. X    yy    YANK a line 
  1106. X
  1107. XHere are some more examples using commands from tutorial #2.
  1108. X
  1109. X    yL    YANK from here to the lowest point of the window
  1110. X    y/and    YANK from here to the word "and"
  1111. X    y2}    YANK 2 paragraphs
  1112. X    y'a    YANK from here to the marked line "a" (mark line first)
  1113. X
  1114. X>>>  Experiment with  yw  yte  y4w  y2}  y3y  and  y$  on the paragraph
  1115. X>>>  provided below.  Copy text AND use  p  or  P  to paste it.
  1116. X
  1117. X    PRACTICE line.  Copy and Paste this line to the bottom of the
  1118. X    paragraph.  Here is some filler, feel free to copy and paste
  1119. X    the text in this practice region.  Remember that  u  undoes the
  1120. X        last action.  END OF PRACTICE
  1121. X
  1122. X
  1123. XNUMBERED BUFFERS
  1124. X----------------
  1125. XIn all of the previous pasting exercises you've used the "un-named"
  1126. Xbuffer.  The un-named buffer contains the text you most recently cut or
  1127. Xcopied.  When you make a new cut or copy, the old contents of the
  1128. Xun-named buffer are moved to one of the "numbered" buffers.  The
  1129. Xbuffers are numbered 1-9.  Each time you cut or copy text,
  1130. X
  1131. X    vi saves your current cut or copy in a buffer #1  
  1132. X    vi saves your 2nd to last cut or copy in a buffer #2  
  1133. X    The cut or copy before that is saved in a buffer #3 ...  
  1134. X    vi saves your 8th oldest cut or copy in a buffer #8
  1135. X    vi saves your 9th oldest cut or copy in a buffer #9
  1136. X
  1137. XNote that buffer #1 is the same as the un-named buffer.  Here's how to
  1138. Xpaste from the numbered buffers:
  1139. X
  1140. X    "#P    (upper p) PUT contents of buffer # before the cursor
  1141. X    "#p    (lower p) PUT contents of buffer # after the cursor
  1142. X
  1143. XFor example:
  1144. X
  1145. X    "1p    PUT buffer 1 after the cursor
  1146. X    "7p    PUT buffer 7 after the cursor
  1147. X
  1148. X>>>  Delete this 1st line with  dd
  1149. X>>>  Delete this 2nd line with  dd
  1150. X>>>  Delete this 3rd block with  d2d
  1151. X>>>    (2nd half of block 3)
  1152. X>>>  Delete this 4th block with  dd
  1153. X>>>  Now type   "1p   "2p   "3p   "4p
  1154. X
  1155. XIf you are using vi and have made accidental deletions, just PUT the
  1156. Xcontents of each numbered buffer to recover the deleted text.
  1157. X
  1158. X
  1159. XNAMED BUFFERS
  1160. X-------------
  1161. Xvi maintains the un-named and numbered buffers automatically.  You can
  1162. Xmaintain your own buffers named a-z.  That is, you can cut or copy text
  1163. Xinto buffer x and later paste the text from buffer x.
  1164. X
  1165. X    "aDELETE    DELETE text into buffer a
  1166. X    "aYANK    YANK text into buffer a
  1167. X    "aPUT    PUT text from buffer a
  1168. X
  1169. XNote, don't actually type 'DELETE', 'YANK', or 'PUT'; type one of the
  1170. XDELETE commands, YANK commands, or PUT commands.  See the examples below:
  1171. X
  1172. X    "ad}        DELETE paragraph into buffer a
  1173. X    "by3y        YANK 3 lines into buffer b
  1174. X    "cy200G        YANK to line 200 into buffer c
  1175. X    "dp        PUT buffer d  after the cursor
  1176. X    "zP        PUT buffer z  before the cursor
  1177. X
  1178. XThe contents of a named buffer are lost if:
  1179. X     1) you store new text in a buffer with the same name
  1180. X  or 2) you quit vi (using  ZZ  or  :q!<RETURN>  )
  1181. X
  1182. X>>>  Delete this START line into buffer a  by typing  "add
  1183. X>>>  Paste buffer a  by typing  "ap
  1184. X
  1185. X>>>  Delete this INTERMEDIATE line into buffer b  by typing  "bdd
  1186. X>>>  Paste buffer b  by typing  "bp
  1187. X
  1188. XTo put new material into buffer a
  1189. X>>>  Delete this FINAL line into buffer a  by typing  "add
  1190. X>>>  Paste buffer a  by typing  "ap  
  1191. X
  1192. X
  1193. XSAVING WITHOUT QUITTING
  1194. X-----------------------
  1195. XWith  ZZ  you save changes and quit vi.  With :w  you can save and not
  1196. Xquit vi.  It is a safe practice to save changes to a file regularly.
  1197. XThis reduces re-typing in the event your computer crashes.
  1198. X
  1199. X    :w<RETURN>    WRITE contents of the file (without quitting)
  1200. X        (type a colon, type w , then press the RETURN key)
  1201. X
  1202. X>>>  Try  :w  now.  Note the message at the bottom of the screen.
  1203. X
  1204. X
  1205. XPASTING BETWEEN FILES
  1206. X---------------------
  1207. XThis is an extremely useful procedure in vi.  Only one new command is
  1208. Xrequired for pasting between files, the EDIT command
  1209. X
  1210. X    :e filename<RETURN>    Begin EDITing the file called "filename"
  1211. X
  1212. XThe EDIT command allows you to edit another file without quitting vi.
  1213. XThis is useful since named buffers are lost when you quit vi.
  1214. X
  1215. XLet's say you want to copy 6 lines from the file called "3temp" into
  1216. Xthis file which is named "3cutpaste": 
  1217. X(Note that "3temp" has already been created for you)
  1218. X
  1219. X    1) WRITE "3cutpaste".  vi will not allow    :w (press RETURN)
  1220. X    you to edit another file without first
  1221. X    saving any changes you've made.
  1222. X
  1223. X    2) EDIT "3temp" without quitting vi.    :e 3temp (press RETURN)
  1224. X
  1225. X    3) YANK 6 lines from "3temp".        "ay6y
  1226. X
  1227. X    4) Return to "3cutpaste".            :e 3cutpaste (press RETURN)
  1228. X
  1229. X    5) PUT from buffer a            "ap
  1230. X
  1231. XNote that the un-named and numbered buffers are lost when the EDIT
  1232. Xcommand is used.  Only named buffers are preserved with EDIT.
  1233. X
  1234. X>>>  Follow the 5-step procedure outlined above.  Don't be concerned
  1235. X>>>  with remembering all 5 steps, the instructions are repeated in
  1236. X>>>  "3temp".  Paste the text from "3temp" near this line of this file,
  1237. X>>>  "3cutpaste".
  1238. X
  1239. XYou can use this 5-step procedure on any two files, with any cutting or
  1240. Xcopying action (here, y6y is the example).
  1241. X
  1242. X
  1243. XSUMMARY
  1244. X-------
  1245. X
  1246. X    #movement    repeat movement # times
  1247. X
  1248. X    dmovement    DELETE to where "movement" command specifies
  1249. X    d#movement    DELETE to where the  #movement  command specifies
  1250. X        (e.g.  dw  d3w )
  1251. X
  1252. X    ymovement    YANK to where "movement" command specifies
  1253. X    y#movement    YANK to where the  #movement  command specifies
  1254. X        (e.g.  yw  y3w )
  1255. X
  1256. X    P    (upper p) PUT the contents of the buffer before the cursor
  1257. X    p    (lower p) PUT the contents of the buffer after the cursor
  1258. X
  1259. X    "#P    (upper p) PUT contents of buffer # before the cursor
  1260. X    "#p    (lower p) PUT contents of buffer # after the cursor
  1261. X        (e.g.  "2p  "7P )
  1262. X
  1263. X    "aDELETE    DELETE text into buffer a
  1264. X    "aYANK    YANK text into buffer a
  1265. X    "aPUT    PUT text from named buffer a
  1266. X        (Note, don't actually type 'DELETE', 'YANK', or 'PUT';
  1267. X        type one of the DELETE commands, YANK commands, or PUT
  1268. X        commands, e.g.  "ad}  "by3y  "cy200G  "dp  "zP  )
  1269. X
  1270. X    :w<RETURN>    WRITE contents of the file (without quitting)
  1271. X        (type a colon, type w , then press the RETURN key)
  1272. X
  1273. X    :e filename<RETURN>    Begin EDITing the file called "filename"
  1274. X
  1275. X
  1276. XYou are now prepared to handle all cutting, copying and pasting tasks
  1277. Xwhich may arise.  If you practice what you've learned you'll find editing
  1278. Xin vi to be fast and convenient.
  1279. X
  1280. XCopyright (c) 1992 Jill Kliger and Wesley Craig.  All Rights Reserved.
  1281. END_OF_FILE
  1282. if test 11082 -ne `wc -c <'vilearn-1.0/3cutpaste'`; then
  1283.     echo shar: \"'vilearn-1.0/3cutpaste'\" unpacked with wrong size!
  1284. fi
  1285. # end of 'vilearn-1.0/3cutpaste'
  1286. fi
  1287. if test -f 'vilearn-1.0/3temp' -a "${1}" != "-c" ; then 
  1288.   echo shar: Will not clobber existing file \"'vilearn-1.0/3temp'\"
  1289. else
  1290. echo shar: Extracting \"'vilearn-1.0/3temp'\" \(531 characters\)
  1291. sed "s/^X//" >'vilearn-1.0/3temp' <<'END_OF_FILE'
  1292. XHere are the instructions again.  You are currently reading "3temp".
  1293. XYou have already accomplished step 1 and step 2.
  1294. X--------------------------------------------------------------------
  1295. X
  1296. X    1) WRITE "3cutpaste".  vi will not allow    :w (press RETURN)
  1297. X    you to edit another file without first
  1298. X    saving any changes you've made.
  1299. X
  1300. X    2) EDIT "3temp" without quitting vi.    :e 3temp (press RETURN)
  1301. X
  1302. X    3) YANK 6 lines from "3temp".        "ay6y
  1303. X
  1304. X    4) Return to "3cutpaste".            :e 3cutpaste (press RETURN)
  1305. X
  1306. X    5) PUT from buffer a            "ap
  1307. END_OF_FILE
  1308. if test 531 -ne `wc -c <'vilearn-1.0/3temp'`; then
  1309.     echo shar: \"'vilearn-1.0/3temp'\" unpacked with wrong size!
  1310. fi
  1311. # end of 'vilearn-1.0/3temp'
  1312. fi
  1313. if test -f 'vilearn-1.0/4inserting' -a "${1}" != "-c" ; then 
  1314.   echo shar: Will not clobber existing file \"'vilearn-1.0/4inserting'\"
  1315. else
  1316. echo shar: Extracting \"'vilearn-1.0/4inserting'\" \(5442 characters\)
  1317. sed "s/^X//" >'vilearn-1.0/4inserting' <<'END_OF_FILE'
  1318. Xvi tutorial #4: Insertion Techniques
  1319. X
  1320. XThis lesson lasts 5-10 minutes.  This tutorial assumes full knowledge
  1321. Xof tutorial #1, and familiarity with tutorial #2.  Lines which begin
  1322. Xwith  >>>  mark exercises you should try.  When you want to exit this
  1323. Xtutorial type  ZZ .
  1324. X
  1325. X
  1326. XSIMPLE INSERTION
  1327. X----------------
  1328. XYou spend most of your time in vi inserting text.  As you might expect,
  1329. Xthere are several commands to begin insertion.
  1330. X
  1331. X    o    OPEN a line below the cursor
  1332. X    O    OPEN a line above the cursor
  1333. X
  1334. X    i    INSERT starting before the cursor
  1335. X    I    INSERT at the beginning of the line
  1336. X
  1337. X    a    APPEND starting after the cursor
  1338. X    A    APPEND at the end of the line
  1339. X
  1340. XRemember to type ESC to leave insert mode.  If you don't have an ESC key
  1341. Xtype  ^[ (control [ ).
  1342. X
  1343. X    ESC    ESCAPE from insert mode
  1344. X
  1345. X>>>  Move the cursor to this line.  Type  O  , enter your name.  Press ESC.
  1346. X>>>  Next type  o  , enter the date.  Press ESC.
  1347. X
  1348. XNote that  O  opens the line above and puts you in insert mode, 
  1349. Xwhile  o  opens the line below and also puts you in insert mode.
  1350. X
  1351. X>>>  Type  a  on any line above, enter your name.  Press ESC.  Do the
  1352. X>>>  same for  A.
  1353. X
  1354. X>>>  Read the following.  Your goal is to take the sentence fragment below:
  1355. X
  1356. X    BROWN FOX  OVER THE SEVEN LAZY
  1357. X
  1358. X>>>  and convert it to
  1359. X
  1360. X    THE QUICK BROWN FOX JUMPED OVER THE SEVEN LAZY DOGS.
  1361. X
  1362. X>>>  To do this type:
  1363. X>>>    I  to insert  THE QUICK  (then press ESC)
  1364. X>>>    move the cursor to after the X in FOX
  1365. X>>>    a  to insert  JUMPED   (then press ESC)
  1366. X>>>    A  to insert  DOGS.  (then press ESC)
  1367. X>>>  Now move to the sentence fragment and make the changes outlined above.
  1368. X
  1369. X
  1370. XJOINING LINES
  1371. X-------------
  1372. XOften it is convenient to join two short lines into one line.  There
  1373. Xare several ways to do this.  The easiest is the  J  command.  Other
  1374. Xmethods will be explored in tutorial #5.
  1375. X
  1376. X    J    JOIN two lines
  1377. X
  1378. X>>>  Go to the first line in the block below.  Type J.  Type J again.
  1379. X
  1380. X    Example: NOW IS THE TIME 
  1381. X    the walrus said
  1382. X    TO THINK OF MANY THINGS
  1383. X
  1384. XIn the event that joining lines creates a line which exceeds the width
  1385. Xof the screen, you can break the line by typing  i  and pressing RETURN.
  1386. X
  1387. X
  1388. XSUBSTITUTING TEXT
  1389. X-----------------
  1390. XSubstituting combines the delete command and the insert command into a
  1391. Xsingle step.
  1392. X
  1393. X    #s    SUBSTITUTE for # characters
  1394. X    #S    SUBSTITUTE for # whole lines
  1395. X
  1396. X
  1397. XIn order to substitute text you have to know how much text you want to
  1398. Xdelete.  Consider the following examples:
  1399. X
  1400. X    3s    SUBSTITUTE the next 3 characters for what will be typed
  1401. X    7s    SUBSTITUTE the next 7 characters for what will be typed
  1402. X
  1403. X>>>  Change the SAMPLE DEFINITION below.  To do this:
  1404. X>>>    move the cursor to the T in TWO
  1405. X>>>    type  3s
  1406. X>>>    type  FOUR  then press ESC
  1407. X
  1408. X     SAMPLE DEFINITION:  A string quartet is defined to be
  1409. X                         a group of TWO musicians.
  1410. X
  1411. X
  1412. XREPLACING TEXT
  1413. X--------------
  1414. XThe  r  and  R  commands allow you to directly type over existing text.
  1415. X
  1416. X    r    REPLACE character (NO need to press ESC)
  1417. X    R    enter over-type mode 
  1418. X
  1419. X>>>  Correct each of the TYPOs on the sample line below.  To do this:
  1420. X>>>    move the cursor to the misspelled character
  1421. X>>>    type  r
  1422. X>>>    type  the correct character
  1423. X
  1424. X     SAMPLE: maintanence  conveniance  complience  applience  dilagent
  1425. X
  1426. X>>>  Use the over-type command,  R  ,  on the sample line above.  
  1427. X>>>  Type  R  then type the name of a local restaurant.  Press ESC.
  1428. X
  1429. X
  1430. XCHANGING TEXT
  1431. X-------------
  1432. XThe change command combines insertion, deletion, and the movement
  1433. Xcommands. (Recall that the movement commands were taught in tutorial
  1434. X#2.)  Change is probably more useful than replace or substitute.  The
  1435. Xgeneral form of the change command is:
  1436. X
  1437. X    cmovement    CHANGE to where the movement command specifies
  1438. X
  1439. XConsider the following examples:
  1440. X
  1441. X    cw    CHANGE to the beginning of the next WORD
  1442. X    c$    CHANGE to the end of the line
  1443. X    c)    CHANGE to the beginning of the next sentence 
  1444. X    cte    CHANGE 'TIL the next  e
  1445. X    c3w    CHANGE the next 3 WORDS
  1446. X    cc    CHANGE a line (cc is a special case of the c command)
  1447. X    c}    CHANGE to the end of the paragraph
  1448. X
  1449. X>>>  Follow these steps:
  1450. X>>>     1.  move to the desired location in the practice paragraph below
  1451. X>>>     2.  type cw  (change to the beginning of the next WORD)
  1452. X>>>     3.  type your name 
  1453. X>>>     4.  press ESC
  1454. X
  1455. X    PRACTICE here.  Now is the time for all good users to learn the
  1456. X    editor.  The quick red fox jumped over the seven lazy fish.  Now
  1457. X    is the time for all good users to learn the editor.  The quick
  1458. X    brown computer jumped over the seven lazy users.  END PRACTICE
  1459. X
  1460. X>>>  Experiment by using a variety of options for step #2.  Try
  1461. X>>>  out   c$  c)  cte  c3w  cc  c}   on the practice paragraph above.
  1462. X
  1463. XNote that the change command follows the same pattern as the delete
  1464. Xand yank commands which were explored in tutorial #3.
  1465. X
  1466. X
  1467. XSUMMARY
  1468. X-------
  1469. X
  1470. X    o    OPEN a line below the cursor
  1471. X    O    OPEN a line above the cursor
  1472. X
  1473. X    i    INSERT starting before the cursor
  1474. X    I    INSERT at the beginning of the line
  1475. X
  1476. X    a    APPEND starting after the cursor
  1477. X    A    APPEND at the end of the line
  1478. X
  1479. X    ESC    ESCAPE from insert mode
  1480. X
  1481. X    J    JOIN two lines
  1482. X
  1483. X    #s    SUBSTITUTE for # characters
  1484. X    #S    SUBSTITUTE for # whole lines
  1485. X
  1486. X    r    REPLACE character (NO need to press ESC)
  1487. X    R    enter over-type mode
  1488. X
  1489. X    cmovement    CHANGE to where the movement commands specifies 
  1490. X        (e.g.  c3w  c$  cc )
  1491. X
  1492. X
  1493. XThese commands should improve your ability to insert text efficiently.
  1494. XThe next tutorials deal with advanced commands and tricks which can
  1495. Xfurther speed up your editing.
  1496. X
  1497. XCopyright (c) 1992 Jill Kliger and Wesley Craig.  All Rights Reserved.
  1498. END_OF_FILE
  1499. if test 5442 -ne `wc -c <'vilearn-1.0/4inserting'`; then
  1500.     echo shar: \"'vilearn-1.0/4inserting'\" unpacked with wrong size!
  1501. fi
  1502. # end of 'vilearn-1.0/4inserting'
  1503. fi
  1504. if test -f 'vilearn-1.0/5tricks' -a "${1}" != "-c" ; then 
  1505.   echo shar: Will not clobber existing file \"'vilearn-1.0/5tricks'\"
  1506. else
  1507. echo shar: Extracting \"'vilearn-1.0/5tricks'\" \(9326 characters\)
  1508. sed "s/^X//" >'vilearn-1.0/5tricks' <<'END_OF_FILE'
  1509. Xvi tutorial #5: Tricks and Timesavers
  1510. X
  1511. XThis lesson lasts 10-15 minutes.  You should have a strong
  1512. Xunderstanding of tutorials #1-3 before working through these timesaving
  1513. Xtechniques.  Lines which begin with  >>>  mark exercises you should
  1514. Xtry.  When you want to exit this tutorial type  ZZ .
  1515. X
  1516. X
  1517. XCASE CONVERSION
  1518. X---------------
  1519. XWhen you want to change an upper-case character to a lower-case
  1520. Xcharacter (or lower-case to upper-case) there is a single command which
  1521. Xdoes both:
  1522. X
  1523. X    ~    (tilde) Convert case of current character
  1524. X
  1525. X>>>  Move the cursor to be OVER the first character in the example
  1526. X>>>  line below.  Press  ~  until you have changed the case of the
  1527. X>>>  entire line.  (  ~  will advance to the right automatically).
  1528. X
  1529. X    bOB WENT TO pARIS, fRANCE, TO SEE THE #1 CYCLING EVENT.  end.
  1530. X
  1531. XNote that  ~  only affects alphabetic characters.
  1532. X
  1533. X
  1534. XUNDOING
  1535. X-------
  1536. XYou have already learned the  u  command which UNDOes the last change.
  1537. XThe  U  command will undo more than one change.
  1538. X
  1539. X    U    (upper u) UNDO all changes made to the current line
  1540. X        as long as your cursor has not moved off the line
  1541. X
  1542. XThere are three rules to learn:
  1543. X
  1544. X  U  will not re-do changes you have UNDOne (e.g. by pressing  U  twice)
  1545. X  U  will not restore a line which has been deleted
  1546. X  U  will not work if you have moved off the line you changed
  1547. X
  1548. X>>>  Move the cursor to the first line of the example text.  Delete
  1549. X>>>  the words "FISH" and "RAT" from the first line.  Now type  U
  1550. X>>>  (all changes to that line should be undone).  Type  U  again
  1551. X>>>  (nothing should happen).
  1552. X
  1553. X    EXAMPLE:  The FISH fed the cat.  The RAT fed the cat.  Example
  1554. X    text is HARD to make interesting.  The man fed the BUG.  The
  1555. X    worm fed the cat.  Example text is hard to make interesting.  END.
  1556. X
  1557. X>>>  Move the cursor to the second line of the example text.  Delete
  1558. X>>>  the words "HARD" and "BUG" from the second line.  Now type  j .
  1559. X>>>  Then type  k  .  Then type  U  (nothing should happen).
  1560. X
  1561. X>>>  Delete the first line of example text using  dd  .  Then type  U
  1562. X>>>  (nothing should happen).
  1563. X
  1564. X
  1565. XREPEAT LAST COMMAND
  1566. X-------------------
  1567. XOften you want to make the same change at multiple locations in the
  1568. Xfile.  To help accomplish this, vi remembers your previous action.
  1569. X
  1570. X    .    (dot) repeat last change
  1571. X
  1572. X>>> Go through the example below changing "FISH" to "TOAD":
  1573. X>>>    Go to the "F" in the first instance of "FISH"
  1574. X>>>    To change the word:  type  cw  then type  TOAD  then press ESC
  1575. X>>>     Move the cursor to "F" in the second occurence of "FISH"
  1576. X>>>     Type  .  (dot)
  1577. X>>>     Move the cursor to "F" in the final occurence of "FISH"
  1578. X>>>     Type  .  (dot)
  1579. X>>>     Now move the cursor to each occurence of "CROW";  Type  .  (dot)
  1580. X
  1581. X    EXAMPLE:  The FISH fed the cat.  The CROW fed the cat.  Example
  1582. X    text is FISH to make interesting.  The man fed the CROW.  The
  1583. X    worm fed the FISH.  Example text is hard to make CROW.  END.
  1584. X
  1585. X>>> Go through the example above deleting all occurences of "TOAD":
  1586. X>>>     Move to the beginning of the EXAMPLE paragraph above.
  1587. X>>>     Type  /TOAD  and press RETURN (recall tutorial #2)
  1588. X>>>    Delete the word by typing  dw
  1589. X>>>     Type  n  to move to the next occurence of "TOAD"
  1590. X>>>     Type  .  (dot) to repeat the  dw  command
  1591. X>>>     Use  n.  to delete the remaining "TOAD"s
  1592. X
  1593. XNote that  .  only repeats changes, not cursor movements.
  1594. X
  1595. X
  1596. XWINDOW ACTIONS
  1597. X--------------
  1598. XYou are already familiar with the  ^U  (depress the control key and
  1599. Xtype u) and ^D  commands from tutorial #1.
  1600. X
  1601. X    ^D    Move DOWN one half-screen
  1602. X    ^U    Move UP one half-screen
  1603. X
  1604. XThere are several related commands:
  1605. X
  1606. X    ^F    Move FORWARD one full-screen
  1607. X    ^B    Move BACKWARD one full-screen
  1608. X
  1609. X    ^E    Move the window down one line without moving cursor
  1610. X    ^Y    Move the window up one line without moving cursor
  1611. X
  1612. XThe  ^E  and  ^Y  commands may seem obscure; however, notice that on
  1613. Xthe keyboard,  e and  y  are close to  d  and  u  respectively.  This
  1614. Xshould help you remember that  ^E  moves DOWN, and  ^Y  moves UP.
  1615. X
  1616. XRecall the  H  M  L  (HIGH MIDDLE LOW) window commands from Tutorial 2.
  1617. XConsider a scenario where you want to yank from the current line to a
  1618. Xline near the top of the window.  You could use  ^E  and  ^Y  to
  1619. Xposition the text in the window before you use the  yH  command.
  1620. X
  1621. XThe  z  command also moves the window without moving your cursor:
  1622. X
  1623. X    z<RETURN>    Position the current line to top of window
  1624. X    z.    Position the current line to middle of window
  1625. X    z-    Position the current line to bottom of window
  1626. X
  1627. X>>>     Move to this line.  Type  z  and press RETURN.  Notice that
  1628. X>>>     this text and the cursor have moved to the top of the window.
  1629. X>>>     Try  z-  and  z.  also.
  1630. X
  1631. X
  1632. XFILE AND DISPLAY CONTROL
  1633. X------------------------
  1634. XHere are two commands which you may need to use during a vi session but
  1635. Xdo not involve your text.
  1636. X
  1637. X    ^G    Show status of current file 
  1638. X    ^L    Refresh screen
  1639. X
  1640. XWhen you type  ^G  (depress the control key and type g) a line appears 
  1641. Xat the bottom of the window describing the current file.  The line
  1642. Xcontains:
  1643. X
  1644. X    the name of the file
  1645. X    the message "[Read only]" if the file is read only
  1646. X    the message "[Modified]" if there are unsaved changes
  1647. X    the position of the cursor in the file
  1648. X    the percentage of the file above the cursor
  1649. X
  1650. XThe  ^L  command clears and redraws your window.  This is useful when
  1651. Xsomething other than vi outputs to your window, e.g. line noise from a
  1652. Xmodem, or incoming mail.  If there is no "garbage" in your window,
  1653. Xpressing  ^L  may not do anything noticable.
  1654. X
  1655. X
  1656. XSUSPENDING VI
  1657. X-------------
  1658. XHere is a way to go back and forth between vi and the Unix command
  1659. Xline:
  1660. X
  1661. X    ^Z    Suspend this job and return to the Unix command line
  1662. X    fg    (foreground) Continue the suspended job
  1663. X
  1664. XWith this pair of commands you can SUSPEND the vi session, do something
  1665. Xfrom the Unix command line, then resume the suspended session by
  1666. Xtyping  fg  at the command line.  Note that  fg  stands for foreground.
  1667. X
  1668. XRead these instructions CAREFULLY before suspending vi.
  1669. X>>>     (Imagine you have an urge to type  ls  at the command line).
  1670. X>>>     Type  ^Z  to suspend vi.
  1671. X>>>     At the command line type  ls  and then  fg  to foreground vi.
  1672. X
  1673. XIf your shell does not support job control, e.g. /bin/sh, then the ^Z
  1674. Xcommand will beep instead of suspending vi.
  1675. X
  1676. X
  1677. XBANG COMMAND
  1678. X------------
  1679. XThe exclamation point,  !  (aka BANG), command allows you to feed text
  1680. Xto any Unix command.  The output of the Unix command replaces the
  1681. Xoriginal text.  Here is a useful Unix command to use from within vi:
  1682. X
  1683. X    !}fmt   Format the paragraph, joining and filling lines to
  1684. X        produce output lines of up to 72 characters
  1685. X
  1686. X>>>  Move to the example paragraph below. Type  !}fmt  and press
  1687. X>>>  RETURN.  Notice the paragraph will be reformatted such that
  1688. X>>>  the lines are of approximately equal length.
  1689. X
  1690. X    EXAMPLE:
  1691. X    So we grow together,
  1692. X    Like to a double cherry, seeming parted,
  1693. X    But yet an union in partition;
  1694. X    Two lovely berries moulded on one stem;
  1695. X    So, with two seeming bodies, but one heart;
  1696. X    END.
  1697. X
  1698. XAnother useful command is:
  1699. X
  1700. X       !}sort    Sort lines of a paragraph alphabetically
  1701. X
  1702. X>>>  Move to the example text below. Type  !}sort  and press RETURN.
  1703. X
  1704. X    OBERON        king of the fairies.
  1705. X    PUCK        or Robin Goodfellow.
  1706. X    HERMIA        daughter to Egeus, in love with Lysander.
  1707. X    HELENA        in love with Demetrius.
  1708. X    LYSANDER    in love with Hermia.
  1709. X    DEMETRIUS    in love with Hermia.
  1710. X
  1711. XRemember, any Unix command may be used this way.
  1712. X
  1713. X
  1714. XSHIFTING TEXT
  1715. X-------------
  1716. XIt is possible to shift large blocks of text right and left with the >
  1717. Xand  <  commands.
  1718. X
  1719. X   >movement    Shift right to where the movement command specifies
  1720. X   <movement    Shift left to where the movement command specifies
  1721. X
  1722. XThese commands work like the  d  command.  For example:
  1723. X
  1724. X    >}    Shift right to the end of the paragraph
  1725. X    <}    Shift left to the end of the paragraph
  1726. X    >>    Shift the current line right
  1727. X    <<    Shift the current line left
  1728. X
  1729. X>>>  Move the cursor to the first line of the paragraph below.
  1730. X>>>  Type  >>  and  <<  to shift the line back and forth.  Next
  1731. X>>>  try  >}  to shift the paragraph to the right, then  <}  to shift
  1732. X>>>  it left, then type  .  until all four lines start at the left edge.
  1733. X
  1734. X    THIS IS THE FIRST LINE OF EXAMPLE TEXT
  1735. X        IS
  1736. X    EXAMPLE
  1737. X        TEXT END
  1738. X
  1739. X
  1740. XSUMMARY
  1741. X-------
  1742. X
  1743. X    ~    (tilde) Convert case of current character
  1744. X
  1745. X    U    (upper u) UNDO all changes made to the current line
  1746. X        as long as your cursor has not moved off the line
  1747. X
  1748. X    .    (dot) repeat last change
  1749. X
  1750. X    ^D      Move DOWN one half-screen
  1751. X        (depress the control key and type d)
  1752. X
  1753. X    ^U      Move UP one half-screen
  1754. X        (depress the control key and type u)
  1755. X
  1756. X    ^F    Move FORWARD one full-screen
  1757. X    ^B    Move BACKWARD one full-screen
  1758. X
  1759. X    ^E    Move the window down one line without moving cursor
  1760. X    ^Y    Move the window up one line without moving cursor
  1761. X
  1762. X    z<RETURN>    Position the current line to top of window
  1763. X    z.    Position the current line to middle of window
  1764. X    z-    Position the current line to bottom of window
  1765. X
  1766. X    ^G    Show status of current file 
  1767. X    ^L    Refresh screen
  1768. X
  1769. X    !}fmt   Format the paragraph, joining and filling lines to
  1770. X        produce output lines of up to 72 characters
  1771. X
  1772. X       !}sort    Sort lines of a paragraph alphabetically
  1773. X
  1774. X   >movement    Shift right to where the movement command specifies
  1775. X   <movement    Shift left to where the movement command specifies
  1776. X
  1777. X
  1778. XThese commands should significantly speed up your editing. Have a nice
  1779. Xday.  Tutorial 6 contains even more nifty commands.
  1780. X
  1781. XCopyright (c) 1992 Jill Kliger and Wesley Craig.  All Rights Reserved.
  1782. END_OF_FILE
  1783. if test 9326 -ne `wc -c <'vilearn-1.0/5tricks'`; then
  1784.     echo shar: \"'vilearn-1.0/5tricks'\" unpacked with wrong size!
  1785. fi
  1786. # end of 'vilearn-1.0/5tricks'
  1787. fi
  1788. echo shar: End of shell archive.
  1789. exit 0
  1790.  
  1791. exit 0 # Just in case...
  1792.