home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Spezial / SPEZIAL2_97.zip / SPEZIAL2_97.iso / ANWEND / EDITOR / NVI179B / NVI179B.ZIP / docs / USD.doc / vi.ref / vi.cmd.roff < prev    next >
Text File  |  1996-08-17  |  70KB  |  3,086 lines

  1. .\" Copyright (c) 1994
  2. .\"    The Regents of the University of California.  All rights reserved.
  3. .\" Copyright (c) 1994, 1995, 1996
  4. .\"    Keith Bostic.  All rights reserved.
  5. .\"
  6. .\" See the LICENSE file for redistribution information.
  7. .\"
  8. .\"    @(#)vi.cmd.roff    8.49 (Berkeley) 8/17/96
  9. .\"
  10. .SH 1 "Vi Description"
  11. .pp
  12. .CO Vi
  13. takes up the entire screen to display the edited file,
  14. except for the bottom line of the screen.
  15. The bottom line of the screen is used to enter
  16. .CO ex
  17. commands, and for
  18. .CO vi
  19. error and informational messages.
  20. If no other information is being displayed,
  21. the default display can show the current cursor row and cursor column,
  22. an indication of whether the file has been modified,
  23. and the current mode of the editor.
  24. See the
  25. .OP ruler
  26. and
  27. .OP showmode
  28. options for more information.
  29. .pp
  30. Empty lines do not have any special representation on the screen,
  31. but lines on the screen that would logically come after the end of
  32. the file are displayed as a single tilde
  33. .PQ ~
  34. character.
  35. To differentiate between empty lines and lines consisting of only
  36. whitespace characters, use the
  37. .OP list
  38. option.
  39. Historically, implementations of
  40. .CO vi
  41. have also displayed some lines as single asterisk
  42. .PQ @
  43. characters.
  44. These were lines that were not correctly displayed, i.e. lines on the
  45. screen that did not correspond to lines in the file, or lines that did
  46. not fit on the current screen.
  47. .CO Nvi
  48. never displays lines in this fashion.
  49. .pp
  50. .CO Vi
  51. is a modeful editor, i.e. it has two modes,
  52. .QQ command
  53. mode and
  54. .QQ "text input"
  55. mode.
  56. When
  57. .CO vi
  58. first starts, it is in command mode.
  59. There are several commands that change
  60. .CO vi
  61. into text input mode.
  62. The
  63. .LI <escape>
  64. character is used to resolve the text input into the file,
  65. and exit back into command mode.
  66. In
  67. .CO vi
  68. command mode, the cursor is always positioned on the last column of
  69. characters which take up more than one column on the screen.
  70. In
  71. .CO vi
  72. text insert mode, the cursor is positioned on the first column of
  73. characters which take up more than one column on the screen.
  74. .pp
  75. When positioning the cursor to a new line and column,
  76. the type of movement is defined by the distance to the new cursor position.
  77. If the new position is close,
  78. the screen is scrolled to the new location.
  79. If the new position is far away,
  80. the screen is repainted so that the new position is on the screen.
  81. If the screen is scrolled,
  82. it is moved a minimal amount,
  83. and the cursor line will usually appear at the top or bottom of the screen.
  84. If the screen is repainted,
  85. the cursor line will appear in the center of the screen,
  86. unless the cursor is sufficiently close to the beginning or end of the file
  87. that this isn't possible.
  88. If the
  89. .OP leftright
  90. option is set, the screen may be scrolled or repainted in a horizontal
  91. direction as well as in a vertical one.
  92. .pp
  93. A major difference between the historical
  94. .CO vi
  95. presentation and
  96. .CO nvi
  97. is in the scrolling and screen oriented position commands,
  98. .CO <control-B> ,
  99. .CO <control-D> ,
  100. .CO <control-E> ,
  101. .CO <control-F> ,
  102. .CO <control-U> ,
  103. .CO <control-Y> ,
  104. .CO H ,
  105. .CO L
  106. and
  107. .CO M .
  108. In historical implementations of
  109. .CO vi ,
  110. these commands acted on physical (as opposed to logical, or screen)
  111. lines.
  112. For lines that were sufficiently long in relation to the size of the
  113. screen, this meant that single line scroll commands might repaint the
  114. entire screen, scrolling or screen positioning commands might not change
  115. the screen or move the cursor at all, and some lines simply could not
  116. be displayed, even though
  117. .CO vi
  118. would edit the file that contained them.
  119. In
  120. .CO nvi ,
  121. these commands act on logical, i.e. screen lines.
  122. You are unlikely to notice any difference unless you are editing files
  123. with lines significantly longer than a screen width.
  124. .pp
  125. .CO Vi
  126. keeps track of the currently
  127. .QQ "most attractive"
  128. cursor position.
  129. Each command description (for commands that alter the current cursor
  130. position),
  131. specifies if the cursor is set to a specific location in the line,
  132. or if it is moved to the
  133. .QQ "most attractive cursor position" .
  134. The latter means that the cursor is moved to the cursor position that
  135. is horizontally as close as possible to the current cursor position.
  136. If the current line is shorter than the cursor position
  137. .CO vi
  138. would select, the cursor is positioned on the last character in the line.
  139. (If the line is empty, the cursor is positioned on the first column
  140. of the line.)
  141. If a command moves the cursor to the most attractive position,
  142. it does not alter the current cursor position, and a subsequent
  143. movement will again attempt to move the cursor to that position.
  144. Therefore, although a movement to a line shorter than the currently
  145. most attractive position will cause the cursor to move to the end of
  146. that line, a subsequent movement to a longer line will cause the
  147. cursor to move back to the most attractive position.
  148. .pp
  149. In addition, the
  150. .CO $
  151. command makes the end of each line the most attractive cursor position
  152. rather than a specific column.
  153. .pp
  154. Each
  155. .CO vi
  156. command described below notes where the cursor ends up after it is
  157. executed.
  158. This position is described in terms of characters on the line, i.e.
  159. .QQ "the previous character" ,
  160. or,
  161. .QQ "the last character in the line" .
  162. This is to avoid needing to continually refer to on what part of the
  163. character the cursor rests.
  164. .pp
  165. The following words have special meaning for
  166. .CO vi
  167. commands.
  168. .KY "previous context"
  169. .IP "previous context"
  170. The position of the cursor before the command which caused the
  171. last absolute movement was executed.
  172. Each 
  173. .CO vi
  174. command described in the next section that is considered an
  175. absolute movement is so noted.
  176. In addition, specifying
  177. .i any
  178. address to an
  179. .CO ex
  180. command is considered an absolute movement.
  181. .KY "motion"
  182. .IP "motion"
  183. A second
  184. .CO vi
  185. command can be used as an optional trailing argument to the
  186. .CO vi
  187. .CO \&< ,
  188. .CO \&> ,
  189. .CO \&! ,
  190. .CO \&c ,
  191. .CO \&d ,
  192. .CO \&y ,
  193. and (depending on the
  194. .OP tildeop
  195. option)
  196. .CO \&~
  197. commands.
  198. This command indicates the end of the region of text that's affected by
  199. the command.
  200. The motion command may be either the command character repeated (in
  201. which case it means the current line) or a cursor movement command.
  202. In the latter case, the region affected by the command is from the
  203. starting or stopping cursor position which comes first in the file,
  204. to immediately before the starting or stopping cursor position which
  205. comes later in the file.
  206. Commands that operate on lines instead of using beginning and ending
  207. cursor positions operate on all of the lines that are wholly or
  208. partially in the region.
  209. In addition, some other commands become line oriented depending on
  210. where in the text they are used.
  211. The command descriptions below note these special cases.
  212. .sp
  213. The following commands may all be used as motion components for
  214. .CO vi
  215. commands:
  216. .sp
  217. .ne 12v
  218. .ft C
  219. .TS
  220. r r r r.
  221. <control-A>    <control-H>    <control-J>    <control-M>
  222. <control-N>    <control-P>    <space>    $
  223. %    '<character>    (    )
  224. +    ,    -    /
  225. 0    ;    ?    B
  226. E    F    G    H
  227. L    M    N    T
  228. W    [[    ]]    ^
  229. \&_    `<character>    b    e
  230. f    h    j    k
  231. l    n    t    w
  232. {    |    }
  233. .TE
  234. .ft R
  235. .sp
  236. The optional count prefix available for some of the
  237. .CO vi
  238. commands that take motion commands,
  239. or the count prefix available for the
  240. .CO vi
  241. commands that are used as motion components,
  242. may be included and is
  243. .i always
  244. considered part of the motion argument.
  245. For example, the commands
  246. .QT c2w
  247. and
  248. .QT 2cw
  249. are equivalent, and the region affected by the
  250. .CO c
  251. command is two words of text.
  252. In addition,
  253. if the optional count prefix is specified for both the
  254. .CO vi
  255. command and its motion component,
  256. the effect is multiplicative and is considered part of the motion argument.
  257. For example, the commands
  258. .QT 4cw
  259. and
  260. .QT 2c2w
  261. are equivalent, and the region affected by the
  262. .CO c
  263. command is four words of text.
  264. .KY "count"
  265. .IP "count"
  266. A positive number used as an optional argument to most commands,
  267. either to give a size or a position (for display or movement commands),
  268. or as a repeat count (for commands that modify text).
  269. The count argument is always optional and defaults to 1 unless otherwise
  270. noted in the command description.
  271. .sp
  272. When a
  273. .CO vi
  274. command synopsis shows both a
  275. .LI [buffer]
  276. and
  277. .LI [count] ,
  278. they may be presented in any order.
  279. .KY word
  280. .IP word
  281. Generally, in languages where it is applicable,
  282. .CO vi
  283. recognizes two kinds of words.
  284. First, a sequence of letters, digits and underscores,
  285. delimited at both ends by:
  286. characters other than letters, digits, or underscores,
  287. the beginning or end of a line, and the beginning or end of the file.
  288. Second, a sequence of characters other than letters, digits, underscores,
  289. or whitespace characters, delimited at both ends by: a letter, digit,
  290. underscore, or whitespace character,
  291. the beginning or end of a line, and the beginning or end of the file.
  292. For example, the characters
  293. .QT " !@#abc$%^ "
  294. contain three words:
  295. .QT "!@#" ,
  296. .QT "abc"
  297. and
  298. .QT "$%^" .
  299. .sp
  300. Groups of empty lines (or lines containing only whitespace characters)
  301. are treated as a single word.
  302. .KY "bigword"
  303. .IP "bigword"
  304. A set of non-whitespace characters preceded and followed by whitespace
  305. characters or the beginning or end of the file or line.
  306. For example, the characters
  307. .QT " !@#abc$%^ "
  308. contain one bigword:
  309. .QT "!@#abc$%^" .
  310. .sp
  311. Groups of empty lines (or lines containing only whitespace characters)
  312. are treated as a single bigword.
  313. .KY "paragraph"
  314. .IP "paragraph"
  315. An area of text that begins with either the beginning of a file,
  316. an empty line, or a section boundary, and continues until either
  317. an empty line, section boundary, or the end of the file.
  318. .sp
  319. Groups of empty lines (or lines containing only whitespace characters)
  320. are treated as a single paragraph.
  321. .sp
  322. Additional paragraph boundaries can be defined using the
  323. .OP paragraphs
  324. option.
  325. .KY "section"
  326. .IP "section"
  327. An area of text that starts with the beginning of the file or a line
  328. whose first character is an open brace
  329. .PQ {
  330. and continues until the next section or the end of the file.
  331. .sp
  332. Additional section boundaries can be defined using the
  333. .OP sections
  334. option.
  335. .KY "sentence"
  336. .IP "sentence"
  337. An area of text that begins with either the beginning of the file or the
  338. first nonblank character following the previous sentence, paragraph, or
  339. section boundary and continues until the end of the file or a period
  340. .PQ \&.
  341. exclamation point
  342. .PQ !
  343. or question mark
  344. .PQ ?
  345. character,
  346. followed by either an end-of-line or two whitespace characters.
  347. Any number of closing parentheses
  348. .PQ ) ,
  349. brackets
  350. .PQ ] ,
  351. double-quote
  352. .PQ """"
  353. or single quote
  354. .PQ '
  355. characters can appear between the period, exclamation point,
  356. or question mark and the whitespace characters or end-of-line.
  357. .sp
  358. Groups of empty lines (or lines containing only whitespace characters)
  359. are treated as a single sentence.
  360. .SH 1 "Vi Commands"
  361. .pp
  362. The following section describes the commands available in the command
  363. mode of the
  364. .CO vi
  365. editor.
  366. In each entry below, the tag line is a usage synopsis for the command
  367. character.
  368. In addition, the final line and column the cursor rests upon,
  369. and any options which affect the command are noted.
  370. .KY <control-A>
  371. .IP "[count] <control-A>"
  372. Search forward
  373. .LI count
  374. times for the current word.
  375. The current word begins at the first non-whitespace character on or
  376. after the current cursor position,
  377. and extends up to the next non-word character or the end of the line.
  378. The search is literal, i.e. no characters in the word have any special
  379. meaning in terms of Regular Expressions.
  380. It is an error if no matching pattern is found between the starting position
  381. and the end of the file.
  382. .sp
  383. The
  384. .CO <control-A>
  385. command is an absolute movement.
  386. The
  387. .CO <control-A>
  388. command may be used as the motion component of other
  389. .CO vi
  390. commands, in which case any text copied into a buffer is
  391. character oriented.
  392. .SS
  393. .SP Line:
  394. Set to the line where the word is found.
  395. .SP Column:
  396. Set to the first character of the word.
  397. .SP Options:
  398. Affected by the
  399. .OP ignorecase
  400. and
  401. .OP wrapscan
  402. options.
  403. .SE
  404. .KY <control-B>
  405. .IP "[count] <control-B>"
  406. Page backward
  407. .LI count
  408. screens.
  409. Two lines of overlap are maintained, if possible,
  410. by displaying the window starting at line
  411. .LI "(top_line - count * window_size) + 2" ,
  412. where
  413. .LI window_size
  414. is the value of the
  415. .OP window
  416. option.
  417. (In the case of split screens, this size is corrected to the
  418. current screen size.)
  419. It is an error if the movement is past the beginning of the file.
  420. .SS
  421. .SP Line:
  422. Set to the last line of text displayed on the screen.
  423. .SP Column:
  424. Set to the first nonblank character of the line.
  425. .SP Options:
  426. Affected by the
  427. .OP window
  428. option.
  429. .SE
  430. .KY <control-D>
  431. .IP "[count] <control-D>"
  432. Scroll forward
  433. .LI count
  434. lines.
  435. If
  436. .LI count
  437. is not specified, scroll forward the number of lines specified by the last
  438. .CO <control-D>
  439. or
  440. .CO <control-U>
  441. command.
  442. If this is the first
  443. .CO <control-D>
  444. or
  445. .CO <control-U>
  446. command,
  447. scroll forward half the number of lines in the screen.
  448. (In the case of split screens, the default scrolling distance is
  449. corrected to half the current screen size.)
  450. It is an error if the movement is past the end of the file.
  451. .SS
  452. .SP Line:
  453. Set to the current line plus the number of lines scrolled.
  454. .SP Column:
  455. Set to the first nonblank character of the line.
  456. .SP Options:
  457. None.
  458. .SE
  459. .KY <control-E>
  460. .IP "[count] <control-E>"
  461. Scroll forward
  462. .LI count
  463. lines, leaving the cursor on the current line and column, if possible.
  464. It is an error if the movement is past the end of the file.
  465. .SS
  466. .SP Line:
  467. Unchanged unless the current line scrolls off the screen,
  468. in which case it is set to the first line on the screen.
  469. .SP Column:
  470. Unchanged unless the current line scrolls off the screen,
  471. in which case it is set to the most attractive cursor position.
  472. .SP Options:
  473. None.
  474. .SE
  475. .KY <control-F>
  476. .IP "[count] <control-F>"
  477. Page forward
  478. .LI count
  479. screens.
  480. Two lines of overlap are maintained, if possible,
  481. by displaying the window starting at line
  482. .LI "top_line + count * window_size - 2" ,
  483. where
  484. .LI window_size
  485. is the value of the
  486. .OP window
  487. option.
  488. (In the case of split screens, this size is corrected to the
  489. current screen size.)
  490. It is an error if the movement is past the end of the file.
  491. .SS
  492. .SP Line:
  493. Set to the first line on the screen.
  494. .SP Column:
  495. Set to the first nonblank character of the current line.
  496. .SP Options:
  497. Affected by the
  498. .OP window
  499. option.
  500. .SE
  501. .KY <control-G>
  502. .IP "<control-G>"
  503. Display the file information.
  504. The information includes the current pathname, the current line,
  505. the number of total lines in the file, the current line as a percentage
  506. of the total lines in the file, if the file has been modified,
  507. was able to be locked, if the file's name has been changed,
  508. and if the edit session is read-only.
  509. .SS
  510. .SP Line:
  511. Unchanged.
  512. .SP Column:
  513. Unchanged.
  514. .SP Options:
  515. None.
  516. .SE
  517. .KY <control-H>
  518. .IP "[count] <control-H>"
  519. .Ip "[count] h"
  520. Move the cursor back
  521. .LI count
  522. characters in the current line.
  523. It is an error if the cursor is on the first character in the line.
  524. .sp
  525. The
  526. .CO <control-H>
  527. and
  528. .CO h
  529. commands may be used as the motion component of other
  530. .CO vi
  531. commands,
  532. in which case any text copied into a buffer is character oriented.
  533. .SS
  534. .SP Line:
  535. Unchanged.
  536. .SP Column:
  537. Set to the
  538. .LI "current - count"
  539. character, or, the first character in the line if
  540. .LI count
  541. is greater than or equal to the number of characters in the line
  542. before the cursor.
  543. .SP Options:
  544. None.
  545. .SE
  546. .KY <control-J>
  547. .IP "[count] <control-J>"
  548. .KY <control-N>
  549. .Ip "[count] <control-N>"
  550. .KY j
  551. .Ip "[count] j"
  552. Move the cursor down
  553. .LI count
  554. lines without changing the current column.
  555. It is an error if the movement is past the end of the file.
  556. .sp
  557. The
  558. .CO <control-J> ,
  559. .CO <control-N>
  560. and
  561. .CO j
  562. commands may be used as the motion component of other
  563. .CO vi
  564. commands, in which case any text copied into a buffer is
  565. line oriented.
  566. .SS
  567. .SP Line:
  568. Set to the current line plus
  569. .LI count .
  570. .SP Column:
  571. The most attractive cursor position.
  572. .SP Options:
  573. None.
  574. .SE
  575. .KY <control-L>
  576. .IP "<control-L>"
  577. .KY <control-R>
  578. .Ip "<control-R>"
  579. Repaint the screen.
  580. .SS
  581. .SP Line:
  582. Unchanged.
  583. .SP Column:
  584. Unchanged.
  585. .SP Options:
  586. None.
  587. .SE
  588. .KY <control-M>
  589. .IP "[count] <control-M>"
  590. .KY +
  591. .Ip "[count] +"
  592. Move the cursor down
  593. .LI count
  594. lines to the first nonblank character of that line.
  595. It is an error if the movement is past the end of the file.
  596. .sp
  597. The
  598. .CO <control-M>
  599. and
  600. .CO +
  601. commands may be used as the motion component of other
  602. .CO vi
  603. commands, in which case any text copied into a buffer is
  604. line oriented.
  605. .SS
  606. .SP Line:
  607. Set to the current line plus
  608. .LI count .
  609. .SP Column:
  610. Set to the first nonblank character in the line.
  611. .SP Options:
  612. None.
  613. .SE
  614. .KY <control-P>
  615. .IP "[count] <control-P>"
  616. .KY k
  617. .Ip "[count] k"
  618. Move the cursor up
  619. .LI count
  620. lines, without changing the current column.
  621. It is an error if the movement is past the beginning of the file.
  622. .sp
  623. The
  624. .CO <control-P>
  625. and
  626. .CO k
  627. commands may be used as the motion component of other
  628. .CO vi
  629. commands, in which case any text copied into a buffer is
  630. line oriented.
  631. .SS
  632. .SP Line:
  633. Set to the current line minus
  634. .LI count .
  635. .SP Column:
  636. The most attractive cursor position.
  637. .SP Options:
  638. None.
  639. .SE
  640. .KY <control-T>
  641. .IP "<control-T>"
  642. Return to the most recent tag context.
  643. The
  644. .CO <control-T>
  645. command is an absolute movement.
  646. .SS
  647. .SP Line:
  648. Set to the context of the previous tag command.
  649. .SP Column:
  650. Set to the context of the previous tag command.
  651. .SP Options:
  652. None.
  653. .SE
  654. .KY <control-U>
  655. .IP "[count] <control-U>"
  656. Scroll backward
  657. .LI count
  658. lines.
  659. If
  660. .LI count
  661. is not specified, scroll backward the number of lines specified by the
  662. last
  663. .CO <control-D>
  664. or
  665. .CO <control-U>
  666. command.
  667. If this is the first
  668. .CO <control-D>
  669. or
  670. .CO <control-U>
  671. command,
  672. scroll backward half the number of lines in the screen.
  673. (In the case of split screens, the default scrolling distance is
  674. corrected to half the current screen size.)
  675. It is an error if the movement is past the beginning of the file.
  676. .SS
  677. .SP Line:
  678. Set to the current line minus the amount scrolled.
  679. .SP Column:
  680. Set to the first nonblank character in the line.
  681. .SP Options:
  682. None.
  683. .SE
  684. .KY <control-W>
  685. .IP "<control-W>"
  686. Switch to the next lower screen in the window, or, to the first
  687. screen if there are no lower screens in the window.
  688. .SS
  689. .SP Line:
  690. Set to the previous cursor position in the window.
  691. .SP Column:
  692. Set to the previous cursor position in the window.
  693. .SP Options:
  694. None.
  695. .SE
  696. .KY <control-Y>
  697. .IP "[count] <control-Y>"
  698. Scroll backward
  699. .LI count
  700. lines, leaving the current line and column as is, if possible.
  701. It is an error if the movement is past the beginning of the file.
  702. .SS
  703. .SP Line:
  704. Unchanged unless the current line scrolls off the screen,
  705. in which case it is set to the last line of text displayed
  706. on the screen.
  707. .SP Column:
  708. Unchanged unless the current line scrolls off the screen,
  709. in which case it is the most attractive cursor position.
  710. .SP Options:
  711. None.
  712. .SE
  713. .KY <control-Z>
  714. .IP "<control-Z>"
  715. Suspend the current editor session.
  716. If the file has been modified since it was last completely written,
  717. and the
  718. .OP autowrite
  719. option is set, the file is written before the editor session is
  720. suspended.
  721. If this write fails, the editor session is not suspended.
  722. .SS
  723. .SP Line:
  724. Unchanged.
  725. .SP Column:
  726. Unchanged.
  727. .SP Options:
  728. Affected by the
  729. .OP autowrite
  730. option.
  731. .SE
  732. .KY <escape>
  733. .IP "<escape>"
  734. Execute
  735. .CO ex
  736. commands or cancel partial commands.
  737. If an
  738. .CO ex
  739. command is being entered (e.g.
  740. .CO / ,
  741. .CO ? ,
  742. .CO :
  743. or
  744. .CO ! ),
  745. the command is executed.
  746. If a partial command has been entered, e.g.
  747. .QT "[0-9]*" ,
  748. or
  749. .QT "[0-9]*[!<>cdy]" ,
  750. the command is cancelled.
  751. Otherwise, it is an error.
  752. .SS
  753. .SP Line:
  754. When an
  755. .CO ex
  756. command is being executed, the current line is set as described for
  757. that command.
  758. Otherwise, unchanged.
  759. .SP Column:
  760. When an
  761. .CO ex
  762. command is being executed, the current column is set as described for
  763. that command.
  764. Otherwise, unchanged.
  765. .SP Options:
  766. None.
  767. .SE
  768. .KY <control-]>
  769. .IP "<control-]>"
  770. Push a tag reference onto the tag stack.
  771. The tags files (see the
  772. .OP tags
  773. option for more information) are searched for a tag matching the
  774. current word.
  775. The current word begins at the first non-whitespace character on or
  776. after the current cursor position,
  777. and extends up to the next non-word character or the end of the line.
  778. If a matching tag is found, the current file is discarded and the
  779. file containing the tag reference is edited.
  780. .sp
  781. If the current file has been modified since it was last completely
  782. written, the command will fail.
  783. The
  784. .CO <control-]>
  785. command is an absolute movement.
  786. .SS
  787. .SP Line:
  788. Set to the line containing the matching tag string.
  789. .SP Column:
  790. Set to the start of the matching tag string.
  791. .SP Options:
  792. Affected by the
  793. .OP tags
  794. and
  795. .OP taglength
  796. options.
  797. .SE
  798. .KY <control-^>
  799. .IP "<control-^>"
  800. Switch to the most recently edited file.
  801. .sp
  802. If the file has been modified since it was last completely written,
  803. and the
  804. .OP autowrite
  805. option is set, the file is written out.
  806. If this write fails, the command will fail.
  807. Otherwise, if the current file has been modified since it was last
  808. completely written, the command will fail.
  809. .SS
  810. .SP Line:
  811. Set to the line the cursor was on when the file was last edited.
  812. .SP Column:
  813. Set to the column the cursor was on when the file was last edited.
  814. .SP Options:
  815. Affected by the
  816. .OP autowrite
  817. option.
  818. .SE
  819. .KY <space>
  820. .IP "[count] <space>"
  821. .KY l
  822. .Ip "[count] l"
  823. Move the cursor forward
  824. .LI count
  825. characters without changing the current line.
  826. It is an error if the cursor is on the last character in the line.
  827. .sp
  828. The
  829. .CO <space>
  830. and
  831. .CO \&l
  832. commands may be used as the motion component of other
  833. .CO vi
  834. commands, in which case any text copied into a buffer is
  835. character oriented.
  836. In addition, these commands may be used as the motion components
  837. of other commands when the cursor is on the last character in the
  838. line, without error.
  839. .SS
  840. .SP Line:
  841. Unchanged.
  842. .SP Column:
  843. Set to the current character plus the next
  844. .LI count
  845. characters, or to the last character on the line if
  846. .LI count
  847. is greater than the number of characters in the line after the
  848. current character.
  849. .SP Options:
  850. None.
  851. .SE
  852. .KY !
  853. .IP "[count] ! motion shell-argument(s)<carriage-return>"
  854. Replace text with results from a shell command.
  855. Pass the lines specified by the
  856. .LI count
  857. and
  858. .LI motion
  859. arguments as standard input to the program named by the
  860. .OP shell
  861. option, and replace those lines with the output (both
  862. standard error and standard output) of that command.
  863. .sp
  864. After the motion is entered,
  865. .CO vi
  866. prompts for arguments to the shell command.
  867. .sp
  868. Within those arguments,
  869. .QT %
  870. and
  871. .QT #
  872. characters are expanded to the current and alternate pathnames,
  873. respectively.
  874. The
  875. .QT !
  876. character is expanded with the command text of the previous
  877. .CO !
  878. or
  879. .CO :!
  880. commands.
  881. (Therefore, the command
  882. .CO !<motion>!
  883. repeats the previous
  884. .CO !
  885. command.)
  886. The special meanings of
  887. .QT % ,
  888. .QT #
  889. and
  890. .QT !
  891. can be overridden by escaping them with a backslash.
  892. If no
  893. .CO !
  894. or
  895. .CO :!
  896. command has yet been executed,
  897. it is an error to use an unescaped
  898. .QT !
  899. character as a shell argument.
  900. The
  901. .CO !
  902. command does
  903. .i not
  904. do shell expansion on the strings provided as arguments.
  905. If any of the above expansions change the arguments the user entered,
  906. the command is redisplayed at the bottom of the screen.
  907. .sp
  908. .CO Vi
  909. then executes the program named by the
  910. .OP shell
  911. option, with a
  912. .b \-c
  913. flag followed by the arguments (which are bundled into a single argument).
  914. .sp
  915. The
  916. .CO !
  917. command is permitted in an empty file.
  918. .sp
  919. If the file has been modified since it was last completely written,
  920. the
  921. .CO !
  922. command will warn you.
  923. .SS
  924. .SP Line:
  925. The first line of the replaced text.
  926. .SP Column:
  927. The first column of the replaced text.
  928. .SP Options:
  929. Affected by the
  930. .OP shell
  931. option.
  932. .SE
  933. .KY #
  934. .IP "[count] # #|+|-"
  935. Increment or decrement the number referenced by the cursor.
  936. If the trailing character is a
  937. .LI \&+
  938. or
  939. .LI \&# ,
  940. the number is incremented by
  941. .LI count .
  942. If the trailing character is a
  943. .LI \&- ,
  944. the number is decremented by
  945. .LI count .
  946. .sp
  947. A leading
  948. .QT \&0X
  949. or
  950. .QT \&0x
  951. causes the number to be interpreted as a hexadecimal number.
  952. Otherwise, a leading
  953. .QT \&0
  954. causes the number to be interpreted as an octal number, unless a non-octal
  955. digit is found as part of the number.
  956. Otherwise, the number is interpreted as a decimal number, and may
  957. have a leading
  958. .LI \&+
  959. or
  960. .LI \&-
  961. sign.
  962. The current number begins at the first non-blank character at or after
  963. the current cursor position, and extends up to the end of the line or
  964. the first character that isn't a possible character for the numeric type.
  965. The format of the number (e.g. leading 0's, signs) is retained unless
  966. the new value cannot be represented in the previous format.
  967. .sp
  968. Octal and hexadecimal numbers, and the result of the operation, must fit
  969. into an
  970. .QT "unsigned long" .
  971. Similarly, decimal numbers and their result must fit into a
  972. .QT "signed long" .
  973. It is an error to use this command when the cursor is not positioned at
  974. a number.
  975. .sp
  976. .SS
  977. .SP Line:
  978. Unchanged.
  979. .SP Column:
  980. Set to the first character in the cursor number.
  981. .SP Options:
  982. None.
  983. .SE
  984. .KY $
  985. .IP "[count] $"
  986. Move the cursor to the end of a line.
  987. If
  988. .LI count
  989. is specified, the cursor moves down
  990. .LI "count - 1"
  991. lines.
  992. .sp
  993. It is not an error to use the
  994. .CO $
  995. command when the cursor is on the last character in the line or
  996. when the line is empty.
  997. .sp
  998. The
  999. .CO $
  1000. command may be used as the motion component of other
  1001. .CO vi
  1002. commands, in which case any text copied into a buffer is
  1003. character oriented, unless the cursor is at, or before the first
  1004. nonblank character in the line, in which case it is line oriented.
  1005. It is not an error to use the
  1006. .CO $
  1007. command as a motion component when the cursor is on the last character
  1008. in the line, although it is an error when the line is empty.
  1009. .SS
  1010. .SP Line:
  1011. Set to the current line plus
  1012. .LI count
  1013. minus 1.
  1014. .SP Column:
  1015. Set to the last character in the line.
  1016. .SP Options:
  1017. None.
  1018. .SE
  1019. .KY %
  1020. .IP %
  1021. Move to the matching character.
  1022. The cursor moves to the parenthesis or curly brace which
  1023. .i matches
  1024. the parenthesis or curly brace found at the current cursor position
  1025. or which is the closest one to the right of the cursor on the line.
  1026. It is an error to execute the
  1027. .CO %
  1028. command on a line without a parenthesis or curly brace.
  1029. Historically, any
  1030. .LI count
  1031. specified to the
  1032. .CO %
  1033. command was ignored.
  1034. .sp
  1035. The
  1036. .CO %
  1037. command is an absolute movement.
  1038. The
  1039. .CO %
  1040. command may be used as the motion component of other
  1041. .CO vi
  1042. commands, in which case any text copied into a buffer is
  1043. character oriented, unless the starting point of the region is at
  1044. or before the first nonblank character on its line, and the ending
  1045. point is at or after the last nonblank character on its line, in
  1046. which case it is line oriented.
  1047. .SS
  1048. .SP Line:
  1049. Set to the line containing the matching character.
  1050. .SP Column:
  1051. Set to the matching character.
  1052. .SP Options:
  1053. None.
  1054. .SE
  1055. .KY &
  1056. .IP "&"
  1057. Repeat the previous substitution command on the current line.
  1058. .sp
  1059. Historically, any
  1060. .LI count
  1061. specified to the
  1062. .CO &
  1063. command was ignored.
  1064. .SS
  1065. .SP Line:
  1066. Unchanged.
  1067. .SP Column:
  1068. Unchanged if the cursor was on the last character in the line,
  1069. otherwise, set to the first nonblank character in the line.
  1070. .SP Options:
  1071. Affected by the
  1072. .OP edcompatible ,
  1073. .OP extended ,
  1074. .OP ignorecase
  1075. and
  1076. .OP magic
  1077. options.
  1078. .SE
  1079. .KY SQUOTE<character>
  1080. .IP \'<character>
  1081. .KY `<character>
  1082. .Ip `<character>
  1083. Return to a context marked by the character
  1084. .LI <character> .
  1085. If
  1086. .LI <character>
  1087. is the
  1088. .QT '
  1089. or
  1090. .QT `
  1091. character, return to the previous context.
  1092. If
  1093. .LI <character>
  1094. is any other character,
  1095. return to the context marked by that character (see the
  1096. .CO m
  1097. command for more information).
  1098. If the command is the
  1099. .CO \'
  1100. command, only the line value is restored,
  1101. and the cursor is placed on the first nonblank character of that line.
  1102. If the command is the
  1103. .CO `
  1104. command, both the line and column values are restored.
  1105. .sp
  1106. It is an error if the context no longer exists because of
  1107. line deletion.
  1108. (Contexts follow lines that are moved, or which are deleted
  1109. and then restored.)
  1110. .sp
  1111. The
  1112. .CO \'
  1113. and
  1114. .CO `
  1115. commands are both absolute movements.
  1116. They may be used as a motion component for other
  1117. .CO vi
  1118. commands.
  1119. For the
  1120. .CO \'
  1121. command, any text copied into a buffer is line oriented.
  1122. For the
  1123. .CO `
  1124. command,
  1125. any text copied into a buffer is character oriented,
  1126. unless it both starts and stops at the first character in the line,
  1127. in which case it is line oriented.
  1128. In addition, when using the
  1129. .CO `
  1130. command as a motion component,
  1131. commands which move backward and started at the first character in the line,
  1132. or move forward and ended at the first character in the line,
  1133. are corrected to the last character of the line preceding the starting and
  1134. ending lines, respectively.
  1135. .SS
  1136. .SP Line:
  1137. Set to the line from the context.
  1138. .SP Column:
  1139. Set to the first nonblank character in the line, for the
  1140. .CO \'
  1141. command, and set to the context's column for the
  1142. .CO `
  1143. command.
  1144. .SP Options:
  1145. None.
  1146. .SE
  1147. .KY (
  1148. .IP "[count] ("
  1149. Back up
  1150. .LI count
  1151. sentences.
  1152. .sp
  1153. The
  1154. .CO (
  1155. command is an absolute movement.
  1156. The
  1157. .CO (
  1158. command may be used as the motion component of other
  1159. .CO vi
  1160. commands,
  1161. in which case any text copied into a buffer is character oriented,
  1162. unless the starting and stopping points of the region are the first
  1163. character in the line,
  1164. in which case it is line oriented.
  1165. If it is line oriented,
  1166. the starting point of the region is adjusted to be the end of the line
  1167. immediately before the starting cursor position.
  1168. .SS
  1169. .SP Line:
  1170. Set to the line containing the beginning of the sentence.
  1171. .SP Column:
  1172. Set to the first nonblank character of the sentence.
  1173. .SP Options:
  1174. Affected by the
  1175. .OP lisp
  1176. option.
  1177. .SE
  1178. .KY )
  1179. .IP "[count] )"
  1180. Move forward
  1181. .LI count
  1182. sentences.
  1183. .sp
  1184. The
  1185. .CO )
  1186. command is an absolute movement.
  1187. The
  1188. .CO )
  1189. command may be used as the motion component of other
  1190. .CO vi
  1191. commands, in which case any text copied into a buffer is
  1192. character oriented, unless the starting point of the region is the
  1193. first character in the line, in which case it is line oriented.
  1194. In the latter case, if the stopping point of the region is also
  1195. the first character in the line, it is adjusted to be the end of the
  1196. line immediately before it.
  1197. .SS
  1198. .SP Line:
  1199. Set to the line containing the beginning of the sentence.
  1200. .SP Column:
  1201. Set to the first nonblank character of the sentence.
  1202. .SP Options:
  1203. Affected by the
  1204. .OP lisp
  1205. option.
  1206. .SE
  1207. .KY ,
  1208. .IP "[count] ,"
  1209. Reverse find character
  1210. .LI count
  1211. times.
  1212. Reverse the last
  1213. .CO F ,
  1214. .CO f ,
  1215. .CO T
  1216. or
  1217. .CO t
  1218. command, searching the other way in the line,
  1219. .LI count
  1220. times.
  1221. It is an error if a
  1222. .CO F ,
  1223. .CO f ,
  1224. .CO T
  1225. or
  1226. .CO t
  1227. command has not been performed yet.
  1228. .sp
  1229. The
  1230. .CO ,
  1231. command may be used as the motion component of other
  1232. .CO vi
  1233. commands, in which case any text copied into a buffer is
  1234. character oriented.
  1235. .SS
  1236. .SP Line:
  1237. Unchanged.
  1238. .SP Column:
  1239. Set to the searched-for character for the
  1240. .CO F
  1241. and
  1242. .CO f
  1243. commands,
  1244. before the character for the
  1245. .CO t
  1246. command
  1247. and after the character for the
  1248. .CO T
  1249. command.
  1250. .SP Options:
  1251. None.
  1252. .SE
  1253. .KY MINUSSIGN
  1254. .IP "[count] \-"
  1255. Move to the first nonblank of the previous line,
  1256. .LI count
  1257. times.
  1258. .sp
  1259. It is an error if the movement is past the beginning of the file.
  1260. .sp
  1261. The
  1262. .CO -
  1263. command may be used as the motion component of other
  1264. .CO vi
  1265. commands, in which case any text copied into a buffer is
  1266. line oriented.
  1267. .SS
  1268. .SP Line:
  1269. Set to the current line minus
  1270. .LI count .
  1271. .SP Column:
  1272. Set to the first nonblank character in the line.
  1273. .SP Options:
  1274. None.
  1275. .SE
  1276. .KY \&.
  1277. .IP "[count] \&."
  1278. Repeat the last
  1279. .CO vi
  1280. command that modified text.
  1281. The repeated command may be a command and motion component combination.
  1282. If
  1283. .LI count
  1284. is specified, it replaces
  1285. .i both
  1286. the count specified for the repeated command, and, if applicable, for
  1287. the repeated motion component.
  1288. If
  1289. .LI count
  1290. is not specified, the counts originally specified to the command being
  1291. repeated are used again.
  1292. .sp
  1293. As a special case, if the
  1294. .CO \.
  1295. command is executed immediately after the
  1296. .CO u
  1297. command, the change log is rolled forward or backward, depending on
  1298. the action of the
  1299. .CO u
  1300. command.
  1301. .SS
  1302. .SP Line:
  1303. Set as described for the repeated command.
  1304. .SP Column:
  1305. Set as described for the repeated command.
  1306. .SP Options:
  1307. None.
  1308. .SE
  1309. .KY /RE/
  1310. .IP "/RE<carriage-return>"
  1311. .Ip "/RE/ [offset]<carriage-return>"
  1312. .KY ?RE?
  1313. .Ip "?RE<carriage-return>"
  1314. .Ip "?RE? [offset]<carriage-return>"
  1315. .KY N
  1316. .Ip "N"
  1317. .KY n
  1318. .Ip "n"
  1319. Search forward or backward for a regular expression.
  1320. The commands beginning with a slash
  1321. .PQ /
  1322. character are forward searches, the commands beginning with a
  1323. question mark
  1324. .PQ ?
  1325. are backward searches.
  1326. .CO Vi
  1327. prompts with the leading character on the last line of the screen
  1328. for a string.
  1329. It then searches forward or backward in the file for the next
  1330. occurrence of the string, which is interpreted as a Basic Regular
  1331. Expression.
  1332. .sp
  1333. The
  1334. .CO /
  1335. and
  1336. .CO ?
  1337. commands are absolute movements.
  1338. They may be used as the motion components of other
  1339. .CO vi
  1340. commands, in which case any text copied into a buffer is
  1341. character oriented, unless the search started and ended on
  1342. the first column of a line, in which case it is line oriented.
  1343. In addition, forward searches ending at the first character of a line,
  1344. and backward searches beginning at the first character in the line,
  1345. are corrected to begin or end at the last character of the previous line.
  1346. (Note, forward and backward searches can occur for both
  1347. .CO /
  1348. and
  1349. .CO ?
  1350. commands, if the
  1351. .OP wrapscan
  1352. option is set.)
  1353. .sp
  1354. If an offset from the matched line is specified (i.e. a trailing
  1355. .QT /
  1356. or
  1357. .QT ?
  1358. character is followed by a signed offset), the buffer will always
  1359. be line oriented (e.g.
  1360. .QT /string/+0
  1361. will always guarantee a line orientation).
  1362. .sp
  1363. The
  1364. .CO N
  1365. command repeats the previous search, but in the reverse direction.
  1366. The
  1367. .CO n
  1368. command repeats the previous search.
  1369. If either the
  1370. .CO N
  1371. or
  1372. .CO n
  1373. commands are used as motion components for the 
  1374. .CO !
  1375. command, you will not be prompted for the text of the bang command,
  1376. instead the previous bang command will be executed.
  1377. .sp
  1378. Missing RE's (e.g.
  1379. .QT //<carriage-return> ,
  1380. .QT /<carriage-return> ,
  1381. .QT ??<carriage-return> ,
  1382. or
  1383. .QT ?<carriage-return>
  1384. search for the last search RE, in the indicated direction.
  1385. .sp
  1386. Searches may be interrupted using the
  1387. .LI <interrupt>
  1388. character.
  1389. .sp
  1390. Multiple search patterns may be grouped together by delimiting
  1391. them with semicolons and zero or more whitespace characters, e.g.
  1392. .LI "/foo/ ; ?bar?"
  1393. searches forward for
  1394. .LI foo
  1395. and then, from that location, backwards for
  1396. .LI bar .
  1397. When search patterns are grouped together in this manner,
  1398. the search patterns are evaluated left to right with the
  1399. final cursor position determined by the last search pattern.
  1400. .sp
  1401. It is also permissible to append a
  1402. .CO z
  1403. command to the search strings, e.g.
  1404. .LI "/foo/ z."
  1405. searches forward for the next occurrence of
  1406. .LI foo ,
  1407. and then positions that line in the middle of screen.
  1408. .SS
  1409. .SP Line:
  1410. Set to the line in which the match occurred.
  1411. .SP Column:
  1412. Set to the first character of the matched string.
  1413. .SP Options:
  1414. Affected by the
  1415. .OP edcompatible ,
  1416. .OP extended ,
  1417. .OP ignorecase ,
  1418. .OP magic ,
  1419. and
  1420. .OP wrapscan
  1421. options.
  1422. .SE
  1423. .KY 0
  1424. .IP "0"
  1425. Move to the first character in the current line.
  1426. It is not an error to use the
  1427. .CO 0
  1428. command when the cursor is on the first character in the line,
  1429. .sp
  1430. The
  1431. .CO 0
  1432. command may be used as the motion component of other
  1433. .CO vi
  1434. commands,
  1435. in which case it is an error if the cursor is on the first character
  1436. in the line,
  1437. and any text copied into a buffer is character oriented.
  1438. .SS
  1439. .SP Line:
  1440. Unchanged.
  1441. .SP Column:
  1442. Set to the first character in the line.
  1443. .SP Options:
  1444. None.
  1445. .SE
  1446. .KY :
  1447. .IP ":"
  1448. Execute an
  1449. .CO ex
  1450. command.
  1451. .CO Vi
  1452. prompts for an
  1453. .CO ex
  1454. command on the last line of the screen, using a colon
  1455. .PQ :
  1456. character.
  1457. The command is terminated by a
  1458. .LI <carriage-return> ,
  1459. .LI <newline>
  1460. or
  1461. .LI <escape>
  1462. character; all of these characters may be escaped by using a
  1463. .LI "<literal-next>"
  1464. character.
  1465. The command is then executed.
  1466. .sp
  1467. If the
  1468. .CO ex
  1469. command writes to the screen,
  1470. .CO vi
  1471. will prompt the user for a
  1472. .LI <carriage-return>
  1473. before continuing
  1474. when the
  1475. .CO ex
  1476. command finishes.
  1477. Large amounts of output from the
  1478. .CO ex
  1479. command will be paged for the user, and the user prompted for a
  1480. .LI <carriage-return>
  1481. or
  1482. .LI <space>
  1483. key to continue.
  1484. In some cases, a quit (normally a
  1485. .QQ q
  1486. character) or
  1487. .LI <interrupt>
  1488. may be entered to interrupt the
  1489. .CO ex
  1490. command.
  1491. .sp
  1492. When the
  1493. .CO ex
  1494. command finishes, and the user is prompted to resume visual mode,
  1495. it is also possible to enter another
  1496. .QT :
  1497. character followed by another
  1498. .CO ex
  1499. command.
  1500. .SS
  1501. .SP Line:
  1502. The current line is set as described for the
  1503. .CO ex
  1504. command.
  1505. .SP Column:
  1506. The current column is set as described for the
  1507. .CO ex
  1508. command.
  1509. .SP Options:
  1510. Affected as described for the
  1511. .CO ex
  1512. command.
  1513. .SE
  1514. .KY ;
  1515. .IP "[count] ;"
  1516. Repeat the last character find
  1517. .LI count
  1518. times.
  1519. The last character find is one of the
  1520. .CO F ,
  1521. .CO f ,
  1522. .CO T
  1523. or
  1524. .CO t
  1525. commands.
  1526. It is an error if a
  1527. .CO F ,
  1528. .CO f ,
  1529. .CO T
  1530. or
  1531. .CO t
  1532. command has not been performed yet.
  1533. .sp
  1534. The
  1535. .CO ;
  1536. command may be used as the motion component of other
  1537. .CO vi
  1538. commands, in which case any text copied into a buffer is
  1539. character oriented.
  1540. .SS
  1541. .SP Line:
  1542. Unchanged.
  1543. .SP Column:
  1544. Set to the searched-for character for the
  1545. .CO F
  1546. and
  1547. .CO f
  1548. commands,
  1549. before the character for the
  1550. .CO t
  1551. command
  1552. and after the character for the
  1553. .CO T
  1554. command.
  1555. .SP Options:
  1556. None.
  1557. .SE
  1558. .KY <
  1559. .IP "[count] < motion"
  1560. .KY >
  1561. .Ip "[count] > motion"
  1562. Shift lines left or right.
  1563. Shift the number of lines in the region specified by the
  1564. .LI count
  1565. and
  1566. .LI motion
  1567. left (for the
  1568. .CO <
  1569. command) or right (for the
  1570. .CO >
  1571. command) by the number of columns specified by the
  1572. .OP shiftwidth
  1573. option.
  1574. Only whitespace characters are deleted when shifting left.
  1575. Once the first character in the line no longer contains a whitespace
  1576. character, the command will succeed,
  1577. but the line will not be modified.
  1578. .SS
  1579. .SP Line:
  1580. Unchanged.
  1581. .SP Column:
  1582. Set to the first nonblank character in the line.
  1583. .SP Options:
  1584. Affected by the
  1585. .OP shiftwidth
  1586. option.
  1587. .SE
  1588. .KY @
  1589. .IP "@ buffer"
  1590. Execute a named buffer.
  1591. Execute the named buffer as
  1592. .CO vi
  1593. commands.
  1594. The buffer may include
  1595. .CO ex
  1596. commands, too, but they must be expressed as a
  1597. .CO :
  1598. command.
  1599. If the buffer is line oriented,
  1600. .LI <newline>
  1601. characters are logically appended to each line of the buffer.
  1602. If the buffer is character oriented,
  1603. .LI <newline>
  1604. characters are logically appended to all but the last line in the buffer.
  1605. .sp
  1606. If the buffer name is
  1607. .QT @ ,
  1608. or
  1609. .QT * ,
  1610. then the last buffer executed shall be used.
  1611. It is an error to specify
  1612. .QT @@
  1613. or
  1614. .QT @*
  1615. if there were no previous buffer executions.
  1616. The text of a buffer may contain a
  1617. .CO @
  1618. command,
  1619. and it is possible to create infinite loops in this manner.
  1620. (The
  1621. .LI <interrupt>
  1622. character may be used to interrupt the loop.)
  1623. .SS
  1624. .SP Line:
  1625. The current line is set as described for the command(s).
  1626. .SP Column:
  1627. The current column is set as described for the command(s).
  1628. .SP Options:
  1629. None.
  1630. .SE
  1631. .KY A
  1632. .IP "[count] A"
  1633. Enter input mode, appending the text after the end of the line.
  1634. If
  1635. .LI count
  1636. is specified, the text is repeatedly input
  1637. .LI "count - 1"
  1638. more times after input mode is exited.
  1639. .SS
  1640. .SP Line:
  1641. Set to the last line upon which characters were entered.
  1642. .SP Column:
  1643. Set to the last character entered.
  1644. .SP Options:
  1645. Affected by the
  1646. .OP altwerase ,
  1647. .OP autoindent ,
  1648. .OP beautify ,
  1649. .OP showmatch ,
  1650. .OP ttywerase
  1651. and
  1652. .OP wrapmargin
  1653. options.
  1654. .SE
  1655. .KY B
  1656. .IP "[count] B"
  1657. Move backward
  1658. .LI count
  1659. bigwords.
  1660. Move the cursor backward to the beginning of a bigword by repeating the
  1661. following algorithm: if the current position is at the beginning of a
  1662. bigword or the character at the current position cannot be part of a bigword,
  1663. move to the first character of the preceding bigword.
  1664. Otherwise, move to the first character of the bigword at the current position.
  1665. If no preceding bigword exists on the current line, move to the first
  1666. character of the last bigword on the first preceding line that contains a
  1667. bigword.
  1668. .sp
  1669. The
  1670. .CO B
  1671. command may be used as the motion component of other
  1672. .CO vi
  1673. commands, in which case any text copied into a buffer is
  1674. character oriented.
  1675. .SS
  1676. .SP Line:
  1677. Set to the line containing the word selected.
  1678. .SP Column:
  1679. Set to the first character of the word selected.
  1680. .SP Options:
  1681. None.
  1682. .SE
  1683. .KY C
  1684. .IP "[buffer] [count] C"
  1685. Change text from the current position to the end-of-line.
  1686. If
  1687. .LI count
  1688. is specified, the input text replaces from the current position to
  1689. the end-of-line, plus
  1690. .LI "count - 1"
  1691. subsequent lines.
  1692. .SS
  1693. .SP Line:
  1694. Set to the last line upon which characters were entered.
  1695. .SP Column:
  1696. Set to the last character entered.
  1697. .SP Options:
  1698. Affected by the
  1699. .OP altwerase ,
  1700. .OP autoindent ,
  1701. .OP beautify ,
  1702. .OP showmatch ,
  1703. .OP ttywerase
  1704. and
  1705. .OP wrapmargin
  1706. options.
  1707. .SE
  1708. .KY D
  1709. .IP "[buffer] D"
  1710. Delete text from the current position to the end-of-line.
  1711. .sp
  1712. It is not an error to execute the
  1713. .CO D
  1714. command on an empty line.
  1715. .SS
  1716. .SP Line:
  1717. Unchanged.
  1718. .SP Column:
  1719. Set to the character before the current character, or, column 1 if
  1720. the cursor was on column 1.
  1721. .SP Options:
  1722. None.
  1723. .SE
  1724. .KY E
  1725. .IP "[count] E"
  1726. Move forward
  1727. .LI count
  1728. end-of-bigwords.
  1729. Move the cursor forward to the end of a bigword by repeating the
  1730. following algorithm: if the current position is the end of a
  1731. bigword or the character at that position cannot be part of a bigword,
  1732. move to the last character of the following bigword.
  1733. Otherwise, move to the last character of the bigword at the current
  1734. position.
  1735. If no succeeding bigword exists on the current line,
  1736. move to the last character of the first bigword on the next following
  1737. line that contains a bigword.
  1738. .sp
  1739. The
  1740. .CO E
  1741. command may be used as the motion component of other
  1742. .CO vi
  1743. commands, in which case any text copied into a buffer is
  1744. character oriented.
  1745. .SS
  1746. .SP Line:
  1747. Set to the line containing the word selected.
  1748. .SP Column:
  1749. Set to the last character of the word selected.
  1750. .SP Options:
  1751. None.
  1752. .SE
  1753. .KY F
  1754. .IP "[count] F <character>"
  1755. Search
  1756. .LI count
  1757. times backward through the current line for
  1758. .LI <character> .
  1759. .sp
  1760. The
  1761. .CO F
  1762. command may be used as the motion component of other
  1763. .CO vi
  1764. commands, in which case any text copied into a buffer is
  1765. character oriented.
  1766. .SS
  1767. .SP Line:
  1768. Unchanged.
  1769. .SP Column:
  1770. Set to the searched-for character.
  1771. .SP Options:
  1772. None.
  1773. .SE
  1774. .KY G
  1775. .IP "[count] G"
  1776. Move to line
  1777. .LI count ,
  1778. or the last line of the file if
  1779. .LI count
  1780. not specified.
  1781. .sp
  1782. The
  1783. .CO G
  1784. command is an absolute movement.
  1785. The
  1786. .CO \&G
  1787. command may be used as the motion component of other
  1788. .CO vi
  1789. commands, in which case any text copied into a buffer is
  1790. line oriented.
  1791. .SS
  1792. .SP Line:
  1793. Set to
  1794. .LI count ,
  1795. if specified, otherwise, the last line.
  1796. .SP Column:
  1797. Set to the first nonblank character in the line.
  1798. .SP Options:
  1799. None.
  1800. .SE
  1801. .KY H
  1802. .IP "[count] H"
  1803. Move to the screen line
  1804. .LI "count - 1"
  1805. lines below the top of the screen.
  1806. .sp
  1807. The
  1808. .CO H
  1809. command is an absolute movement.
  1810. The
  1811. .CO H
  1812. command may be used as the motion component of other
  1813. .CO vi
  1814. commands, in which case any text copied into a buffer is
  1815. line oriented.
  1816. .SS
  1817. .SP Line:
  1818. Set to the line
  1819. .LI "count - 1"
  1820. lines below the top of the screen.
  1821. .SP Column:
  1822. Set to the first nonblank character of the
  1823. .i screen
  1824. line.
  1825. .SP Options:
  1826. None.
  1827. .SE
  1828. .KY I
  1829. .IP "[count] I"
  1830. Enter input mode, inserting the text at the beginning of the line.
  1831. If
  1832. .LI count
  1833. is specified, the text input is repeatedly input
  1834. .LI "count - 1"
  1835. more times.
  1836. .SS
  1837. .SP Line:
  1838. Set to the last line upon which characters were entered.
  1839. .SP Column:
  1840. Set to the last character entered.
  1841. .SP Options:
  1842. None.
  1843. .SE
  1844. .KY J
  1845. .IP "[count] J"
  1846. Join lines.
  1847. If
  1848. .LI count
  1849. is specified,
  1850. .LI count
  1851. lines are joined; a minimum of two lines are always joined,
  1852. regardless of the value of
  1853. .LI count .
  1854. .sp
  1855. If the current line ends with a whitespace character, all whitespace
  1856. is stripped from the next line.
  1857. Otherwise, if the next line starts with a open parenthesis
  1858. .PQ (
  1859. do nothing.
  1860. Otherwise, if the current line ends with a question mark
  1861. .PQ ? ,
  1862. period
  1863. .PQ \&.
  1864. or exclamation point
  1865. .PQ ! ,
  1866. insert two spaces.
  1867. Otherwise, insert a single space.
  1868. .sp
  1869. It is not an error to join lines past the end of the file,
  1870. i.e. lines that do not exist.
  1871. .SS
  1872. .SP Line:
  1873. Unchanged.
  1874. .SP Column:
  1875. Set to the character after the last character of the next-to-last
  1876. joined line.
  1877. .SP Options:
  1878. None.
  1879. .SE
  1880. .KY L
  1881. .IP "[count] L"
  1882. Move to the screen line
  1883. .LI "count - 1"
  1884. lines above the bottom of the screen.
  1885. .sp
  1886. The
  1887. .CO L
  1888. command is an absolute movement.
  1889. The
  1890. .CO L
  1891. command may be used as the motion component of other
  1892. .CO vi
  1893. commands, in which case any text copied into a buffer is
  1894. line oriented.
  1895. .SS
  1896. .SP Line:
  1897. Set to the line
  1898. .LI "count - 1"
  1899. lines above the bottom of the screen.
  1900. .SP Column:
  1901. Set to the first nonblank character of the
  1902. .i screen
  1903. line.
  1904. .SP Options:
  1905. None.
  1906. .SE
  1907. .KY  M
  1908. .IP " M"
  1909. Move to the screen line in the middle of the screen.
  1910. .sp
  1911. The
  1912. .CO M
  1913. command is an absolute movement.
  1914. The
  1915. .CO M
  1916. command may be used as the motion component of other
  1917. .CO vi
  1918. commands, in which case any text copied into a buffer is
  1919. line oriented.
  1920. .sp
  1921. Historically, any
  1922. .LI count
  1923. specified to the
  1924. .CO M
  1925. command was ignored.
  1926. .SS
  1927. .SP Line:
  1928. Set to the line in the middle of the screen.
  1929. .SP Column:
  1930. Set to the first nonblank character of the
  1931. .i screen
  1932. line.
  1933. .SP Options:
  1934. None.
  1935. .SE
  1936. .KY O
  1937. .IP "[count] O"
  1938. Enter input mode, appending text in a new line above the current line.
  1939. If
  1940. .LI count
  1941. is specified, the text input is repeatedly input
  1942. .LI "count - 1"
  1943. more times.
  1944. .sp
  1945. Historically, any
  1946. .LI count
  1947. specified to the
  1948. .CO O
  1949. command was ignored.
  1950. .SS
  1951. .SP Line:
  1952. Set to the last line upon which characters were entered.
  1953. .SP Column:
  1954. Set to the last character entered.
  1955. .SP Options:
  1956. Affected by the
  1957. .OP altwerase ,
  1958. .OP autoindent ,
  1959. .OP beautify ,
  1960. .OP showmatch ,
  1961. .OP ttywerase
  1962. and
  1963. .OP wrapmargin
  1964. options.
  1965. .SE
  1966. .KY P
  1967. .IP "[buffer] P"
  1968. Insert text from a buffer.
  1969. Text from the buffer (the unnamed buffer by default) is inserted
  1970. before the current column or, if the buffer is line oriented,
  1971. before the current line.
  1972. .SS
  1973. .SP Line:
  1974. Set to the lowest numbered line insert,
  1975. if the buffer is line oriented, otherwise unchanged.
  1976. .SP Column:
  1977. Set to the first nonblank character of the appended text,
  1978. if the buffer is line oriented, otherwise, the last character
  1979. of the appended text.
  1980. .SP Options:
  1981. None.
  1982. .SE
  1983. .KY Q
  1984. .IP "Q"
  1985. Exit
  1986. .CO vi
  1987. (or visual) mode and switch to
  1988. .CO ex
  1989. mode.
  1990. .SS
  1991. .SP Line:
  1992. Unchanged.
  1993. .SP Column:
  1994. No longer relevant.
  1995. .SP Options:
  1996. None.
  1997. .SE
  1998. .KY R
  1999. .IP "[count] R"
  2000. Enter input mode, replacing the characters in the current line.
  2001. If
  2002. .LI count
  2003. is specified, the text input is repeatedly input
  2004. .LI "count - 1"
  2005. more times.
  2006. .sp
  2007. If the end of the current line is reached, no more characters are
  2008. replaced and any further characters input are appended to the line.
  2009. .SS
  2010. .SP Line:
  2011. Set to the last line upon which characters were entered.
  2012. .SP Column:
  2013. Set to the last character entered.
  2014. .SP Options:
  2015. Affected by the
  2016. .OP altwerase ,
  2017. .OP autoindent ,
  2018. .OP beautify ,
  2019. .OP showmatch ,
  2020. .OP ttywerase
  2021. and
  2022. .OP wrapmargin
  2023. options.
  2024. .SE
  2025. .KY S
  2026. .IP "[buffer] [count] S"
  2027. Substitute
  2028. .LI count
  2029. lines.
  2030. .SS
  2031. .SP Line:
  2032. Set to the last line upon which characters were entered.
  2033. .SP Column:
  2034. Set to the last character entered.
  2035. .SP Options:
  2036. Affected by the
  2037. .OP altwerase ,
  2038. .OP autoindent ,
  2039. .OP beautify ,
  2040. .OP showmatch ,
  2041. .OP ttywerase
  2042. and
  2043. .OP wrapmargin
  2044. options.
  2045. .SE
  2046. .KY T
  2047. .IP "[count] T <character>"
  2048. Search backward,
  2049. .LI count
  2050. times,
  2051. through the current line for the character
  2052. .i after
  2053. the specified
  2054. .LI <character> .
  2055. .sp
  2056. The
  2057. .CO T
  2058. command may be used as the motion component of other
  2059. .CO vi
  2060. commands, in which case any text copied into a buffer is
  2061. character oriented.
  2062. .SS
  2063. .SP Line:
  2064. Unchanged.
  2065. .SP Column:
  2066. Set to the character
  2067. .i after
  2068. the searched-for character.
  2069. .SP Options:
  2070. None.
  2071. .SE
  2072. .KY U
  2073. .IP "U"
  2074. Restore the current line to its state before the cursor last
  2075. moved to it.
  2076. .SS
  2077. .SP Line:
  2078. Unchanged.
  2079. .SP Column:
  2080. The first character in the line.
  2081. .SP Options:
  2082. None.
  2083. .SE
  2084. .KY W
  2085. .IP "[count] W"
  2086. Move forward
  2087. .LI count
  2088. bigwords.
  2089. Move the cursor forward to the beginning of a bigword by repeating the
  2090. following algorithm: if the current position is within a bigword or the
  2091. character at that position cannot be part of a bigword, move to the first
  2092. character of the next bigword.
  2093. If no subsequent bigword exists on the current line,
  2094. move to the first character of the first bigword on the first following
  2095. line that contains a bigword.
  2096. .sp
  2097. The
  2098. .CO W
  2099. command may be used as the motion component of other
  2100. .CO vi
  2101. commands, in which case any text copied into a buffer is
  2102. character oriented.
  2103. .SS
  2104. .SP Line:
  2105. The line containing the word selected.
  2106. .SP Column:
  2107. The first character of the word selected.
  2108. .SP Options:
  2109. None.
  2110. .SE
  2111. .KY X
  2112. .IP "[buffer] [count] X"
  2113. Delete
  2114. .LI count
  2115. characters before the cursor.
  2116. If the number of characters to be deleted is greater than or equal to
  2117. the number of characters to the beginning of the line, all of the
  2118. characters before the current cursor position, to the beginning of the
  2119. line, are deleted.
  2120. .SS
  2121. .SP Line:
  2122. Unchanged.
  2123. .SP Column:
  2124. Set to the current character minus
  2125. .LI count ,
  2126. or the first character if count is greater than the number of
  2127. characters in the line before the cursor.
  2128. .SP Options:
  2129. None.
  2130. .SE
  2131. .KY Y
  2132. .IP "[buffer] [count] Y"
  2133. Copy (or
  2134. .QQ yank )
  2135. .LI count
  2136. lines into the specified buffer.
  2137. .SS
  2138. .SP Line:
  2139. Unchanged.
  2140. .SP Column:
  2141. Unchanged.
  2142. .SP Options:
  2143. None.
  2144. .SE
  2145. .KY ZZ
  2146. .IP "ZZ"
  2147. Write the file and exit
  2148. .CO vi .
  2149. The file is only written if it has been modified since the last
  2150. complete write of the file to any file.
  2151. .sp
  2152. The
  2153. .CO ZZ
  2154. command will exit the editor after writing the file,
  2155. if there are no further files to edit.
  2156. Entering two
  2157. .QQ quit
  2158. commands (i.e.
  2159. .CO wq ,
  2160. .CO quit ,
  2161. .CO xit
  2162. or
  2163. .CO ZZ )
  2164. in a row will override this check and the editor will exit,
  2165. ignoring any files that have not yet been edited.
  2166. .SS
  2167. .SP Line:
  2168. Unchanged.
  2169. .SP Column:
  2170. Unchanged.
  2171. .SP Options:
  2172. None.
  2173. .SE
  2174. .KY [[
  2175. .IP "[count] [["
  2176. Back up
  2177. .LI count
  2178. section boundaries.
  2179. .sp
  2180. The
  2181. .CO [[
  2182. command is an absolute movement.
  2183. The
  2184. .CO [[
  2185. command may be used as the motion component of other
  2186. .CO vi
  2187. commands, in which case any text copied into a buffer is
  2188. character oriented, unless the starting position is column 0,
  2189. in which case it is line oriented.
  2190. .sp
  2191. It is an error if the movement is past the beginning of the file.
  2192. .SS
  2193. .SP Line:
  2194. Set to the previous line that is
  2195. .LI count
  2196. section boundaries back,
  2197. or the first line of the file if no more section boundaries exist
  2198. preceding the current line.
  2199. .SP Column:
  2200. Set to the first nonblank character in the line.
  2201. .SP Options:
  2202. Affected by the
  2203. .OP sections
  2204. option.
  2205. .SE
  2206. .KY ]]
  2207. .IP "[count] ]]"
  2208. Move forward
  2209. .LI count
  2210. section boundaries.
  2211. .sp
  2212. The
  2213. .CO ]]
  2214. command is an absolute movement.
  2215. The
  2216. .CO ]]
  2217. command may be used as the motion component of other
  2218. .CO vi
  2219. commands, in which case any text copied into a buffer is
  2220. character oriented, unless the starting position is column 0,
  2221. in which case it is line oriented.
  2222. .sp
  2223. It is an error if the movement is past the end of the file.
  2224. .SS
  2225. .SP Line:
  2226. Set to the line that is
  2227. .LI count
  2228. section boundaries forward,
  2229. or to the last line of the file if no more section
  2230. boundaries exist following the current line.
  2231. .SP Column:
  2232. Set to the first nonblank character in the line.
  2233. .SP Options:
  2234. Affected by the
  2235. .OP sections
  2236. option.
  2237. .SE
  2238. .KY ^
  2239. .IP "\&^"
  2240. Move to first nonblank character on the current line.
  2241. .sp
  2242. The
  2243. .CO ^
  2244. command may be used as the motion component of other
  2245. .CO vi
  2246. commands, in which case any text copied into a buffer is
  2247. character oriented.
  2248. .SS
  2249. .SP Line:
  2250. Unchanged.
  2251. .SP Column:
  2252. Set to the first nonblank character of the current line.
  2253. .SP Options:
  2254. None.
  2255. .SE
  2256. .KY _
  2257. .IP "[count] _"
  2258. Move down
  2259. .LI "count - 1"
  2260. lines, to the first nonblank character.
  2261. The
  2262. .CO _
  2263. command may be used as the motion component of other
  2264. .CO vi
  2265. commands, in which case any text copied into a buffer is
  2266. line oriented.
  2267. .sp
  2268. It is not an error to execute the
  2269. .CO _
  2270. command when the cursor is on the first character in the line.
  2271. .SS
  2272. .SP Line:
  2273. The current line plus
  2274. .LI "count - 1" .
  2275. .SP Column:
  2276. The first nonblank character in the line.
  2277. .SP Options:
  2278. None.
  2279. .SE
  2280. .KY a
  2281. .IP "[count] a"
  2282. Enter input mode, appending the text after the cursor.
  2283. If
  2284. .LI count
  2285. is specified, the text input is repeatedly input
  2286. .LI "count - 1"
  2287. more times.
  2288. .SS
  2289. .SP Line:
  2290. Set to the last line upon which characters were entered.
  2291. .SP Column:
  2292. Set to the last character entered.
  2293. .SP Options:
  2294. Affected by the
  2295. .OP altwerase ,
  2296. .OP autoindent ,
  2297. .OP beautify ,
  2298. .OP showmatch ,
  2299. .OP ttywerase
  2300. and
  2301. .OP wrapmargin
  2302. options.
  2303. .SE
  2304. .KY b
  2305. .IP "[count] b"
  2306. Move backward
  2307. .LI count
  2308. words.
  2309. Move the cursor backward to the beginning of a word by repeating the
  2310. following algorithm: if the current position is at the beginning of a word,
  2311. move to the first character of the preceding word.
  2312. Otherwise, the current position moves to the first character of the word
  2313. at the current position.
  2314. If no preceding word exists on the current line, move to the first
  2315. character of the last word on the first preceding line that contains
  2316. a word.
  2317. .sp
  2318. The
  2319. .CO b
  2320. command may be used as the motion component of other
  2321. .CO vi
  2322. commands, in which case any text copied into a buffer is
  2323. character oriented.
  2324. .SS
  2325. .SP Line:
  2326. Set to the line containing the word selected.
  2327. .SP Column:
  2328. Set to the first character of the word selected.
  2329. .SP Options:
  2330. None.
  2331. .SE
  2332. .KY c
  2333. .IP "[buffer] [count] c motion"
  2334. Change the region of text specified by the
  2335. .LI count
  2336. and
  2337. .LI motion .
  2338. If only part of a single line is affected, then the last character
  2339. being changed is marked with a
  2340. .QT $ .
  2341. Otherwise, the region of text is deleted, and input mode is entered.
  2342. .SS
  2343. .SP Line:
  2344. Set to the last line upon which characters were entered.
  2345. .SP Column:
  2346. Set to the last character entered.
  2347. .SP Options:
  2348. Affected by the
  2349. .OP altwerase ,
  2350. .OP autoindent ,
  2351. .OP beautify ,
  2352. .OP showmatch ,
  2353. .OP ttywerase
  2354. and
  2355. .OP wrapmargin
  2356. options.
  2357. .SE
  2358. .KY d
  2359. .IP "[buffer] [count] d motion"
  2360. Delete the region of text specified by the
  2361. .LI count
  2362. and
  2363. .LI motion .
  2364. .SS
  2365. .SP Line:
  2366. Set to the line where the region starts.
  2367. .SP Column:
  2368. Set to the first character in the line after the last character in the
  2369. region.
  2370. If no such character exists, set to the last character before the region.
  2371. .SP Options:
  2372. None.
  2373. .SE
  2374. .KY e
  2375. .IP "[count] e"
  2376. Move forward
  2377. .LI count
  2378. end-of-words.
  2379. Move the cursor forward to the end of a word by repeating the following
  2380. algorithm: if the current position is the end of a word,
  2381. move to the last character of the following word.
  2382. Otherwise, move to the last character of the word at the current position.
  2383. If no succeeding word exists on the current line, move to the last character
  2384. of the first word on the next following line that contains a word.
  2385. .sp
  2386. The
  2387. .CO e
  2388. command may be used as the motion component of other
  2389. .CO vi
  2390. commands, in which case any text copied into a buffer is
  2391. character oriented.
  2392. .SS
  2393. .SP Line:
  2394. Set to the line containing the word selected.
  2395. .SP Column:
  2396. Set to the last character of the word selected.
  2397. .SP Options:
  2398. None.
  2399. .SE
  2400. .KY f
  2401. .IP "[count] f <character>"
  2402. Search forward,
  2403. .LI count
  2404. times, through the rest of the current line for
  2405. .LI <character> .
  2406. .sp
  2407. The
  2408. .CO f
  2409. command may be used as the motion component of other
  2410. .CO vi
  2411. commands, in which case any text copied into a buffer is
  2412. character oriented.
  2413. .SS
  2414. .SP Line:
  2415. Unchanged.
  2416. .SP Column:
  2417. Set to the searched-for character.
  2418. .SP Options:
  2419. None.
  2420. .SE
  2421. .KY i
  2422. .IP "[count] i"
  2423. Enter input mode, inserting the text before the cursor.
  2424. If
  2425. .LI count
  2426. is specified, the text input is repeatedly input
  2427. .LI "count - 1"
  2428. more times.
  2429. .SS
  2430. .SP Line:
  2431. Set to the last line upon which characters were entered.
  2432. .SP Column:
  2433. Set to the last character entered.
  2434. .SP Options:
  2435. Affected by the
  2436. .OP altwerase ,
  2437. .OP autoindent ,
  2438. .OP beautify ,
  2439. .OP showmatch ,
  2440. .OP ttywerase
  2441. and
  2442. .OP wrapmargin
  2443. options.
  2444. .SE
  2445. .KY m
  2446. .IP "m <character>"
  2447. Save the current context (line and column) as
  2448. .LI <character> .
  2449. The exact position is referred to by
  2450. .QT `<character> .
  2451. The line is referred to by
  2452. .QT '<character> .
  2453. .sp
  2454. Historically,
  2455. .LI <character>
  2456. was restricted to lower-case letters.
  2457. .CO Nvi
  2458. permits the use of any character.
  2459. .SS
  2460. .SP Line:
  2461. Unchanged.
  2462. .SP Column:
  2463. Unchanged.
  2464. .SP Options:
  2465. None.
  2466. .SE
  2467. .KY o
  2468. .IP "[count] o"
  2469. Enter input mode, appending text in a new line under the current line.
  2470. If
  2471. .LI count
  2472. is specified, the text input is repeatedly input
  2473. .LI "count - 1"
  2474. more times.
  2475. .sp
  2476. Historically, any
  2477. .LI count
  2478. specified to the
  2479. .CO o
  2480. command was ignored.
  2481. .SS
  2482. .SP Line:
  2483. Set to the last line upon which characters were entered.
  2484. .SP Column:
  2485. Set to the last character entered.
  2486. .SP Options:
  2487. Affected by the
  2488. .OP altwerase ,
  2489. .OP autoindent ,
  2490. .OP beautify ,
  2491. .OP showmatch ,
  2492. .OP ttywerase
  2493. and
  2494. .OP wrapmargin
  2495. options.
  2496. .SE
  2497. .KY p
  2498. .IP "[buffer] p"
  2499. Append text from a buffer.
  2500. Text from the buffer (the unnamed buffer by default) is appended
  2501. after the current column or, if the buffer is line oriented,
  2502. after the current line.
  2503. .SS
  2504. .SP Line:
  2505. Set to the first line appended, if the buffer is line oriented,
  2506. otherwise unchanged.
  2507. .SP Column:
  2508. Set to the first nonblank character of the appended text if the buffer
  2509. is line oriented, otherwise, the last character of the appended text.
  2510. .SP Options:
  2511. None.
  2512. .SE
  2513. .KY r
  2514. .IP "[count] r <character>"
  2515. Replace characters.
  2516. The next
  2517. .LI count
  2518. characters in the line are replaced with
  2519. .LI <character> .
  2520. Replacing characters with
  2521. .LI <newline>
  2522. characters results in creating new, empty lines into the file.
  2523. .sp
  2524. If
  2525. .LI <character>
  2526. is
  2527. .LI <escape> ,
  2528. the command is cancelled.
  2529. .SS
  2530. .SP Line:
  2531. Unchanged unless the replacement character is a
  2532. .LI <newline> ,
  2533. in which case it is set to the current line plus
  2534. .LI "count - 1" .
  2535. .SP Column:
  2536. Set to the last character replaced,
  2537. unless the replacement character is a
  2538. .LI <newline> ,
  2539. in which case the cursor is in column 1 of the last line inserted.
  2540. .SP Options:
  2541. None.
  2542. .SE
  2543. .KY s
  2544. .IP "[buffer] [count] s"
  2545. Substitute
  2546. .LI count
  2547. characters in the current line starting with the current character.
  2548. .SS
  2549. .SP Line:
  2550. Set to the last line upon which characters were entered.
  2551. .SP Column:
  2552. Set to the last character entered.
  2553. .SP Options:
  2554. Affected by the
  2555. .OP altwerase ,
  2556. .OP autoindent ,
  2557. .OP beautify ,
  2558. .OP showmatch ,
  2559. .OP ttywerase
  2560. and
  2561. .OP wrapmargin
  2562. options.
  2563. .SE
  2564. .KY t
  2565. .IP "[count] t <character>"
  2566. Search forward,
  2567. .LI count
  2568. times, through the current line for the character immediately
  2569. .i before
  2570. .LI <character> .
  2571. .sp
  2572. The
  2573. .CO t
  2574. command may be used as the motion component of other
  2575. .CO vi
  2576. commands, in which case any text copied into a buffer is
  2577. character oriented.
  2578. .SS
  2579. .SP Line:
  2580. Unchanged.
  2581. .SP Column:
  2582. Set to the character
  2583. .i before
  2584. the searched-for character.
  2585. .SP Options:
  2586. None.
  2587. .SE
  2588. .KY u
  2589. .IP "u"
  2590. Undo the last change made to the file.
  2591. If repeated, the
  2592. .CO u
  2593. command alternates between these two states, and is its own inverse.
  2594. When used after an insert that inserted text on more than one line,
  2595. the lines are saved in the numeric buffers.
  2596. .sp
  2597. The
  2598. .CO \&.
  2599. command, when used immediately after the
  2600. .CO u
  2601. command, causes the change log to be rolled forward or backward,
  2602. depending on the action of the
  2603. .CO u
  2604. command.
  2605. .SS
  2606. .SP Line:
  2607. Set to the position of the first line changed, if the reversal affects
  2608. only one line or represents an addition or change; otherwise, the line
  2609. preceding the deleted text.
  2610. .SP Column:
  2611. Set to the cursor position before the change was made.
  2612. .SP Options:
  2613. None.
  2614. .SE
  2615. .KY w
  2616. .IP "[count] w"
  2617. Move forward
  2618. .LI count
  2619. words.
  2620. Move the cursor forward to the beginning of a word by repeating the
  2621. following algorithm: if the current position is at the
  2622. beginning of a word, move to the first character of the next word.
  2623. If no subsequent word exists on the current line, move to the first
  2624. character of the first word on the first following line that contains
  2625. a word.
  2626. .sp
  2627. The
  2628. .CO w
  2629. command may be used as the motion component of other
  2630. .CO vi
  2631. commands, in which case any text copied into a buffer is
  2632. character oriented.
  2633. .SS
  2634. .SP Line:
  2635. Set to the line containing the word selected.
  2636. .SP Column:
  2637. Set to the first character of the word selected.
  2638. .SP Options:
  2639. None.
  2640. .SE
  2641. .KY x
  2642. .IP "[buffer] [count] x"
  2643. Delete
  2644. .LI count
  2645. characters.
  2646. The deletion is at the current character position.
  2647. If the number of characters to be deleted is greater than or equal to
  2648. the number of characters to the end of the line, all of the characters
  2649. from the current cursor position to the end of the line are deleted.
  2650. .SS
  2651. .SP Line:
  2652. Unchanged.
  2653. .SP Column:
  2654. Unchanged unless the last character in the line is deleted and the cursor
  2655. is not already on the first character in the line, in which case it is
  2656. set to the previous character.
  2657. .SP Options:
  2658. None.
  2659. .SE
  2660. .KY y
  2661. .IP "[buffer] [count] y motion"
  2662. Copy (or
  2663. .QQ yank )
  2664. the text region specified by the
  2665. .LI count
  2666. and
  2667. .LI motion ,
  2668. into a buffer.
  2669. .SS
  2670. .SP Line:
  2671. Unchanged, unless the region covers more than a single line,
  2672. in which case it is set to the line where the region starts.
  2673. .SP Column:
  2674. Unchanged, unless the region covers more than a single line,
  2675. in which case it is set to the character were the region starts.
  2676. .SP Options:
  2677. None.
  2678. .SE
  2679. .KY z
  2680. .IP "[count1] z [count2] type"
  2681. Redraw the screen with a window
  2682. .LI count2
  2683. lines long, with line
  2684. .LI count1
  2685. placed as specified by the
  2686. .LI type
  2687. character.
  2688. If
  2689. .LI count1
  2690. is not specified, it defaults to the current line.
  2691. If
  2692. .LI count2
  2693. is not specified, it defaults to the current window size.
  2694. .sp
  2695. The following
  2696. .LI type
  2697. characters may be used:
  2698. .SS
  2699. .SP +
  2700. If
  2701. .LI count1
  2702. is specified, place the line
  2703. .LI count1
  2704. at the top of the screen.
  2705. Otherwise, display the screen after the current screen, similarly to the
  2706. .CO <control-F>
  2707. command.
  2708. .SP <carriage-return>
  2709. Place the line
  2710. .LI count1
  2711. at the top of the screen.
  2712. .SP \&.
  2713. Place the line
  2714. .LI count1
  2715. in the center of the screen.
  2716. .SP \-
  2717. Place the line
  2718. .LI count1
  2719. at the bottom of the screen.
  2720. .SP ^
  2721. If
  2722. .LI count1
  2723. is specified, place the line that is at the top of the screen 
  2724. when
  2725. .LI count1
  2726. is at the bottom of the screen, at the bottom of the screen,
  2727. i.e. display the screen before the screen before
  2728. .LI count1 .
  2729. Otherwise, display the screen before the current screen, similarly to the
  2730. .CO <control-B>
  2731. command.
  2732. .SE
  2733. .SS
  2734. .SP Line:
  2735. Set to
  2736. .LI count1
  2737. unless
  2738. .LI count1
  2739. is not specified and the
  2740. .LI type
  2741. character was either
  2742. .QT ^
  2743. or
  2744. .QT + ,
  2745. in which case it is set to the line before the first line on the
  2746. previous screen or the line after the last line on the previous
  2747. screen, respectively.
  2748. .SP Column:
  2749. Set to the first nonblank character in the line.
  2750. .SP Options:
  2751. None.
  2752. .SE
  2753. .KY {
  2754. .IP "[count] {"
  2755. Move backward
  2756. .LI count
  2757. paragraphs.
  2758. .sp
  2759. The
  2760. .CO {
  2761. command is an absolute movement.
  2762. The
  2763. .CO {
  2764. command may be used as the motion component of other
  2765. .CO vi
  2766. commands, in which case any text copied into a buffer is
  2767. character oriented, unless the starting character is the first
  2768. character on its line, in which case it is line oriented.
  2769. .SS
  2770. .SP Line:
  2771. Set to the line containing the beginning of the previous paragraph.
  2772. .SP Column:
  2773. Set to the first nonblank character in the line.
  2774. .SP Options:
  2775. Affected by the
  2776. .OP paragraph
  2777. option.
  2778. .SE
  2779. .KY |
  2780. .IP "[count] |"
  2781. Move to a specific
  2782. .i column
  2783. position on the current line.
  2784. .sp
  2785. The
  2786. .CO |
  2787. command may be used as the motion component of other
  2788. .CO vi
  2789. commands, in which case any text copied into a buffer is
  2790. character oriented.
  2791. It is an error to use the
  2792. .CO |
  2793. command as a motion component and for the cursor not to move.
  2794. .SS
  2795. .SP Line:
  2796. Unchanged.
  2797. .SP Column:
  2798. Set to the character occupying the column position identified by
  2799. .LI count ,
  2800. if the position exists in the line.
  2801. If the column length of the current line is less than
  2802. .LI count ,
  2803. the cursor is moved to the last character in the line.
  2804. .SP Options:
  2805. None.
  2806. .SE
  2807. .KY }
  2808. .IP "[count] }"
  2809. Move forward
  2810. .LI count
  2811. paragraphs.
  2812. .sp
  2813. The
  2814. .CO }
  2815. command is an absolute movement.
  2816. The
  2817. .CO }
  2818. command may be used as the motion component of other
  2819. .CO vi
  2820. commands, in which case any text copied into a buffer is
  2821. character oriented, unless the starting character is at or
  2822. before any nonblank characters in its line,
  2823. in which case it is line oriented.
  2824. .SS
  2825. .SP Line:
  2826. Set to the line containing the beginning of the next paragraph.
  2827. .SP Column:
  2828. Set to the first nonblank character in the line.
  2829. .SP Options:
  2830. Affected by the
  2831. .OP paragraph
  2832. option.
  2833. .SE
  2834. .KY ~
  2835. .IP "[count] ~"
  2836. Reverse the case of the next
  2837. .LI count
  2838. character(s).
  2839. This is the historic semantic for the
  2840. .CO ~
  2841. command and it is only in effect if the
  2842. .OP tildeop
  2843. option is not set.
  2844. .sp
  2845. Lowercase alphabetic characters are changed to uppercase,
  2846. and uppercase characters are changed to lowercase.
  2847. No other characters are affected.
  2848. .sp
  2849. Historically, the
  2850. .CO ~
  2851. command did not take an associated count, nor did it move past the
  2852. end of the current line.
  2853. As it had no associated motion it was difficult to change the case
  2854. of large blocks of text.
  2855. In
  2856. .CO nvi ,
  2857. if the cursor is on the last character of a line, and there are
  2858. more lines in the file, the cursor moves to the next line.
  2859. .sp
  2860. It is not an error to specify a count larger than the number of
  2861. characters between the cursor and the end of the file.
  2862. .SS
  2863. .SP Line:
  2864. Set to the line of the character after
  2865. .LI count
  2866. characters, or, end of file.
  2867. .SP Column:
  2868. Set to the character after
  2869. .LI count
  2870. characters, or, end-of-file.
  2871. .SP Options:
  2872. Affected by the
  2873. .OP tildeop
  2874. option.
  2875. .SE
  2876. .KY ~
  2877. .IP "[count] ~ motion"
  2878. Reverse the case of the characters in a text region specified by the
  2879. .LI count
  2880. and
  2881. .LI motion .
  2882. Only in effect if the
  2883. .OP tildeop
  2884. option is set.
  2885. .sp
  2886. Lowercase characters are changed to uppercase,
  2887. and uppercase characters are changed to lowercase.
  2888. No other characters are affected.
  2889. .SS
  2890. .SP Line:
  2891. Set to the line of the character after the last character in the region.
  2892. .SP Column:
  2893. Set to the character after the last character in the region.
  2894. .SP Options:
  2895. Affected by the
  2896. .OP tildeop
  2897. option.
  2898. .SE
  2899. .KY <interrupt>
  2900. .IP "<interrupt>"
  2901. Interrupt the current operation.
  2902. Many of the potentially long-running
  2903. .CO vi
  2904. commands may be interrupted using the terminal interrupt character.
  2905. These operations include searches, file reading and writing, filter
  2906. operations and map character expansion.
  2907. Interrupts are also enabled when running commands outside of
  2908. .CO vi .
  2909. .sp
  2910. If the
  2911. .LI <interrupt>
  2912. character is used to interrupt while entering an
  2913. .CO ex
  2914. command, the command is aborted, the cursor returns to its previous
  2915. position, and
  2916. .CO vi
  2917. remains in command mode.
  2918. .sp
  2919. Generally, if the
  2920. .LI <interrupt>
  2921. character is used to interrupt any
  2922. operation, any changes made before the interrupt are left in place.
  2923. .SS
  2924. .SP Line:
  2925. Dependent on the operation being interrupted.
  2926. .SP Column:
  2927. Dependent on the operation being interrupted.
  2928. .SP Options:
  2929. None.
  2930. .SH 1 "Vi Text Input Commands"
  2931. .pp
  2932. The following section describes the commands available in the text
  2933. input mode of the
  2934. .CO vi
  2935. editor.
  2936. .pp
  2937. Historically,
  2938. .CO vi
  2939. implementations only permitted the characters inserted on the current
  2940. line to be erased.
  2941. In addition, only the
  2942. .LI <control-D>
  2943. erase character and the
  2944. .QT 0<control-D>
  2945. and
  2946. .QT ^<control-D>
  2947. erase strings could erase autoindent characters.
  2948. (Autoindent characters include both the characters inserted automatically
  2949. at the beginning of an input line as well as characters inserted using the
  2950. .LI <control-T>
  2951. command.)
  2952. This implementation permits erasure to continue past the beginning
  2953. of the current line, and back to where text input mode was entered.
  2954. In addition, autoindent characters may be erased using the standard
  2955. erase characters.
  2956. For the line and word erase characters, reaching the autoindent
  2957. characters forms a
  2958. .QQ soft
  2959. boundary, denoting the end of the current word or line erase.
  2960. Repeating the word or line erase key will erase the autoindent characters.
  2961. .pp
  2962. Historically,
  2963. .CO vi
  2964. always used
  2965. .LI <control-H>
  2966. and
  2967. .LI <control-W>
  2968. as character and word erase characters, respectively, regardless of
  2969. the current terminal settings.
  2970. This implementation accepts, in addition to these two characters,
  2971. the current terminal characters for those operations.
  2972. .KY <nul>
  2973. .IP "<nul>"
  2974. If the first character of the input is a
  2975. .LI <nul> ,
  2976. the previous input is replayed, as if just entered.
  2977. .KY <control-D>
  2978. .IP "<control-D>"
  2979. If the previous character on the line was an autoindent character,
  2980. erase characters to move the cursor back to the column immediately
  2981. after the previous (1-based) column which is a multiple of the
  2982. .OP shiftwidth
  2983. edit option.
  2984. This may result in any number of
  2985. .LI <tab>
  2986. and
  2987. .LI <space>
  2988. characters preceding the cursor being changed.
  2989. .sp
  2990. Otherwise, if the
  2991. .OP autoindent
  2992. option is set and the user is entering the first character in the line,
  2993. .LI <control-D>
  2994. is ignored.
  2995. Otherwise, a literal
  2996. .LI <control-D>
  2997. character is entered.
  2998. .KY ^<control-D>
  2999. .IP "^<control-D>"
  3000. If the previous character on the line was an autoindent character,
  3001. erase all of the autoindent characters on the line.
  3002. In addition, the autoindent level is reset to 0.
  3003. .KY 0<control-D>
  3004. .IP "0<control-D>"
  3005. If the previous character on the line was an autoindent character,
  3006. erase all of the autoindent characters on the line.
  3007. The autoindent level is not altered.
  3008. .KY <control-T>
  3009. .IP "<control-T>"
  3010. Insert sufficient
  3011. .LI <tab>
  3012. and
  3013. .LI <space>
  3014. characters to move the cursor forward to the column immediately
  3015. after the next (1-based) column which is a multiple of the
  3016. .OP shiftwidth
  3017. edit option.
  3018. This may result in any number of
  3019. .LI <tab>
  3020. and
  3021. .LI <space>
  3022. characters preceding the cursor being changed.
  3023. .sp
  3024. Historically,
  3025. .CO vi
  3026. did not permit the
  3027. .LI <control-T>
  3028. command to be used unless the cursor was at the first column of a new
  3029. line or it was preceded only by autoindent characters.
  3030. .CO Nvi
  3031. permits it to be used at any time during insert mode.
  3032. .KY <erase>
  3033. .IP <erase>
  3034. .KY <control-H>
  3035. .Ip <control-H>
  3036. Erase the last character.
  3037. .KY "<literal-next>"
  3038. .IP "<literal-next>"
  3039. Quote the next character.
  3040. The next character will not be mapped (see the
  3041. .CO map
  3042. command for more information)
  3043. or interpreted specially.
  3044. A carat
  3045. .PQ ^
  3046. character will be displayed immediately as a placeholder,
  3047. but will be replaced by the next character.
  3048. .KY <escape>
  3049. .IP <escape>
  3050. If on the colon command line, and the
  3051. .OP filec
  3052. edit option is set, behave as described for that option.
  3053. Otherwise, if on the colon command line,
  3054. execute the command.
  3055. Otherwise, if not on the colon command line,
  3056. resolve all text input into the file, and return to command mode.
  3057. .KY "<line erase>"
  3058. .IP "<line erase>"
  3059. Erase the current line.
  3060. .KY "<control-W>"
  3061. .IP "<control-W>"
  3062. .KY "<word erase>"
  3063. .Ip "<word erase>"
  3064. Erase the last word.
  3065. The definition of word is dependent on the
  3066. .OP altwerase
  3067. and
  3068. .OP ttywerase
  3069. options.
  3070. .KY "<control-X>"
  3071. .IP "<control-X>[0-9A-Fa-f]+"
  3072. Insert a character with the specified hexadecimal value into the text.
  3073. The value is delimited by any non-hexadecimal character or the input
  3074. of the maximum number of characters that can be translated into a single
  3075. character value.
  3076. .KY <interrupt>
  3077. .IP "<interrupt>"
  3078. Interrupt text input mode, returning to command mode.
  3079. If the
  3080. .LI <interrupt>
  3081. character is used to interrupt inserting text into the file,
  3082. it is as if the
  3083. .LI <escape>
  3084. character was used; all text input up to the interruption is
  3085. resolved into the file.
  3086.