home *** CD-ROM | disk | FTP | other *** search
/ Dream 49 / Amiga_Dream_49.iso / beos / emacs / emacs-19.34-bin / emacs-19 / info / vip-1 < prev    next >
Encoding:
GNU Info File  |  1997-09-17  |  48.6 KB  |  1,462 lines

  1. This is Info file ../info/vip, produced by Makeinfo-1.55 from the input
  2. file vip.texi.
  3.  
  4. Distribution
  5. ************
  6.  
  7.    Copyright (C) 1987 Masahiko Sato.
  8.  
  9.    Permission is granted to make and distribute verbatim copies of this
  10. manual provided the copyright notice and this permission notice are
  11. preserved on all copies.
  12.  
  13.    Permission is granted to copy and distribute modified versions of
  14. this manual under the conditions for verbatim copying, provided that
  15. the entire resulting derived work is distributed under the terms of a
  16. permission notice identical to this one.
  17.  
  18.    Permission is granted to copy and distribute translations of this
  19. manual into another language, under the same conditions as for modified
  20. versions.
  21.  
  22. 
  23. File: vip,  Node: Top,  Next: Survey,  Up: (DIR)
  24.  
  25. VIP
  26. ***
  27.  
  28.    VIP is a Vi emulating package written in Emacs Lisp.  VIP implements
  29. most Vi commands including Ex commands.  It is therefore hoped that
  30. this package will enable you to do Vi style editing under the powerful
  31. GNU Emacs environment.  This info file describes the usage of VIP
  32. assuming that you are fairly accustomed to Vi but not so much with
  33. Emacs.  Also we will concentrate mainly on differences from Vi,
  34. especially features unique to VIP.
  35.  
  36.    It is recommended that you read nodes on survey and on customization
  37. before you start using VIP.  Other nodes may be visited as needed.
  38.  
  39.    Comments and bug reports are welcome.  Please send messages to
  40. `ms@Sail.Stanford.Edu' if you are outside of Japan and to
  41. `masahiko@sato.riec.tohoku.junet' if you are in Japan.
  42.  
  43. * Menu:
  44.  
  45. * Survey::        A survey of VIP.
  46. * Vi Commands::        Details of Vi commands.
  47. * Ex Commands::        Details of Ex commands.
  48. * Customization::    How to customize VIP.
  49.  
  50. 
  51. File: vip,  Node: Survey,  Next: Basic Concepts,  Prev: Top,  Up: Top
  52.  
  53. A Survey of VIP
  54. ***************
  55.  
  56.    In this chapter we describe basics of VIP with emphasis on the
  57. features not found in Vi and on how to use VIP under GNU Emacs.
  58.  
  59. * Menu:
  60.  
  61. * Basic Concepts::    Basic concepts in Emacs.
  62. * Loading VIP::        How to load VIP automatically.
  63. * Modes in VIP::    VIP has three modes, which are orthogonal to modes
  64.             in Emacs.
  65. * Differences from Vi:: Differences of VIP from Vi is explained.
  66.  
  67. 
  68. File: vip,  Node: Basic Concepts,  Next: Loading VIP,  Prev: Survey,  Up: Survey
  69.  
  70. Basic Concepts
  71. ==============
  72.  
  73.    We begin by explaining some basic concepts of Emacs.  These concepts
  74. are explained in more detail in the GNU Emacs Manual.
  75.  
  76.    Conceptually, a "buffer" is just a string of ASCII characters and two
  77. special characters PNT ("point") and MRK ("mark") such that the
  78. character PNT occurs exactly once and MRK occurs at most once.  The
  79. "text" of a buffer is obtained by deleting the occurrences of PNT and
  80. MRK.  If, in a buffer, there is a character following PNT then we say
  81. that point is "looking at" the character; otherwise we say that point
  82. is "at the end of buffer".  PNT and MRK are used to indicate positions
  83. in a buffer and they are not part of the text of the buffer.  If a
  84. buffer contains a MRK then the text between MRK and PNT is called the
  85. "region" of the buffer.
  86.  
  87.    Emacs provides (multiple) "windows" on the screen, and you can see
  88. the content of a buffer through the window associated with the buffer.
  89. The cursor of the screen is always positioned on the character after
  90. PNT.
  91.  
  92.    A "keymap" is a table that records the bindings between characters
  93. and command functions.  There is the "global keymap" common to all the
  94. buffers.  Each buffer has its "local keymap" that determines the "mode"
  95. of the buffer.  Local keymap overrides global keymap, so that if a
  96. function is bound to some key in the local keymap then that function
  97. will be executed when you type the key.  If no function is bound to a
  98. key in the local map, however, the function bound to the key in the
  99. global map becomes in effect.
  100.  
  101. 
  102. File: vip,  Node: Loading VIP,  Next: Modes in VIP,  Prev: Basic Concepts,  Up: Survey
  103.  
  104. Loading VIP
  105. ===========
  106.  
  107.    The recommended way to load VIP automatically is to include the line:
  108.      (load "vip")
  109.  
  110. in your `.emacs' file.  The `.emacs' file is placed in your home
  111. directory and it will be executed every time you invoke Emacs.  If you
  112. wish to be in vi mode whenever Emacs starts up, you can include the
  113. following line in your `.emacs' file instead of the above line:
  114.      (setq term-setup-hook 'vip-mode)
  115.  
  116. (*Note Vi Mode::, for the explanation of vi mode.)
  117.  
  118.    Even if your `.emacs' file does not contain any of the above lines,
  119. you can load VIP and enter vi mode by typing the following from within
  120. Emacs.
  121.      M-x vip-mode
  122.  
  123. 
  124. File: vip,  Node: Modes in VIP,  Next: Emacs Mode,  Prev: Loading VIP,  Up: Survey
  125.  
  126. Modes in VIP
  127. ============
  128.  
  129. Loading VIP has the effect of globally binding `C-z' (`Control-z') to
  130. the function `vip-change-mode-to-vi'. The default binding of `C-z' in
  131. GNU Emacs is `suspend-emacs', but, you can also call `suspend-emacs' by
  132. typing `C-x C-z'.  Other than this, all the key bindings of Emacs
  133. remain the same after loading VIP.
  134.  
  135.    Now, if you hit `C-z', the function `vip-change-mode-to-vi' will be
  136. called and you will be in "vi mode".  (Some major modes may locally bind
  137. `C-z' to some special functions.  In such cases, you can call
  138. `vip-change-mode-to-vi' by `execute-extended-command' which is invoked
  139. by `M-x'.  Here `M-x' means `Meta-x', and if your terminal does not
  140. have a META key you can enter it by typing `ESC x'.  The same effect
  141. can also be achieve by typing `M-x vip-mode'.)
  142.  
  143.    You can observe the change of mode by looking at the "mode line".
  144. For instance, if the mode line is:
  145.      -----Emacs: *scratch*              (Lisp Interaction)----All------------
  146.  
  147. then it will change to:
  148.      -----Vi:    *scratch*              (Lisp Interaction)----All------------
  149.  
  150. Thus the word `Emacs' in the mode line will change to `Vi'.
  151.  
  152.    You can go back to the original "emacs mode" by typing `C-z' in vi
  153. mode.  Thus `C-z' toggles between these two modes.
  154.  
  155.    Note that modes in VIP exist orthogonally to modes in Emacs.  This
  156. means that you can be in vi mode and at the same time, say, shell mode.
  157.  
  158.    Vi mode corresponds to Vi's command mode.  From vi mode you can enter
  159. "insert mode" (which corresponds to Vi's insert mode) by usual Vi
  160. command keys like `i', `a', `o' ... etc.
  161.  
  162.    In insert mode, the mode line will look like this:
  163.      -----Insert *scratch*              (Lisp Interaction)----All------------
  164.  
  165. You can exit from insert mode by hitting ESC key as you do in Vi.
  166.  
  167.    That VIP has three modes may seem very complicated, but in fact it
  168. is not so.  VIP is implemented so that you can do most editing
  169. remaining only in the two modes for Vi (that is vi mode and insert
  170. mode).
  171.  
  172.    The figure below shows the transition of three modes in VIP.
  173.  
  174.  
  175.                 === C-z ==>          == i,o ... ==>
  176.      emacs mode             vi mode                 insert mode
  177.                 <== X-z ===          <=== ESC ====
  178.  
  179. * Menu:
  180.  
  181. * Emacs Mode::        This is the mode you should know better.
  182. * Vi Mode::        Vi commands are executed in this mode.
  183. * Insert Mode::        You can enter text, and also can do editing if you
  184.             know enough Emacs commands.
  185.  
  186. 
  187. File: vip,  Node: Emacs Mode,  Next: Vi Mode,  Prev: Modes in VIP,  Up: Modes in VIP
  188.  
  189. Emacs Mode
  190. ----------
  191.  
  192.    You will be in this mode just after you loaded VIP.  You can do all
  193. normal Emacs editing in this mode.  Note that the key `C-z' is globally
  194. bound to `vip-change-mode-to-vi'.  So, if you type `C-z' in this mode
  195. then you will be in vi mode.
  196.  
  197. 
  198. File: vip,  Node: Vi Mode,  Next: Insert Mode,  Prev: Emacs Mode,  Up: Modes in VIP
  199.  
  200. Vi Mode
  201. -------
  202.  
  203.    This mode corresponds to Vi's command mode.  Most Vi commands work
  204. as they do in Vi.  You can go back to emacs mode by typing `C-z'.  You
  205. can enter insert mode, just as in Vi, by typing `i', `a' etc.
  206.  
  207. 
  208. File: vip,  Node: Insert Mode,  Next: Differences from Vi,  Prev: Vi Mode,  Up: Modes in VIP
  209.  
  210. Insert Mode
  211. -----------
  212.  
  213.    The key bindings in this mode is the same as in the emacs mode
  214. except for the following 4 keys.  So, you can move around in the buffer
  215. and change its content while you are in insert mode.
  216.  
  217. `ESC'
  218.      This key will take you back to vi mode.
  219.  
  220. `C-h'
  221.      Delete previous character.
  222.  
  223. `C-w'
  224.      Delete previous word.
  225.  
  226. `C-z'
  227.      Typing this key has the same effect as typing ESC in emacs mode.
  228.      Thus typing `C-z x' in insert mode will have the same effect as
  229.      typing `ESC x' in emacs mode.
  230.  
  231. 
  232. File: vip,  Node: Differences from Vi,  Next: Undoing,  Prev: Insert Mode,  Up: Survey
  233.  
  234. Differences from Vi
  235. ===================
  236.  
  237.    The major differences from Vi are explained below.
  238.  
  239. * Menu:
  240.  
  241. * Undoing::        You can undo more in VIP.
  242. * Changing::        Commands for changing the text.
  243. * Searching::        Search commands.
  244. * z Command::        You can now use zH, zM and zL as well as z- etc.
  245. * Counts::        Some Vi commands which do not accept a count now
  246.             accept one.
  247. * Marking::        You can now mark the current point, beginning of
  248.             the buffer etc.
  249. * Region Commands::    You can now give a region as an argument for delete
  250.             commands etc.
  251. * New Commands::    Some new commands not available in Vi are added.
  252. * New Bindings::    Bindings of some keys are changed for the
  253.             convenience of editing under Emacs.
  254. * Window Commands::    Commands for moving among windows etc.
  255. * Buffer Commands::    Commands for selecting buffers etc.
  256. * File Commands::    Commands for visiting files etc.
  257. * Misc Commands::    Other useful commands.
  258.  
  259. 
  260. File: vip,  Node: Undoing,  Next: Changing,  Prev: Differences from Vi,  Up: Differences from Vi
  261.  
  262. Undoing
  263. -------
  264.  
  265.    You can repeat undoing by the `.' key.  So, `u' will undo a single
  266. change, while `u . . .', for instance, will undo 4 previous changes.
  267. Undo is undoable as in Vi.  So the content of the buffer will be the
  268. same before and after `u u'.
  269.  
  270. 
  271. File: vip,  Node: Changing,  Next: Searching,  Prev: Undoing,  Up: Differences from Vi
  272.  
  273. Changing
  274. --------
  275.  
  276.    Some commands which change a small number of characters are executed
  277. slightly differently.  Thus, if point is at the beginning of a word
  278. `foo' and you wished to change it to `bar' by typing `c w', then VIP
  279. will prompt you for a new word in the minibuffer by the prompt `foo =>
  280. '.  You can then enter `bar' followed by RET or ESC to complete the
  281. command.  Before you enter RET or ESC you can abort the command by
  282. typing `C-g'.  In general, you can abort a partially formed command by
  283. typing `C-g'.
  284.  
  285. 
  286. File: vip,  Node: Searching,  Next: z Command,  Prev: Changing,  Up: Differences from Vi
  287.  
  288. Searching
  289. ---------
  290.  
  291.    As in Vi, searching is done by `/' and `?'.  The string will be
  292. searched literally by default.  To invoke a regular expression search,
  293. first execute the search command `/' (or `?') with empty search string.
  294. (I.e, type `/' followed by RET.) A search for empty string will toggle
  295. the search mode between vanilla search and regular expression search.
  296. You cannot give an offset to the search string.  (It is a limitation.)
  297. By default, search will wrap around the buffer as in Vi.  You can
  298. change this by rebinding the variable `vip-search-wrap-around'.  *Note
  299. Customization::, for how to do this.
  300.  
  301. 
  302. File: vip,  Node: z Command,  Next: Counts,  Prev: Searching,  Up: Differences from Vi
  303.  
  304. z Command
  305. ---------
  306.  
  307.    For those of you who cannot remember which of `z' followed by RET,
  308. `.' and `-' do what.  You can also use `z' followed by `H', `M' and `L'
  309. to place the current line in the Home (Middle, and Last) line of the
  310. window.
  311.  
  312. 
  313. File: vip,  Node: Counts,  Next: Marking,  Prev: z Command,  Up: Differences from Vi
  314.  
  315. Counts
  316. ------
  317.  
  318.    Some Vi commands which do not accept a count now accept one
  319.  
  320. `p'
  321. `P'
  322.      Given counts, text will be yanked (in Vi's sense) that many times.
  323.      Thus `3 p' is the same as `p p p'.
  324.  
  325. `o'
  326. `O'
  327.      Given counts, that many copies of text will be inserted. Thus `o a
  328.      b c ESC' will insert 3 lines of `abc' below the current line.
  329.  
  330. `/'
  331. `?'
  332.      Given a count N, N-th occurrence will be searched.
  333.  
  334. 
  335. File: vip,  Node: Marking,  Next: Region Commands,  Prev: Counts,  Up: Differences from Vi
  336.  
  337. Marking
  338. -------
  339.  
  340.    Typing an `m' followed by a lower case character CH marks the point
  341. to the register named CH as in Vi.  In addition to these, we have
  342. following key bindings for marking.
  343.  
  344. `m <'
  345.      Set mark at the beginning of buffer.
  346.  
  347. `m >'
  348.      Set mark at the end of buffer.
  349.  
  350. `m .'
  351.      Set mark at point (and push old mark on mark ring).
  352.  
  353. `m ,'
  354.      Jump to mark (and pop mark off the mark ring).
  355.  
  356. 
  357. File: vip,  Node: Region Commands,  Next: New Commands,  Prev: Marking,  Up: Differences from Vi
  358.  
  359. Region Commands
  360. ---------------
  361.  
  362.    Vi operators like `d', `c' etc. are usually used in combination with
  363. motion commands.  It is now possible to use current region as the
  364. argument to these operators.  (A "region" is a part of buffer delimited
  365. by point and mark.)  The key `r' is used for this purpose.  Thus `d r'
  366. will delete the current region.  If `R' is used instead of `r' the
  367. region will first be enlarged so that it will become the smallest
  368. region containing the original region and consisting of whole lines.
  369. Thus `m . d R' will have the same effect as `d d'.
  370.  
  371. 
  372. File: vip,  Node: New Commands,  Next: New Bindings,  Prev: Region Commands,  Up: Differences from Vi
  373.  
  374. Some New Commands
  375. -----------------
  376.  
  377.    Note that the keys below (except for `R') are not used in Vi.
  378.  
  379. `C-a'
  380.      Move point to the beginning of line.
  381.  
  382. `C-n'
  383.      If you have two or more windows in the screen, this key will move
  384.      point to the next window.
  385.  
  386. `C-o'
  387.      Insert a newline and leave point before it, and then enter insert
  388.      mode.
  389.  
  390. `C-r'
  391.      Backward incremental search.
  392.  
  393. `C-s'
  394.      Forward incremental search.
  395.  
  396. `C-c'
  397. `C-x'
  398. `ESC'
  399.      These keys will exit from vi mode and return to emacs mode
  400.      temporarily.  If you hit one of these keys, Emacs will be in emacs
  401.      mode and will believe that you hit that key in emacs mode. For
  402.      example, if you hit `C-x' followed by `2', then the current window
  403.      will be split into 2 and you will be in vi mode again.
  404.  
  405. `\'
  406.      Escape to emacs mode.  Hitting `\' will take you to emacs mode,
  407.      and you can execute a single Emacs command.  After executing the
  408.      Emacs command you will be in vi mode again.  You can give a count
  409.      before typing `\'.  Thus `5 \ *', as well as `\ C-u 5 *', will
  410.      insert `*****' before point.  Similarly `1 0 \ C-p' will move the
  411.      point 10 lines above the current line.
  412.  
  413. `K'
  414.      Kill current buffer if it is not modified.  Useful when you
  415.      selected a buffer which you did not want.
  416.  
  417. `Q'
  418. `R'
  419.      `Q' is for query replace and `R' is for replace.  By default,
  420.      string to be replaced are treated literally.  If you wish to do a
  421.      regular expression replace, first do replace with empty string as
  422.      the string to be replaced.  In this way, you can toggle between
  423.      vanilla and regular expression replacement.
  424.  
  425. `v'
  426. `V'
  427.      These keys are used to Visit files.  `v' will switch to a buffer
  428.      visiting file whose name can be entered in the minibuffer. `V' is
  429.      similar, but will use window different from the current window.
  430.  
  431. `#'
  432.      If followed by a certain character CH, it becomes an operator whose
  433.      argument is the region determined by the motion command that
  434.      follows.  Currently, CH can be one of `c', `C', `g', `q' and `s'.
  435.  
  436. `# c'
  437.      Change upper case characters in the region to lower case
  438.      (`downcase-region').
  439.  
  440. `# C'
  441.      Change lower case characters in the region to upper case. For
  442.      instance, `# C 3 w' will capitalize 3 words from the current point
  443.      (`upcase-region').
  444.  
  445. `# g'
  446.      Execute last keyboard macro for each line in the region
  447.      (`vip-global-execute').
  448.  
  449. `# q'
  450.      Insert specified string at the beginning of each line in the region
  451.      (`vip-quote-region').
  452.  
  453. `# s'
  454.      Check spelling of words in the region (`spell-region').
  455.  
  456. `*'
  457.      Call last keyboard macro.
  458.  
  459. 
  460. File: vip,  Node: New Bindings,  Next: Window Commands,  Prev: New Commands,  Up: Differences from Vi
  461.  
  462. New Key Bindings
  463. ----------------
  464.  
  465.    In VIP the meanings of some keys are entirely different from Vi.
  466. These key bindings are done deliberately in the hope that editing under
  467. Emacs will become easier.  It is however possible to rebind these keys
  468. to functions which behave similarly as in Vi.  *Note Customizing Key
  469. Bindings::, for details.
  470.  
  471. `C-g'
  472. `g'
  473.      In Vi, `C-g' is used to get information about the file associated
  474.      to the current buffer.  Here, `g' will do that, and `C-g' is used
  475.      to abort a command (this is for compatibility with emacs mode.)
  476.  
  477. `SPC'
  478. `RET'
  479.      Now these keys will scroll up and down the text of current window.
  480.      Convenient for viewing the text.
  481.  
  482. `s'
  483. `S'
  484.      They are used to switch to a specified buffer.  Useful for
  485.      switching to already existing buffer since buffer name completion
  486.      is provided.  Also a default buffer will be given as part of the
  487.      prompt, to which you can switch by just typing RET key.  `s' is
  488.      used to select buffer in the current window, while `S' selects
  489.      buffer in another window.
  490.  
  491. `C'
  492. `X'
  493.      These keys will exit from vi mode and return to emacs mode
  494.      temporarily.  If you type `C' (`X'), Emacs will be in emacs mode
  495.      and will believe that you have typed `C-c' (`C-x', resp.) in emacs
  496.      mode. Moreover, if the following character you type is an upper
  497.      case letter, then Emacs will believe that you have typed the
  498.      corresponding control character.  You will be in vi mode again
  499.      after the command is executed.  For example, typing `X S' in vi
  500.      mode is the same as typing `C-x C-s' in emacs mode.  You get the
  501.      same effect by typing `C-x C-s' in vi mode, but the idea here is
  502.      that you can execute useful Emacs commands without typing control
  503.      characters. For example, if you hit `X' (or `C-x') followed by
  504.      `2', then the current window will be split into 2 and you will be
  505.      in vi mode again.
  506.  
  507.    In addition to these, `ctl-x-map' is slightly modified:
  508.  
  509. `X 3'
  510. `C-x 3'
  511.      This is equivalent to `C-x 1 C-x 2' (1 + 2 = 3).
  512.  
  513. 
  514. File: vip,  Node: Window Commands,  Next: Buffer Commands,  Prev: New Bindings,  Up: Differences from Vi
  515.  
  516. Window Commands
  517. ---------------
  518.  
  519.    In this and following subsections, we give a summary of key bindings
  520. for basic functions related to windows, buffers and files.
  521.  
  522. `C-n'
  523.      Switch to next window.
  524.  
  525. `X 1'
  526. `C-x 1'
  527.      Delete other windows.
  528.  
  529. `X 2'
  530. `C-x 2'
  531.      Split current window into two windows.
  532.  
  533. `X 3'
  534. `C-x 3'
  535.      Show current buffer in two windows.
  536.  
  537. 
  538. File: vip,  Node: Buffer Commands,  Next: File Commands,  Prev: Window Commands,  Up: Differences from Vi
  539.  
  540. Buffer Commands
  541. ---------------
  542.  
  543. `s'
  544.      Switch to the specified buffer in the current window
  545.      (`vip-switch-to-buffer').
  546.  
  547. `S'
  548.      Switch to the specified buffer in another window
  549.      (`vip-switch-to-buffer-other-window').
  550.  
  551. `K'
  552.      Kill the current buffer if it is not modified.
  553.  
  554. `X S'
  555. `C-x C-s'
  556.      Save the current buffer in the file associated to the buffer.
  557.  
  558. 
  559. File: vip,  Node: File Commands,  Next: Misc Commands,  Prev: Buffer Commands,  Up: Differences from Vi
  560.  
  561. File Commands
  562. -------------
  563.  
  564. `v'
  565.      Visit specified file in the current window.
  566.  
  567. `V'
  568.      Visit specified file in another window.
  569.  
  570. `X W'
  571. `C-x C-w'
  572.      Write current buffer into the specified file.
  573.  
  574. `X I'
  575. `C-x C-i'
  576.      Insert specified file at point.
  577.  
  578. 
  579. File: vip,  Node: Misc Commands,  Next: Vi Commands,  Prev: File Commands,  Up: Differences from Vi
  580.  
  581. Miscellaneous Commands
  582. ----------------------
  583.  
  584. `X ('
  585. `C-x ('
  586.      Start remembering keyboard macro.
  587.  
  588. `X )'
  589. `C-x )'
  590.      Finish remembering keyboard macro.
  591.  
  592. `*'
  593.      Call last remembered keyboard macro.
  594.  
  595. `X Z'
  596. `C-x C-z'
  597.      Suspend Emacs.
  598.  
  599. `Z Z'
  600.      Exit Emacs.
  601.  
  602. `Q'
  603.      Query replace.
  604.  
  605. `R'
  606.      Replace.
  607.  
  608. 
  609. File: vip,  Node: Vi Commands,  Next: Numeric Arguments,  Prev: Misc Commands,  Up: Top
  610.  
  611. Vi Commands
  612. ***********
  613.  
  614.    This chapter describes Vi commands other than Ex commands
  615. implemented in VIP.  Except for the last section which discusses insert
  616. mode, all the commands described in this chapter are to be used in vi
  617. mode.
  618.  
  619. * Menu:
  620.  
  621. * Numeric Arguments::    Many commands accept numeric arguments
  622. * Important Keys::    Some very important keys.
  623. * Buffers and Windows::    Commands for handling buffers and windows.
  624. * Files::        Commands for handling files.
  625. * Viewing the Buffer::    How you can view the current buffer.
  626. * Mark Commands::    Marking positions in a buffer.
  627. * Motion Commands::    Commands for moving point.
  628. * Searching and Replacing::    Commands for searching and replacing.
  629. * Modifying Commands::    Commands for modifying the buffer.
  630. * Other Vi Commands::    Miscellaneous Commands.
  631. * Commands in Insert Mode::    Commands for entering insert mode.
  632.  
  633. 
  634. File: vip,  Node: Numeric Arguments,  Next: Important Keys,  Prev: Vi Commands,  Up: Vi Commands
  635.  
  636. Numeric Arguments
  637. =================
  638.  
  639.    Most Vi commands accept a "numeric argument" which can be supplied as
  640. a prefix to the commands.  A numeric argument is also called a "count".
  641. In many cases, if a count is given, the command is executed that many
  642. times.  For instance, `5 d d' deletes 5 lines while simple `d d'
  643. deletes a line.  In this manual the metavariable N will denote a count.
  644.  
  645. 
  646. File: vip,  Node: Important Keys,  Next: Buffers and Windows,  Prev: Numeric Arguments,  Up: Vi Commands
  647.  
  648. Important Keys
  649. ==============
  650.  
  651.    The keys `C-g' and `C-l' are unique in that their associated
  652. functions are the same in any of emacs, vi and insert mode.
  653.  
  654. `C-g'
  655.      Quit.  Cancel running or partially typed command (`keyboard-quit').
  656.  
  657. `C-l'
  658.      Clear the screen and reprint everything (`recenter').
  659.  
  660.    In Emacs many commands are bound to the key strokes that start with
  661. `C-x', `C-c' and ESC.  These commands can be accessed from vi mode as
  662. easily as from emacs mode.
  663.  
  664. `C-x'
  665. `C-c'
  666. `ESC'
  667.      Typing one of these keys have the same effect as typing it in
  668.      emacs mode.  Appropriate command will be executed according as the
  669.      keys you type after it.  You will be in vi mode again after the
  670.      execution of the command.  For instance, if you type `ESC <' (in
  671.      vi mode) then the cursor will move to the beginning of the buffer
  672.      and you will still be in vi mode.
  673.  
  674. `C'
  675. `X'
  676.      Typing one of these keys have the effect of typing the
  677.      corresponding control character in emacs mode.  Moreover, if you
  678.      type an upper case character following it, that character will
  679.      also be translated to the corresponding control character.  Thus
  680.      typing `X W' in vi mode is the same as typing `C-x C-w' in emacs
  681.      mode.  You will be in vi mode again after the execution of a
  682.      command.
  683.  
  684. `\'
  685.      Escape to emacs mode.  Hitting the `\' key will take you to emacs
  686.      mode, and you can execute a single Emacs command.  After executing
  687.      the Emacs command you will be in vi mode again.  You can give a
  688.      count before typing `\'.  Thus `5 \ +', as well as `\ C-u 5 +',
  689.      will insert `+++++' before point.
  690.  
  691. 
  692. File: vip,  Node: Buffers and Windows,  Next: Files,  Prev: Important Keys,  Up: Vi Commands
  693.  
  694. Buffers and Windows
  695. ===================
  696.  
  697.    In Emacs the text you edit is stored in a "buffer".  See GNU Emacs
  698. Manual, for details.  There is always one "selected" buffer which is
  699. called the "current buffer".
  700.  
  701.    You can see the contents of buffers through "windows" created by
  702. Emacs.  When you have multiple windows on the screen only one of them
  703. is selected.  Each buffer has a unique name, and each window has a mode
  704. line which shows the name of the buffer associated with the window and
  705. other information about the status of the buffer.  You can change the
  706. format of the mode line, but normally if you see `**' at the beginning
  707. of a mode line it means that the buffer is "modified".  If you write
  708. out the content of the buffer to a file, then the buffer will become
  709. not modified.  Also if you see `%%' at the beginning of the mode line,
  710. it means that the file associated with the buffer is write protected.
  711.  
  712.    We have the following commands related to windows and buffers.
  713.  
  714. `C-n'
  715.      Move cursor to the next-window (`vip-next-window').
  716.  
  717. `X 1'
  718.      Delete other windows and make the selected window fill the screen
  719.      (`delete-other-windows').
  720.  
  721. `X 2'
  722.      Split current window into two windows (`split-window-vertically').
  723.  
  724. `X 3'
  725.      Show current buffer in two windows.
  726.  
  727. `s BUFFER RET'
  728.      Select or create a buffer named BUFFER (`vip-switch-to-buffer').
  729.  
  730. `S BUFFER RET'
  731.      Similar but select a buffer named BUFFER in another window
  732.      (`vip-switch-to-buffer-other-window').
  733.  
  734. `K'
  735.      Kill the current buffer if it is not modified or if it is not
  736.      associated with a file
  737.      (`vip-kill-buffer').
  738.  
  739. `X B'
  740.      List the existing buffers (`list-buffers').
  741.  
  742.    As "buffer name completion" is provided, you have only to type in
  743. initial substring of the buffer name which is sufficient to identify it
  744. among names of existing buffers.  After that, if you hit TAB the rest
  745. of the buffer name will be supplied by the system, and you can confirm
  746. it by RET.  The default buffer name to switch to will also be prompted,
  747. and you can select it by giving a simple RET.  See GNU Emacs Manual for
  748. details of completion.
  749.  
  750. 
  751. File: vip,  Node: Files,  Next: Viewing the Buffer,  Prev: Buffers and Windows,  Up: Vi Commands
  752.  
  753. Files
  754. =====
  755.  
  756.    We have the following commands related to files.  They are used to
  757. visit, save and insert files.
  758.  
  759. `v FILE RET'
  760.      Visit specified file in the current window (`vip-find-file').
  761.  
  762. `V FILE RET'
  763.      Visit specified file in another window
  764.      (`vip-find-file-other-window').
  765.  
  766. `X S'
  767.      Save current buffer to the file associated with the buffer.  If no
  768.      file is associated with the buffer, the name of the file to write
  769.      out the content of the buffer will be asked in the minibuffer.
  770.  
  771. `X W FILE RET'
  772.      Write current buffer into a specified file.
  773.  
  774. `X I FILE RET'
  775.      Insert a specified file at point.
  776.  
  777. `g'
  778.      Give information on the file associated with the current buffer.
  779.      Tell you the name of the file associated with the buffer, the line
  780.      number of the current point and total line numbers in the buffer.
  781.      If no file is associated with the buffer, this fact will be
  782.      indicated by the null file name `""'.
  783.  
  784.    In Emacs, you can edit a file by "visiting" it.  If you wish to
  785. visit a file in the current window, you can just type `v'.  Emacs
  786. maintains the "default directory" which is specific to each buffer.
  787. Suppose, for instance, that the default directory of the current buffer
  788. is `/usr/masahiko/lisp/'.  Then you will get the following prompt in the
  789. minibuffer.
  790.      visit file: /usr/masahiko/lisp/
  791.  
  792. If you wish to visit, say, `vip.el' in this directory, then you can
  793. just type `vip.el' followed by RET.  If the file `vip.el' already
  794. exists in the directory, Emacs will visit that file, and if not, the
  795. file will be created.  Emacs will use the file name (`vip.el', in this
  796. case) as the name of the buffer visiting the file.  In order to make
  797. the buffer name unique, Emacs may append `<2>', `<3>' etc., to the
  798. buffer name.  As the "file name completion" is provided here, you can
  799. sometime save typing.  For instance, suppose there is only one file in
  800. the default directory whose name starts with `v', that is `vip.el'.
  801. Then if you just type `v TAB' then it will be completed to `vip.el'.
  802. Thus, in this case, you just have to type `v v TAB RET' to visit
  803. `/usr/masahiko/lisp/vip.el'.  Continuing the example, let us now
  804. suppose that you wished to visit the file
  805. `/usr/masahiko/man/vip.texinfo'.  Then to the same prompt which you get
  806. after you typed `v', you can enter `/usr/masahiko/man/vip.texinfo' or
  807. `../man/vip.texinfo' followed by RET.
  808.  
  809.    Use `V' instead of `v', if you wish to visit a file in another
  810. window.
  811.  
  812.    You can verify which file you are editing by typing `g'.  (You can
  813. also type `X B' to get nformation on other buffers too.)  If you type
  814. `g' you will get an information like below in the echo area:
  815.      "/usr/masahiko/man/vip.texinfo" line 921 of 1949
  816.  
  817.    After you edited the buffer (`vip.texinfo', in our example) for a
  818. while, you may wish to save it in a file.  If you wish to save it in
  819. the file associated with the buffer (`/usr/masahiko/man/vip.texinfo',
  820. in this case), you can just say `X S'.  If you wish to save it in
  821. another file, you can type `X W'.  You will then get a similar prompt
  822. as you get for `v', to which you can enter the file name.
  823.  
  824. 
  825. File: vip,  Node: Viewing the Buffer,  Next: Mark Commands,  Prev: Files,  Up: Vi Commands
  826.  
  827. Viewing the Buffer
  828. ==================
  829.  
  830.    In this and next section we discuss commands for moving around in the
  831. buffer.  These command do not change the content of the buffer.  The
  832. following commands are useful for viewing the content of the current
  833. buffer.
  834.  
  835. `SPC'
  836. `C-f'
  837.      Scroll text of current window upward almost full screen.  You can
  838.      go forward in the buffer by this command (`vip-scroll').
  839.  
  840. `RET'
  841. `C-b'
  842.      Scroll text of current window downward almost full screen.  You
  843.      can go backward in the buffer by this command (`vip-scroll-back').
  844.  
  845. `C-d'
  846.      Scroll text of current window upward half screen.  You can go down
  847.      in the buffer by this command (`vip-scroll-down').
  848.  
  849. `C-u'
  850.      Scroll text of current window downward half screen.  You can go up
  851.      in the buffer by this command (`vip-scroll-up').
  852.  
  853. `C-y'
  854.      Scroll text of current window upward by one line
  855.      (`vip-scroll-down-one').
  856.  
  857. `C-e'
  858.      Scroll text of current window downward by one line
  859.      (`vip-scroll-up-one').
  860.  
  861. You can repeat these commands by giving a count.  Thus, `2 SPC' has the
  862. same effect as `SPC SPC'.
  863.  
  864.    The following commands reposition point in the window.
  865.  
  866. `z H'
  867. `z RET'
  868.      Put point on the top (home) line in the window.  So the current
  869.      line becomes the top line in the window.  Given a count N, point
  870.      will be placed in the N-th line from top (`vip-line-to-top').
  871.  
  872. `z M'
  873. `z .'
  874.      Put point on the middle line in the window.  Given a count N,
  875.      point will be placed in the N-th line from the middle line
  876.      (`vip-line-to-middle').
  877.  
  878. `z L'
  879. `z -'
  880.      Put point on the bottom line in the window.  Given a count N,
  881.      point will be placed in the N-th line from bottom
  882.      (`vip-line-to-bottom').
  883.  
  884. `C-l'
  885.      Center point in window and redisplay screen (`recenter').
  886.  
  887. 
  888. File: vip,  Node: Mark Commands,  Next: Motion Commands,  Prev: Viewing the Buffer,  Up: Vi Commands
  889.  
  890. Mark Commands
  891. =============
  892.  
  893.    The following commands are used to mark positions in the buffer.
  894.  
  895. `m CH'
  896.      Store current point in the register CH.  CH must be a lower case
  897.      character between `a' and `z'.
  898.  
  899. `m <'
  900.      Set mark at the beginning of current buffer.
  901.  
  902. `m >'
  903.      Set mark at the end of current buffer.
  904.  
  905. `m .'
  906.      Set mark at point.
  907.  
  908. `m ,'
  909.      Jump to mark (and pop mark off the mark ring).
  910.  
  911.    Emacs uses the "mark ring" to store marked positions.  The commands
  912. `m <', `m >' and `m .' not only set mark but also add it as the latest
  913. element of the mark ring (replacing the oldest one).  By repeating the
  914. command ``m ,'' you can visit older and older marked positions.  You
  915. will eventually be in a loop as the mark ring is a ring.
  916.  
  917. 
  918. File: vip,  Node: Motion Commands,  Next: Searching and Replacing,  Prev: Mark Commands,  Up: Vi Commands
  919.  
  920. Motion Commands
  921. ===============
  922.  
  923.    Commands for moving around in the current buffer are collected here.
  924. These commands are used as an `argument' for the delete, change and
  925. yank commands to be described in the next section.
  926.  
  927. `h'
  928.      Move point backward by one character.  Signal error if point is at
  929.      the beginning of buffer, but (unlike Vi) do not complain otherwise
  930.      (`vip-backward-char').
  931.  
  932. `l'
  933.      Move point backward by one character.  Signal error if point is at
  934.      the end of buffer, but (unlike Vi) do not complain otherwise
  935.      (`vip-forward-char').
  936.  
  937. `j'
  938.      Move point to the next line keeping the current column.  If point
  939.      is on the last line of the buffer, a new line will be created and
  940.      point will move to that line (`vip-next-line').
  941.  
  942. `k'
  943.      Move point to the previous line keeping the current column
  944.      (`vip-next-line').
  945.  
  946. `+'
  947.      Move point to the next line at the first non-white character.  If
  948.      point is on the last line of the buffer, a new line will be
  949.      created and point will move to the beginning of that line
  950.      (`vip-next-line-at-bol').
  951.  
  952. `-'
  953.      Move point to the previous line at the first non-white character
  954.      (`vip-previous-line-at-bol').
  955.  
  956. If a count is given to these commands, the commands will be repeated
  957. that many times.
  958.  
  959. `0'
  960.      Move point to the beginning of line (`vip-beginning-of-line').
  961.  
  962. `^'
  963.      Move point to the first non-white character on the line
  964.      (`vip-bol-and-skip-white').
  965.  
  966. `$'
  967.      Move point to the end of line (`vip-goto-eol').
  968.  
  969. `N |'
  970.      Move point to the N-th column on the line (`vip-goto-col').
  971.  
  972. Except for the `|' command, these commands neglect a count.
  973.  
  974. `w'
  975.      Move point forward to the beginning of the next word
  976.      (`vip-forward-word').
  977.  
  978. `W'
  979.      Move point forward to the beginning of the next word, where a
  980.      "word" is considered as a sequence of non-white characters
  981.      (`vip-forward-Word').
  982.  
  983. `b'
  984.      Move point backward to the beginning of a word
  985.      (`vip-backward-word').
  986.  
  987. `B'
  988.      Move point backward to the beginning of a word, where a word is
  989.      considered as a sequence of non-white characters
  990.      (`vip-forward-Word').
  991.  
  992. `e'
  993.      Move point forward to the end of a word (`vip-end-of-word').
  994.  
  995. `E'
  996.      Move point forward to the end of a word, where a word is
  997.      considered as a sequence of non-white characters
  998.      (`vip-end-of-Word').
  999.  
  1000. Here the meaning of the word `word' for the `w', `b' and `e' commands
  1001. is determined by the "syntax table" effective in the current buffer.
  1002. Each major mode has its syntax mode, and therefore the meaning of a
  1003. word also changes as the major mode changes.  See GNU Emacs Manual for
  1004. details of syntax table.
  1005.  
  1006. `H'
  1007.      Move point to the beginning of the home (top) line of the window.
  1008.      Given a count N, go to the N-th line from top (`vip-window-top').
  1009.  
  1010. `M'
  1011.      Move point to the beginning of the middle line of the window.
  1012.      Given a count N, go to the N-th line from the middle line
  1013.      (`vip-window-middle').
  1014.  
  1015. `L'
  1016.      Move point to the beginning of the lowest (bottom) line of the
  1017.      window.  Given count, go to the N-th line from bottom
  1018.      (`vip-window-bottom').
  1019.  
  1020. These commands can be used to go to the desired line visible on the
  1021. screen.
  1022.  
  1023. `('
  1024.      Move point backward to the beginning of the sentence
  1025.      (`vip-backward-sentence').
  1026.  
  1027. `)'
  1028.      Move point forward to the end of the sentence
  1029.      (`vip-forward-sentence').
  1030.  
  1031. `{'
  1032.      Move point backward to the beginning of the paragraph
  1033.      (`vip-backward-paragraph').
  1034.  
  1035. `}'
  1036.      Move point forward to the end of the paragraph
  1037.      (`vip-forward-paragraph').
  1038.  
  1039. A count repeats the effect for these commands.
  1040.  
  1041. `G'
  1042.      Given a count N, move point to the N-th line in the buffer on the
  1043.      first non-white character.  Without a count, go to the end of the
  1044.      buffer (`vip-goto-line').
  1045.  
  1046. `` `'
  1047.      Exchange point and mark (`vip-goto-mark').
  1048.  
  1049. `` CH'
  1050.      Move point to the position stored in the register CH.  CH must be
  1051.      a lower case letter.
  1052.  
  1053. `' ''
  1054.      Exchange point and mark, and then move point to the first non-white
  1055.      character on the line (`vip-goto-mark-and-skip-white').
  1056.  
  1057. `' CH'
  1058.      Move point to the position stored in the register CH and skip to
  1059.      the first non-white character on the line.  CH must be a lower
  1060.      case letter.
  1061.  
  1062. `%'
  1063.      Move point to the matching parenthesis if point is looking at `(',
  1064.      `)', `{', `}', `[' or `]'
  1065.      (`vip-paren-match').
  1066.  
  1067. The command `G' mark point before move, so that you can return to the
  1068. original point by `` `'.  The original point will also be stored in the
  1069. mark ring.
  1070.  
  1071.    The following commands are useful for moving points on the line.  A
  1072. count will repeat the effect.
  1073.  
  1074. `f CH'
  1075.      Move point forward to the character CH on the line.  Signal error
  1076.      if CH could not be found (`vip-find-char-forward').
  1077.  
  1078. `F CH'
  1079.      Move point backward to the character CH on the line.  Signal error
  1080.      if CH could not be found (`vip-find-char-backward').
  1081.  
  1082. `t CH'
  1083.      Move point forward upto the character CH on the line.  Signal
  1084.      error if CH could not be found (`vip-goto-char-forward').
  1085.  
  1086. `T CH'
  1087.      Move point backward upto the character CH on the line.  Signal
  1088.      error if CH could not be found (`vip-goto-char-backward').
  1089.  
  1090. `;'
  1091.      Repeat previous `f', `t', `F' or `T' command (`vip-repeat-find').
  1092.  
  1093. `,'
  1094.      Repeat previous `f', `t', `F' or `T' command, in the opposite
  1095.      direction (`vip-repeat-find-opposite').
  1096.  
  1097. 
  1098. File: vip,  Node: Searching and Replacing,  Next: Modifying Commands,  Prev: Motion Commands,  Up: Vi Commands
  1099.  
  1100. Searching and Replacing
  1101. =======================
  1102.  
  1103.    Following commands are available for searching and replacing.
  1104.  
  1105. `/ STRING RET'
  1106.      Search the first occurrence of the string STRING forward starting
  1107.      from point.  Given a count N, the N-th occurrence of STRING will
  1108.      be searched.  If the variable `vip-re-search' has value `t' then
  1109.      "regular expression" search is done and the string matching the
  1110.      regular expression STRING is found.  If you give an empty string
  1111.      as STRING then the search mode will change from vanilla search to
  1112.      regular expression search and vice versa (`vip-search-forward').
  1113.  
  1114. `? STRING RET'
  1115.      Same as `/', except that search is done backward
  1116.      (`vip-search-backward').
  1117.  
  1118. `n'
  1119.      Search the previous search pattern in the same direction as before
  1120.      (`vip-search-next').
  1121.  
  1122. `N'
  1123.      Search the previous search pattern in the opposite direction
  1124.      (`vip-search-Next').
  1125.  
  1126. `C-s'
  1127.      Search forward incrementally.  See GNU Emacs Manual for details
  1128.      (`isearch-forward').
  1129.  
  1130. `C-r'
  1131.      Search backward incrementally (`isearch-backward').
  1132.  
  1133. `R STRING RET NEWSTRING'
  1134.      There are two modes of replacement, "vanilla" and "regular
  1135.      expression".  If the mode is vanilla you will get a prompt
  1136.      `Replace string:', and if the mode is regular expression you will
  1137.      ge a prompt `Replace regexp:'.  The mode is initially vanilla, but
  1138.      you can toggle these modes by giving a null string as STRING.  If
  1139.      the mode is vanilla, this command replaces every occurrence of
  1140.      STRING with NEWSTRING.  If the mode is regular expression, STRING
  1141.      is treated as a regular expression and every string matching the
  1142.      regular expression is replaced with NEWSTRING
  1143.      (`vip-replace-string').
  1144.  
  1145. `Q    STRING RET NEWSTRING'
  1146.      Same as `R' except that you will be asked form confirmation before
  1147.      each replacement
  1148.      (`vip-query-replace').
  1149.  
  1150. `r CH'
  1151.      Replace the character point is looking at by the character CH.
  1152.      Give count, replace that many characters by CH
  1153.      (`vip-replace-char').
  1154.  
  1155. The commands `/' and `?' mark point before move, so that you can return
  1156. to the original point by `` `'.
  1157.  
  1158. 
  1159. File: vip,  Node: Modifying Commands,  Next: Delete Commands,  Prev: Searching and Replacing,  Up: Vi Commands
  1160.  
  1161. Modifying Commands
  1162. ==================
  1163.  
  1164.    In this section, commands for modifying the content of a buffer are
  1165. described.  These commands affect the region determined by a motion
  1166. command which is given to the commands as their argument.
  1167.  
  1168.    We classify motion commands into "point commands" and "line
  1169. commands".  The point commands are as follows:
  1170.      `h', `l', `0', `^', `$', `w', `W', `b', `B', `e', `E', `(', `)', `/', `?', ``', `f', `F', `t', `T', `%', `;', `,'
  1171.  
  1172. The line commands are as follows:
  1173.      `j', `k', `+', `-', `H', `M', `L', `{', `}', `G', `''
  1174.  
  1175. If a point command is given as an argument to a modifying command, the
  1176. region determined by the point command will be affected by the modifying
  1177. command. On the other hand, if a line command is given as an argument
  1178. to a modifying command, the region determined by the line command will
  1179. be enlarged so that it will become the smallest region properly
  1180. containing the region and consisting of whole lines (we call this
  1181. process "expanding the region"), and then the enlarged region will be
  1182. affected by the modifying command.
  1183.  
  1184. * Menu:
  1185.  
  1186. * Delete Commands::    Commands for deleting text.
  1187. * Yank Commands::    Commands for yanking text in Vi's sense.
  1188. * Put Back Commands::    Commands for putting back deleted/yanked text.
  1189. * Change Commands::    Commands for changing text.
  1190. * Repeating and Undoing Modifications::
  1191.  
  1192. 
  1193. File: vip,  Node: Delete Commands,  Next: Yank Commands,  Prev: Modifying Commands,  Up: Modifying Commands
  1194.  
  1195. Delete Commands
  1196. ---------------
  1197.  
  1198. `d MOTION-COMMAND'
  1199.      Delete the region determined by the motion command MOTION-COMMAND.
  1200.  
  1201. For example, `d $' will delete the region between point and end of
  1202. current line since `$' is a point command that moves point to end of
  1203. line.  `d G' will delete the region between the beginning of current
  1204. line and end of the buffer, since `G' is a line command.  A count given
  1205. to the command above will become the count for the associated motion
  1206. command.  Thus, `3 d w' will delete three words.
  1207.  
  1208.    It is also possible to save the deleted text into a register you
  1209. specify.  For example, you can say `" t 3 d w' to delete three words
  1210. and save it to register `t'.  The name of a register is a lower case
  1211. letter between `a' and `z'.  If you give an upper case letter as an
  1212. argument to a delete command, then the deleted text will be appended to
  1213. the content of the register having the corresponding lower case letter
  1214. as its name.  So, `" T d w' will delete a word and append it to
  1215. register `t'.  Other modifying commands also accept a register name as
  1216. their argument, and we will not repeat similar explanations.
  1217.  
  1218.    We have more delete commands as below.
  1219.  
  1220. `d d'
  1221.      Delete a line.  Given a count N, delete N lines.
  1222.  
  1223. `d r'
  1224.      Delete current region.
  1225.  
  1226. `d R'
  1227.      Expand current region and delete it.
  1228.  
  1229. `D'
  1230.      Delete to the end of a line (`vip-kill-line').
  1231.  
  1232. `x'
  1233.      Delete a character after point.  Given N, delete N characters
  1234.      (`vip-delete-char').
  1235.  
  1236. `DEL'
  1237.      Delete a character before point.  Given N, delete N characters
  1238.      (`vip-delete-backward-char').
  1239.  
  1240. 
  1241. File: vip,  Node: Yank Commands,  Next: Put Back Commands,  Prev: Delete Commands,  Up: Modifying Commands
  1242.  
  1243. Yank Commands
  1244. -------------
  1245.  
  1246.    Yank commands "yank" a text of buffer into a (usually anonymous)
  1247. register.  Here the word `yank' is used in Vi's sense.  Thus yank
  1248. commands do not alter the content of the buffer, and useful only in
  1249. combination with commands that put back the yanked text into the buffer.
  1250.  
  1251. `y MOTION-COMMAND'
  1252.      Yank the region determined by the motion command MOTION-COMMAND.
  1253.  
  1254. For example, `y $' will yank the text between point and the end of line
  1255. into an anonymous register, while `"c y $' will yank the same text into
  1256. register `c'.
  1257.  
  1258.    Use the following command to yank consecutive lines of text.
  1259.  
  1260. `y y'
  1261. `Y'
  1262.      Yank a line.  Given N, yank N lines (`vip-yank-line').
  1263.  
  1264. `y r'
  1265.      Yank current region.
  1266.  
  1267. `y R'
  1268.      Expand current region and yank it.
  1269.  
  1270. 
  1271. File: vip,  Node: Put Back Commands,  Next: Change Commands,  Prev: Yank Commands,  Up: Modifying Commands
  1272.  
  1273. Put Back Commands
  1274. -----------------
  1275.  
  1276.    Deleted or yanked texts can be put back into the buffer by the
  1277. command below.
  1278.  
  1279. `p'
  1280.      Insert, after the character point is looking at, most recently
  1281.      deleted/yanked text from anonymous register. Given a register name
  1282.      argument, the content of the named register will be put back.
  1283.      Given a count, the command will be repeated that many times. This
  1284.      command also checks if the text to put back ends with a new line
  1285.      character, and if so the text will be put below the current line
  1286.      (`vip-put-back').
  1287.  
  1288. `P'
  1289.      Insert at point most recently deleted/yanked text from anonymous
  1290.      register.  Given a register name argument, the content of the
  1291.      named register will be put back.  Given a count, the command will
  1292.      be repeated that many times.  This command also checks if the text
  1293.      to put back ends with a new line character, and if so the text
  1294.      will be put above the current line rather than at point
  1295.      (`vip-Put-back').
  1296.  
  1297. Thus, `" c p' will put back the content of the register `c' into the
  1298. buffer.  It is also possible to specify "number register" which is a
  1299. numeral between `1' and `9'.  If the number register N is specified,
  1300. N-th previously deleted/yanked text will be put back.  It is an error
  1301. to specify a number register for the delete/yank commands.
  1302.  
  1303. 
  1304. File: vip,  Node: Change Commands,  Next: Repeating and Undoing Modifications,  Prev: Put Back Commands,  Up: Modifying Commands
  1305.  
  1306. Change Commands
  1307. ---------------
  1308.  
  1309.    Most commonly used change command takes the following form.
  1310.  
  1311. `c MOTION-COMMAND'
  1312.      Replace the content of the region determined by the motion command
  1313.      MOTION-COMMAND by the text you type.  If the motion command is a
  1314.      point command then you will type the text into minibuffer, and if
  1315.      the motion command is a line command then the region will be
  1316.      deleted first and you can insert the text in INSERT MODE.
  1317.  
  1318. For example, if point is at the beginning of a word `foo' and you wish
  1319. to change it to `bar', you can type `c w'.  Then, as `w' is a point
  1320. command, you will get the prompt `foo =>' in the minibuffer, for which
  1321. you can type `b a r RET' to complete the change command.
  1322.  
  1323. `c c'
  1324.      Change a line.  Given a count, that many lines are changed.
  1325.  
  1326. `c r'
  1327.      Change current region.
  1328.  
  1329. `c R'
  1330.      Expand current region and change it.
  1331.  
  1332. 
  1333. File: vip,  Node: Repeating and Undoing Modifications,  Next: Other Vi Commands,  Prev: Change Commands,  Up: Modifying Commands
  1334.  
  1335. Repeating and Undoing Modifications
  1336. -----------------------------------
  1337.  
  1338.    VIP records the previous modifying command, so that it is easy to
  1339. repeat it.  It is also very easy to undo changes made by modifying
  1340. commands.
  1341.  
  1342. `u'
  1343.      Undo the last change.  You can undo more by repeating undo by the
  1344.      repeat command `.'.  For example, you can undo 5 previous changes
  1345.      by typing `u....'.  If you type `uu', then the second `u' undoes
  1346.      the first undo command (`vip-undo').
  1347.  
  1348. `.'
  1349.      Repeat the last modifying command.  Given count N it becomes the
  1350.      new count for the repeated command.  Otherwise, the count for the
  1351.      last modifying command is used again (`vip-repeat').
  1352.  
  1353. 
  1354. File: vip,  Node: Other Vi Commands,  Next: Commands in Insert Mode,  Prev: Repeating and Undoing Modifications,  Up: Vi Commands
  1355.  
  1356. Other Vi Commands
  1357. =================
  1358.  
  1359.    Miscellaneous Vi commands are collected here.
  1360.  
  1361. `Z Z'
  1362.      Exit Emacs.  If modified buffers exist, you will be asked whether
  1363.      you wish to save them or not (`save-buffers-kill-emacs').
  1364.  
  1365. `! MOTION-COMMAND FORMAT-COMMAND'
  1366. `N ! ! FORMAT-COMMAND'
  1367.      The region determined by the motion command MOTION-COMMAND will be
  1368.      given to the shell command FORMAT-COMMAND and the region will be
  1369.      replaced by its output.  If a count is given, it will be passed to
  1370.      MOTION-COMMAND.  For example, `3!Gsort' will sort the region
  1371.      between point and the 3rd line.  If `!' is used instead of
  1372.      MOTION-COMMAND then N lines will be processed by FORMAT-COMMAND
  1373.      (`vip-command-argument').
  1374.  
  1375. `J'
  1376.      Join two lines.  Given count, join that many lines.  A space will
  1377.      be inserted at each junction (`vip-join-lines').
  1378.  
  1379. `< MOTION-COMMAND'
  1380. `N < <'
  1381.      Shift region determined by the motion command MOTION-COMMAND to
  1382.      left by SHIFT-WIDTH (default is 8).  If `<' is used instead of
  1383.      MOTION-COMMAND then shift N lines
  1384.      (`vip-command-argument').
  1385.  
  1386. `> MOTION-COMMAND'
  1387. `N > >'
  1388.      Shift region determined by the motion command MOTION-COMMAND to
  1389.      right by SHIFT-WIDTH (default is 8).  If `<' is used instead of
  1390.      MOTION-COMMAND then shift N lines
  1391.      (`vip-command-argument').
  1392.  
  1393. `= MOTION-COMMAND'
  1394.      Indent region determined by the motion command MOTION-COMMAND.  If
  1395.      `=' is used instead of MOTION-COMMAND then indent N lines
  1396.      (`vip-command-argument').
  1397.  
  1398. `*'
  1399.      Call last remembered keyboard macro.
  1400.  
  1401. `#'
  1402.      A new vi operator. *Note New Commands::, for more details.
  1403.  
  1404.    The following keys are reserved for future extensions, and currently
  1405. assigned to a function that just beeps (`vip-nil').
  1406.  
  1407.      &, @, U, [, ], _, q, ~
  1408.  
  1409.    VIP uses a special local keymap to interpret key strokes you enter
  1410. in vi mode.  The following keys are bound to NIL in the keymap.
  1411. Therefore, these keys are interpreted by the global keymap of Emacs.
  1412. We give below a short description of the functions bound to these keys
  1413. in the global keymap.  See GNU Emacs Manual for details.
  1414.  
  1415. `C-@'
  1416.      Set mark and push previous mark on mark ring (`set-mark-command').
  1417.  
  1418. `TAB'
  1419.      Indent line for current major mode (`indent-for-tab-command').
  1420.  
  1421. `LFD'
  1422.      Insert a newline, then indent according to mode
  1423.      (`newline-and-indent').
  1424.  
  1425. `C-k'
  1426.      Kill the rest of the current line; before a newline, kill the
  1427.      newline.  With a numeric argument, kill that many lines from
  1428.      point.  Negative arguments kill lines backward (`kill-line').
  1429.  
  1430. `C-l'
  1431.      Clear the screen and reprint everything (`recenter').
  1432.  
  1433. `N C-p'
  1434.      Move cursor vertically up N lines (`previous-line').
  1435.  
  1436. `C-q'
  1437.      Read next input character and insert it.  Useful for inserting
  1438.      control characters
  1439.      (`quoted-insert').
  1440.  
  1441. `C-r'
  1442.      Search backward incrementally (`isearch-backward').
  1443.  
  1444. `C-s'
  1445.      Search forward incrementally (`isearch-forward').
  1446.  
  1447. `N C-t'
  1448.      Interchange characters around point, moving forward one character.
  1449.      With count N, take character before point and drag it forward
  1450.      past N other characters.  If no argument and at end of line, the
  1451.      previous two characters are exchanged (`transpose-chars').
  1452.  
  1453. `N C-v'
  1454.      Scroll text upward N lines.  If N is not given, scroll near full
  1455.      screen (`scroll-up').
  1456.  
  1457. `C-w'
  1458.      Kill between point and mark.  The text is save in the kill ring.
  1459.      The command `P' or `p' can retrieve it from kill ring
  1460.      (`kill-region').
  1461.  
  1462.