|
|
1.1 ! root 1: % -*-texinfo-*- ! 2: ! 3: % Follow the following instructions to print the VIP manual. ! 4: % ! 5: % Run tex on this file: ! 6: % ! 7: % tex vip.texinfo ! 8: % ! 9: % This creates vip.dvi and some files for cross references and ! 10: % indices. Since the manual contains key index and concept ! 11: % index, it is necessary to create sorted index files for ! 12: % them. It is also necessary to edit the file vip.kys. This ! 13: % is done as follows. ! 14: % ! 15: % texindex vip.ky vip.cp ! 16: % sed -e '/\\initial/ d' -e 's/{[^ ]* /{/' vip.kys > tmp ! 17: % mv tmp vip.kys ! 18: % tex vip.texinfo ! 19: % ! 20: % The dvi file created by the second run of tex can be used ! 21: % for printing. ! 22: ! 23: \input texinfo ! 24: ! 25: @setfilename ../info/vip ! 26: @settitle VIP ! 27: ! 28: @iftex ! 29: @finalout ! 30: @end iftex ! 31: ! 32: @titlepage ! 33: @sp 10 ! 34: @center @titlefont{VIP} ! 35: @sp 1 ! 36: @center A Vi Package for GNU Emacs ! 37: @center (Version 3.5, September 15, 1987) ! 38: @sp 2 ! 39: @center Masahiko Sato ! 40: @sp 2 ! 41: @end titlepage ! 42: ! 43: @unnumbered Distribution ! 44: ! 45: Copyright @copyright{} 1987 Masahiko Sato. ! 46: ! 47: Permission is granted to make and distribute verbatim copies of ! 48: this manual provided the copyright notice and this permission notice ! 49: are preserved on all copies. ! 50: ! 51: @ignore ! 52: Permission is granted to process this file through Tex and print the ! 53: results, provided the printed document carries copying permission ! 54: notice identical to this one except for the removal of this paragraph ! 55: (this paragraph not being relevant to the printed manual). ! 56: ! 57: @end ignore ! 58: Permission is granted to copy and distribute modified versions of this ! 59: manual under the conditions for verbatim copying, provided that the entire ! 60: resulting derived work is distributed under the terms of a permission ! 61: notice identical to this one. ! 62: ! 63: Permission is granted to copy and distribute translations of this manual ! 64: into another language, under the same conditions as for modified versions. ! 65: ! 66: @ifinfo ! 67: @node Top, Survey,, (DIR) ! 68: ! 69: VIP ! 70: *** ! 71: ! 72: VIP is a Vi emulating package written in Emacs Lisp. VIP implements most ! 73: Vi commands including Ex commands. It is therefore hoped that this package ! 74: will enable you to do Vi style editing under the powerful GNU Emacs ! 75: environment. This info file describes the usage of VIP assuming that you ! 76: are fairly accustomed to Vi but not so much with Emacs. Also we will ! 77: concentrate mainly on differences from Vi, especially features unique to ! 78: VIP. ! 79: ! 80: It is recommended that you read nodes on survey and on customization before ! 81: you start using VIP. Other nodes may be visited as needed. ! 82: ! 83: Comments and bug reports are welcome. Please send messages to ! 84: @code{ms@@Sail.Stanford.Edu} if you are outside of Japan and to ! 85: @code{masahiko@@sato.riec.tohoku.junet} if you are in Japan.@refill ! 86: ! 87: @end ifinfo ! 88: ! 89: @menu ! 90: * Survey:: A survey of VIP. ! 91: * Vi Commands:: Details of Vi commands. ! 92: * Ex Commands:: Details of Ex commands. ! 93: * Customization:: How to customize VIP. ! 94: @end menu ! 95: @iftex ! 96: @unnumbered Introduction ! 97: ! 98: VIP is a Vi emulating package written in Emacs Lisp. VIP implements most ! 99: Vi commands including Ex commands. It is therefore hoped that this package ! 100: will enable you to do Vi style editing under the powerful GNU Emacs ! 101: environment. This manual describes the usage of VIP assuming that you are ! 102: fairly accustomed to Vi but not so much with Emacs. Also we will ! 103: concentrate mainly on differences from Vi, especially features unique to ! 104: VIP. ! 105: ! 106: It is recommended that you read chapters on survey and on customization ! 107: before you start using VIP. Other chapters may be used as future ! 108: references. ! 109: ! 110: Comments and bug reports are welcome. Please send messages to ! 111: @code{ms@@Sail.Stanford.Edu} if you are outside of Japan and to ! 112: @code{masahiko@@unsun.riec.tohoku.junet} if you are in Japan. ! 113: @end iftex ! 114: ! 115: @node Survey, Basic Concepts, Top, Top ! 116: @chapter A Survey of VIP ! 117: ! 118: In this chapter we describe basics of VIP with emphasis on the features not ! 119: found in Vi and on how to use VIP under GNU Emacs. ! 120: ! 121: @menu ! 122: * Basic Concepts:: Basic concepts in Emacs. ! 123: * Loading VIP:: How to load VIP automatically. ! 124: * Modes in VIP:: VIP has three modes, which are orthogonal to modes ! 125: in Emacs. ! 126: * Differences from Vi:: Differences of VIP from Vi is explained. ! 127: @end menu ! 128: ! 129: @node Basic Concepts, Loading VIP, Survey, Survey ! 130: @section Basic Concepts ! 131: ! 132: We begin by explaining some basic concepts of Emacs. These concepts are ! 133: explained in more detail in the GNU Emacs Manual. ! 134: ! 135: @cindex buffer ! 136: @cindex point ! 137: @cindex mark ! 138: @cindex text ! 139: @cindex looking at ! 140: @cindex end (of buffer) ! 141: @cindex region ! 142: ! 143: Conceptually, a @dfn{buffer} is just a string of ASCII characters and two ! 144: special characters @key{PNT} (@dfn{point}) and @key{MRK} (@dfn{mark}) such ! 145: that the character @key{PNT} occurs exactly once and @key{MRK} occurs at ! 146: most once. The @dfn{text} of a buffer is obtained by deleting the ! 147: occurrences of @key{PNT} and @key{MRK}. If, in a buffer, there is a ! 148: character following @key{PNT} then we say that point is @dfn{looking at} ! 149: the character; otherwise we say that point is @dfn{at the end of buffer}. ! 150: @key{PNT} and @key{MRK} are used ! 151: to indicate positions in a buffer and they are not part of the text of the ! 152: buffer. If a buffer contains a @key{MRK} then the text between @key{MRK} ! 153: and @key{PNT} is called the @dfn{region} of the buffer.@refill ! 154: ! 155: @cindex window ! 156: ! 157: Emacs provides (multiple) @dfn{windows} on the screen, and you can see the ! 158: content of a buffer through the window associated with the buffer. The ! 159: cursor of the screen is always positioned on the character after @key{PNT}. ! 160: @refill ! 161: ! 162: @cindex mode ! 163: @cindex keymap ! 164: @cindex local keymap ! 165: @cindex global keymap ! 166: ! 167: A @dfn{keymap} is a table that records the bindings between characters and ! 168: command functions. There is the @dfn{global keymap} common to all the ! 169: buffers. Each buffer has its @dfn{local keymap} that determines the ! 170: @dfn{mode} of the buffer. Local keymap overrides global keymap, so that if ! 171: a function is bound to some key in the local keymap then that function will ! 172: be executed when you type the key. If no function is bound to a key in the ! 173: local map, however, the function bound to the key in the global map becomes ! 174: in effect.@refill ! 175: ! 176: @node Loading VIP, Modes in VIP, Basic Concepts, Survey ! 177: @section Loading VIP ! 178: ! 179: The recommended way to load VIP automatically is to include the line: ! 180: @example ! 181: (load "vip") ! 182: @end example ! 183: @noindent ! 184: in your @file{.emacs} file. The @file{.emacs} file is placed in your home ! 185: directory and it will be executed every time you invoke Emacs. If you wish ! 186: to be in vi mode whenver Emacs starts up, you can include the following ! 187: line in your @file{.emacs} file instead of the above line: ! 188: @example ! 189: (setq term-setup-hook 'vip-mode) ! 190: @end example ! 191: @noindent ! 192: (@xref{Vi Mode}, for the explanation of vi mode.) ! 193: ! 194: Even if your @file{.emacs} file does not contain any of the above lines, ! 195: you can load VIP and enter vi mode by typing the following from within ! 196: Emacs. ! 197: @example ! 198: M-x vip-mode ! 199: @end example ! 200: @noindent ! 201: ! 202: @node Modes in VIP, Emacs Mode, Loading VIP, Survey ! 203: @section Modes in VIP ! 204: ! 205: @kindex 032 @kbd{C-z} (@code{vip-change-mode-to-vi}) ! 206: @kindex 0301 @kbd{C-x C-z} (@code{suspend-emacs}) ! 207: ! 208: Loading VIP has the effect of globally binding @kbd{C-z} (@kbd{Control-z}) ! 209: to the function @code{vip-change-mode-to-vi}. The default binding of @kbd{C-z} ! 210: in GNU Emacs is @code{suspend-emacs}, but, you can also call ! 211: @code{suspend-emacs} by typing @kbd{C-x C-z}. Other than this, all the ! 212: key bindings of Emacs remain the same after loading VIP.@refill ! 213: ! 214: @cindex vi mode ! 215: ! 216: Now, if you hit @kbd{C-z}, the function @code{vip-change-mode-to-vi} will be ! 217: called and you will be in @dfn{vi mode}. (Some major modes may locally bind ! 218: @kbd{C-z} to some special functions. In such cases, you can call ! 219: @code{vip-change-mode-to-vi} by @code{execute-extended-command} which is ! 220: invoked by @kbd{M-x}. Here @kbd{M-x} means @kbd{Meta-x}, and if your ! 221: terminal does not have a @key{META} key you can enter it by typing ! 222: @kbd{@key{ESC} x}. The same effect can also be achieve by typing ! 223: @kbd{M-x vip-mode}.)@refill ! 224: ! 225: @cindex mode line ! 226: ! 227: You can observe the change of mode by looking at the @dfn{mode line}. For ! 228: instance, if the mode line is:@refill ! 229: @example ! 230: -----Emacs: *scratch* (Lisp Interaction)----All------------ ! 231: @end example ! 232: @noindent ! 233: then it will change to: ! 234: @example ! 235: -----Vi: *scratch* (Lisp Interaction)----All------------ ! 236: @end example ! 237: @noindent ! 238: Thus the word @samp{Emacs} in the mode line will change to @samp{Vi}. ! 239: ! 240: @cindex insert mode ! 241: @cindex emacs mode ! 242: ! 243: You can go back to the original @dfn{emacs mode} by typing @kbd{C-z} in ! 244: vi mode. Thus @kbd{C-z} toggles between these two modes.@refill ! 245: ! 246: Note that modes in VIP exist orthogonally to modes in Emacs. This means ! 247: that you can be in vi mode and at the same time, say, shell mode. ! 248: ! 249: Vi mode corresponds to Vi's command mode. From vi mode you can enter ! 250: @dfn{insert mode} (which corresponds to Vi's insert mode) by usual Vi command ! 251: keys like @kbd{i}, @kbd{a}, @kbd{o} @dots{} etc. ! 252: ! 253: In insert mode, the mode line will look like this: ! 254: @example ! 255: -----Insert *scratch* (Lisp Interaction)----All------------ ! 256: @end example ! 257: @noindent ! 258: You can exit from insert mode by hitting @key{ESC} key as you do in Vi. ! 259: ! 260: That VIP has three modes may seem very complicated, but in fact it is not ! 261: so. VIP is implemented so that you can do most editing remaining only ! 262: in the two modes for Vi (that is vi mode and insert mode). ! 263: ! 264: @ifinfo ! 265: The figure below shows the transition of three modes in VIP. ! 266: @display ! 267: ! 268: ! 269: === C-z ==> == i,o ... ==> ! 270: emacs mode vi mode insert mode ! 271: <== X-z === <=== ESC ==== ! 272: @end display ! 273: @end ifinfo ! 274: ! 275: @menu ! 276: * Emacs Mode:: This is the mode you should know better. ! 277: * Vi Mode:: Vi commands are executed in this mode. ! 278: * Insert Mode:: You can enter text, and also can do editing if you ! 279: know enough Emacs commands. ! 280: @end menu ! 281: ! 282: @node Emacs Mode, Vi Mode, Modes in VIP, Modes in VIP ! 283: @subsection Emacs Mode ! 284: ! 285: @kindex 032 @kbd{C-z} (@code{vip-change-mode-to-vi}) ! 286: ! 287: You will be in this mode just after you loaded VIP. You can do all ! 288: normal Emacs editing in this mode. Note that the key @kbd{C-z} is globally ! 289: bound to @code{vip-change-mode-to-vi}. So, if you type @kbd{C-z} in this mode ! 290: then you will be in vi mode.@refill ! 291: ! 292: @node Vi Mode, Insert Mode, Emacs Mode, Modes in VIP ! 293: @subsection Vi Mode ! 294: ! 295: This mode corresponds to Vi's command mode. Most Vi commands work as they ! 296: do in Vi. You can go back to emacs mode by typing @kbd{C-z}. You can ! 297: enter insert mode, just as in Vi, by typing @kbd{i}, @kbd{a} etc. ! 298: ! 299: @node Insert Mode, Differences from Vi, Vi Mode, Modes in VIP ! 300: @subsection Insert Mode ! 301: ! 302: The key bindings in this mode is the same as in the emacs mode except for ! 303: the following 4 keys. So, you can move around in the buffer and change ! 304: its content while you are in insert mode. ! 305: ! 306: @table @kbd ! 307: @item @key{ESC} ! 308: @kindex 033 @kbd{ESC} (@code{vip-change-mode-to-vi}) (insert mode) ! 309: This key will take you back to vi mode. ! 310: @item C-h ! 311: @kindex 010 @kbd{C-h} (@code{vip-delete-backward-char}) (insert mode) ! 312: Delete previous character. ! 313: @item C-w ! 314: @kindex 027 @kbd{C-w} (@code{vip-delete-backward-word}) (insert mode) ! 315: Delete previous word. ! 316: @item C-z ! 317: @kindex 032 @kbd{C-z} (@code{vip-ESC}) (insert mode) ! 318: Typing this key has the same effect as typing @key{ESC} in emacs mode. ! 319: Thus typing @kbd{C-z x} in insert mode will have the same effect as typing ! 320: @kbd{ESC x} in emacs mode. ! 321: @end table ! 322: ! 323: @node Differences from Vi, Undoing, Insert Mode, Survey ! 324: @section Differences from Vi ! 325: ! 326: The major differences from Vi are explained below. ! 327: ! 328: @menu ! 329: * Undoing:: You can undo more in VIP. ! 330: * Changing:: Commands for changing the text. ! 331: * Searching:: Search commands. ! 332: * z Command:: You can now use zH, zM and zL as well as z- etc. ! 333: * Counts:: Some Vi commands which do not accept a count now ! 334: accept one. ! 335: * Marking:: You can now mark the current point, beginning of ! 336: the buffer etc. ! 337: * Region Commands:: You can now give a region as an argument for delete ! 338: commands etc. ! 339: * New Commands:: Some new commands not available in Vi are added. ! 340: * New Bindings:: Bindings of some keys are changed for the ! 341: convenience of editing under Emacs. ! 342: * Window Commands:: Commands for moving among windows etc. ! 343: * Buffer Commands:: Commands for selecting buffers etc. ! 344: * File Commands:: Commands for visiting files etc. ! 345: * Misc Commands:: Other useful commands. ! 346: @end menu ! 347: ! 348: @node Undoing, Changing, Differences from Vi, Differences from Vi ! 349: @subsection Undoing ! 350: ! 351: @kindex 165 @kbd{u} (@code{vip-undo}) ! 352: @kindex 056 @kbd{.} (@code{vip-repeat}) ! 353: ! 354: You can repeat undoing by the @kbd{.} key. So, @kbd{u} will undo ! 355: a single change, while @kbd{u .@: .@: .@:}, for instance, will undo 4 previous ! 356: changes. Undo is undoable as in Vi. So the content of the buffer will ! 357: be the same before and after @kbd{u u}.@refill ! 358: ! 359: @node Changing, Searching, Undoing, Differences from Vi ! 360: @subsection Changing ! 361: ! 362: Some commands which change a small number of characters are executed ! 363: slightly differently. Thus, if point is at the beginning of a word ! 364: @samp{foo} and you wished to change it to @samp{bar} by typing @w{@kbd{c w}}, ! 365: then VIP will prompt you for a new word in the minibuffer by the prompt ! 366: @samp{foo => }. You can then enter @samp{bar} followed by @key{RET} or ! 367: @key{ESC} to complete the command. Before you enter @key{RET} or ! 368: @key{ESC} you can abort the command by typing @kbd{C-g}. In general, ! 369: @kindex 007 @kbd{C-g} (@code{vip-keyboard-quit}) ! 370: you can abort a partially formed command by typing @kbd{C-g}.@refill ! 371: ! 372: @node Searching, z Command, Changing, Differences from Vi ! 373: @subsection Searching ! 374: ! 375: @kindex 057 @kbd{/} (@code{vip-search-forward}) ! 376: @kindex 077 @kbd{?} (@code{vip-search-backward}) ! 377: ! 378: As in Vi, searching is done by @kbd{/} and @kbd{?}. The string will be ! 379: searched literally by default. To invoke a regular expression search, ! 380: first execute the search command @kbd{/} (or @kbd{?}) with empty search ! 381: string. (I.e, type @kbd{/} followed by @key{RET}.) ! 382: A search for empty string will toggle the search mode between vanilla ! 383: search and regular expression search. You cannot give an offset to the ! 384: search string. (It is a limitation.) By default, search will wrap around ! 385: the buffer as in Vi. You can change this by rebinding the variable ! 386: @code{vip-search-wrap-around}. @xref{Customization}, for how to do this.@refill ! 387: ! 388: @node z Command, Counts, Searching, Differences from Vi ! 389: @subsection z Command ! 390: ! 391: @kindex 1723 @kbd{z H} (@code{vip-line-to-top}) ! 392: @kindex 1721 @kbd{z RET} (@code{vip-line-to-top}) ! 393: @kindex 1723 @kbd{z M} (@code{vip-line-to-middle}) ! 394: @kindex 1722 @kbd{z .} (@code{vip-line-to-middle}) ! 395: @kindex 1723 @kbd{z L} (@code{vip-line-to-bottom}) ! 396: @kindex 1722 @kbd{z -} (@code{vip-line-to-bottom}) ! 397: ! 398: For those of you who cannot remember which of @kbd{z} followed by @key{RET}, ! 399: @kbd{.}@: and @kbd{-} do what. You can also use @kbd{z} followed by @kbd{H}, ! 400: @kbd{M} and @kbd{L} to place the current line in the Home (Middle, and ! 401: Last) line of the window.@refill ! 402: ! 403: @node Counts, Marking, z Command, Differences from Vi ! 404: @subsection Counts ! 405: ! 406: Some Vi commands which do not accept a count now accept one ! 407: ! 408: @table @kbd ! 409: @item p ! 410: @itemx P ! 411: @kindex 160 @kbd{p} (@code{vip-put-back}) ! 412: @kindex 120 @kbd{P} (@code{vip-Put-back}) ! 413: Given counts, text will be yanked (in Vi's sense) that many times. Thus ! 414: @kbd{3 p} is the same as @kbd{p p p}. ! 415: @item o ! 416: @itemx O ! 417: @kindex 157 @kbd{o} (@code{vip-open-line}) ! 418: @kindex 117 @kbd{O} (@code{vip-Open-line}) ! 419: Given counts, that many copies of text will be inserted. Thus ! 420: @kbd{o a b c @key{ESC}} will insert 3 lines of @samp{abc} below the current ! 421: line. ! 422: @item / ! 423: @itemx ? ! 424: @kindex 057 @kbd{/} (@code{vip-search-forward}) ! 425: @kindex 077 @kbd{?} (@code{vip-search-backward}) ! 426: Given a count @var{n}, @var{n}-th occurrence will be searched. ! 427: @end table ! 428: ! 429: @node Marking, Region Commands, Counts, Differences from Vi ! 430: @subsection Marking ! 431: ! 432: Typing an @kbd{m} followed by a lower case character @var{ch} marks the ! 433: point to the register named @var{ch} as in Vi. In addition to these, we ! 434: have following key bindings for marking. ! 435: ! 436: @kindex 155 @kbd{m} (@code{vip-mark-point}) ! 437: ! 438: @table @kbd ! 439: @item m < ! 440: Set mark at the beginning of buffer. ! 441: @item m > ! 442: Set mark at the end of buffer. ! 443: @item m . ! 444: Set mark at point (and push old mark on mark ring). ! 445: @item m , ! 446: Jump to mark (and pop mark off the mark ring). ! 447: @end table ! 448: ! 449: @node Region Commands, New Commands, Marking, Differences from Vi ! 450: @subsection Region Commands ! 451: ! 452: @cindex region ! 453: ! 454: Vi operators like @kbd{d}, @kbd{c} etc. are usually used in combination ! 455: with motion commands. It is now possible to use current region as the ! 456: argument to these operators. (A @dfn{region} is a part of buffer ! 457: delimited by point and mark.) The key @kbd{r} is used for this purpose. ! 458: Thus @kbd{d r} will delete the current region. If @kbd{R} is used instead ! 459: of @kbd{r} the region will first be enlarged so that it will become the ! 460: smallest region containing the original region and consisting of whole ! 461: lines. Thus @kbd{m .@: d R} will have the same effect as @kbd{d d}.@refill ! 462: ! 463: @node New Commands, New Bindings, Region Commands, Differences from Vi ! 464: @subsection Some New Commands ! 465: ! 466: Note that the keys below (except for @kbd{R}) are not used in Vi. ! 467: ! 468: @table @kbd ! 469: @item C-a ! 470: @kindex 001 @kbd{C-a} (@code{vip-beginning-of-line}) ! 471: Move point to the beginning of line. ! 472: @item C-n ! 473: @kindex 016 @kbd{C-n} (@code{vip-next-window}) ! 474: If you have two or more windows in the screen, this key will move point to ! 475: the next window. ! 476: @item C-o ! 477: @kindex 017 @kbd{C-o} (@code{vip-open-line-at-point}) ! 478: Insert a newline and leave point before it, and then enter insert mode. ! 479: @item C-r ! 480: @kindex 022 @kbd{C-r} (@code{isearch-backward}) ! 481: Backward incremental search. ! 482: @item C-s ! 483: @kindex 023 @kbd{C-s} (@code{isearch-forward}) ! 484: Forward incremental search. ! 485: @item C-c ! 486: @itemx C-x ! 487: @itemx @key{ESC} ! 488: @kindex 003 @kbd{C-c} (@code{vip-ctl-c}) ! 489: @kindex 0300 @kbd{C-x} (@code{vip-ctl-x}) ! 490: @kindex 033 @kbd{ESC} (@code{vip-ESC}) ! 491: These keys will exit from vi mode and return to emacs mode temporarily. If ! 492: you hit one of these keys, Emacs will be in emacs mode and will believe ! 493: that you hit that key in emacs mode. For example, if you hit @kbd{C-x} ! 494: followed by @kbd{2}, then the current window will be split into 2 and you ! 495: will be in vi mode again. ! 496: @item \ ! 497: @kindex 134 @kbd{\} (@code{vip-escape-to-emacs}) ! 498: Escape to emacs mode. Hitting @kbd{\} will take you to emacs mode, and you ! 499: can execute a single Emacs command. After executing the Emacs command you ! 500: will be in vi mode again. You can give a count before typing @kbd{\}. ! 501: Thus @kbd{5 \ *}, as well as @kbd{\ C-u 5 *}, will insert @samp{*****} ! 502: before point. Similarly @kbd{1 0 \ C-p} will move the point 10 lines above ! 503: the current line.@refill ! 504: @item K ! 505: @kindex 113 @kbd{K} (@code{vip-kill-buffer}) ! 506: Kill current buffer if it is not modified. Useful when you selected a ! 507: buffer which you did not want. ! 508: @item Q ! 509: @itemx R ! 510: @kindex 121 @kbd{Q} (@code{vip-query-replace}) ! 511: @kindex 122 @kbd{R} (@code{vip-replace-string}) ! 512: @kbd{Q} is for query replace and @kbd{R} is for replace. By default, ! 513: string to be replaced are treated literally. If you wish to do a regular ! 514: expression replace, first do replace with empty string as the string to be ! 515: replaced. In this way, you can toggle between vanilla and regular ! 516: expression replacement. ! 517: @item v ! 518: @itemx V ! 519: @kindex 166 @kbd{v} (@code{vip-find-file}) ! 520: @kindex 126 @kbd{V} (@code{vip-find-file-other-window}) ! 521: These keys are used to Visit files. @kbd{v} will switch to a buffer ! 522: visiting file whose name can be entered in the minibuffer. @kbd{V} is ! 523: similar, but will use window different from the current window. ! 524: @item # ! 525: @kindex 0430 @kbd{#} (@code{vip-command-argument}) ! 526: If followed by a certain character @var{ch}, it becomes an operator whose ! 527: argument is the region determined by the motion command that follows. ! 528: Currently, @var{ch} can be one of @kbd{c}, @kbd{C}, @kbd{g}, @kbd{q} and ! 529: @kbd{s}.@refill ! 530: @item # c ! 531: @kindex 0432 @kbd{# c} (@code{downcase-region}) ! 532: Change upper case characters in the region to lower case ! 533: (@code{downcase-region}). ! 534: @item # C ! 535: @kindex 0431 @kbd{# C} (@code{upcase-region}) ! 536: Change lower case characters in the region to upper case. For instance, ! 537: @kbd{# C 3 w} will capitalize 3 words from the current point ! 538: (@code{upcase-region}). ! 539: @item # g ! 540: @kindex 0432 @kbd{# g} (@code{vip-global-execute}) ! 541: Execute last keyboard macro for each line in the region ! 542: (@code{vip-global-execute}).@refill ! 543: @item # q ! 544: @kindex 0432 @kbd{# q} (@code{vip-quote-region}) ! 545: Insert specified string at the beginning of each line in the region ! 546: (@code{vip-quote-region}). ! 547: @item # s ! 548: @kindex 0432 @kbd{# s} (@code{spell-region}) ! 549: Check spelling of words in the region (@code{spell-region}). ! 550: @item * ! 551: @kindex 052 @kbd{*} (@code{vip-call-last-kbd-macro}) ! 552: Call last keyboard macro. ! 553: @end table ! 554: ! 555: @node New Bindings, Window Commands, New Commands, Differences from Vi ! 556: @subsection New Key Bindings ! 557: ! 558: In VIP the meanings of some keys are entirely different from Vi. These key ! 559: bindings are done deliberately in the hope that editing under Emacs will ! 560: become easier. It is however possible to rebind these keys to functions ! 561: which behave similarly as in Vi. @xref{Customizing Key Bindings}, for ! 562: details. ! 563: ! 564: @table @kbd ! 565: @item C-g ! 566: @itemx g ! 567: @kindex 007 @kbd{C-g} (@code{vip-keyboard-quit}) ! 568: @kindex 147 @kbd{g} (@code{vip-info-on-file}) ! 569: In Vi, @kbd{C-g} is used to get information about the file associated to ! 570: the current buffer. Here, @kbd{g} will do that, and @kbd{C-g} is ! 571: used to abort a command (this is for compatibility with emacs mode.) ! 572: @item SPC ! 573: @itemx @key{RET} ! 574: @kindex 040 @kbd{SPC} (@code{vip-scroll}) ! 575: @kindex 015 @kbd{RET} (@code{vip-scroll-back}) ! 576: Now these keys will scroll up and down the text of current window. ! 577: Convenient for viewing the text. ! 578: @item s ! 579: @itemx S ! 580: @kindex 163 @kbd{s} (@code{vip-switch-to-buffer}) ! 581: @kindex 123 @kbd{S} (@code{vip-switch-to-buffer-other-window}) ! 582: They are used to switch to a specified buffer. Useful for switching to ! 583: already existing buffer since buffer name completion is provided. Also ! 584: a default buffer will be given as part of the prompt, to which you can ! 585: switch by just typing @key{RET} key. @kbd{s} is used to select buffer ! 586: in the current window, while @kbd{S} selects buffer in another window. ! 587: @item C ! 588: @itemx X ! 589: @kindex 103 @kbd{C} (@code{vip-ctl-c-equivalent}) ! 590: @kindex 1300 @kbd{X} (@code{vip-ctl-x-equivalent}) ! 591: These keys will exit from vi mode and return to emacs mode temporarily. ! 592: If you type @kbd{C} (@kbd{X}), Emacs will be in emacs mode and will believe ! 593: that you have typed @kbd{C-c} (@kbd{C-x}, resp.) in emacs mode. Moreover, ! 594: if the following character you type is an upper case letter, then Emacs ! 595: will believe that you have typed the corresponding control character. ! 596: You will be in vi mode again after the command is executed. For example, ! 597: typing @kbd{X S} in vi mode is the same as typing @kbd{C-x C-s} in emacs ! 598: mode. You get the same effect by typing @kbd{C-x C-s} in vi mode, but ! 599: the idea here is that you can execute useful Emacs commands without typing ! 600: control characters. For example, if you hit @kbd{X} (or @kbd{C-x}) followed ! 601: by @kbd{2}, then the current window will be split into 2 and you will be in ! 602: vi mode again.@refill ! 603: @end table ! 604: ! 605: In addition to these, @code{ctl-x-map} is slightly modified: ! 606: ! 607: @kindex 1301 @kbd{X 3} (@code{vip-buffer-in-two-windows}) ! 608: ! 609: @table @kbd ! 610: @item X 3 ! 611: @itemx C-x 3 ! 612: This is equivalent to @kbd{C-x 1 C-x 2} (1 + 2 = 3). ! 613: @end table ! 614: ! 615: @node Window Commands, Buffer Commands, New Bindings, Differences from Vi ! 616: @subsection Window Commands ! 617: ! 618: In this and following subsections, we give a summary of key bindings for ! 619: basic functions related to windows, buffers and files. ! 620: ! 621: @table @kbd ! 622: @item C-n ! 623: @kindex 016 @kbd{C-n} (@code{vip-next-window}) ! 624: Switch to next window. ! 625: @item X 1 ! 626: @itemx C-x 1 ! 627: @kindex 1301 @kbd{X 1} (@code{delete-other-windows}) ! 628: Delete other windows. ! 629: @item X 2 ! 630: @itemx C-x 2 ! 631: @kindex 1301 @kbd{X 2} (@code{split-window-vertically}) ! 632: Split current window into two windows. ! 633: @item X 3 ! 634: @itemx C-x 3 ! 635: @kindex 1301 @kbd{X 3} (@code{vip-buffer-in-two-windows}) ! 636: Show current buffer in two windows. ! 637: @end table ! 638: ! 639: @node Buffer Commands, File Commands, Window Commands, Differences from Vi ! 640: @subsection Buffer Commands ! 641: ! 642: @table @kbd ! 643: @item s ! 644: @kindex 163 @kbd{s} (@code{vip-switch-to-buffer}) ! 645: Switch to the specified buffer in the current window ! 646: (@code{vip-switch-to-buffer}). ! 647: @item S ! 648: @kindex 123 @kbd{S} (@code{vip-switch-to-buffer-other-window}) ! 649: Switch to the specified buffer in another window ! 650: (@code{vip-switch-to-buffer-other-window}). ! 651: @item K ! 652: @kindex 113 @kbd{K} (@code{vip-kill-buffer}) ! 653: Kill the current buffer if it is not modified. ! 654: @item X S ! 655: @itemx C-x C-s ! 656: @kindex 1302 @kbd{X S} (@code{save-buffer}) ! 657: Save the current buffer in the file associated to the buffer. ! 658: @end table ! 659: ! 660: @node File Commands, Misc Commands, Buffer Commands, Differences from Vi ! 661: @subsection File Commands ! 662: ! 663: @table @kbd ! 664: @item v ! 665: @kindex 166 @kbd{v} (@code{vip-find-file}) ! 666: Visit specified file in the current window. ! 667: @item V ! 668: @kindex 126 @kbd{V} (@code{vip-find-file-other-window}) ! 669: Visit specified file in another window. ! 670: @item X W ! 671: @itemx C-x C-w ! 672: @kindex 1302 @kbd{X W} (@code{write-file}) ! 673: Write current buffer into the specified file. ! 674: @item X I ! 675: @itemx C-x C-i ! 676: @kindex 1302 @kbd{X I} (@code{insert-file}) ! 677: ! 678: Insert specified file at point. ! 679: @end table ! 680: ! 681: @node Misc Commands, Vi Commands, File Commands, Differences from Vi ! 682: @subsection Miscellaneous Commands ! 683: ! 684: @table @kbd ! 685: @item X ( ! 686: @itemx C-x ( ! 687: @kindex 1301 @kbd{X (} (@code{start-kbd-macro}) ! 688: Start remembering keyboard macro. ! 689: @item X ) ! 690: @itemx C-x ) ! 691: @kindex 1301 @kbd{X )} (@code{end-kbd-macro}) ! 692: Finish remembering keyboard macro. ! 693: @item * ! 694: @kindex 052 @kbd{*} (@code{vip-call-last-kbd-macro}) ! 695: Call last remembered keyboard macro. ! 696: @item X Z ! 697: @itemx C-x C-z ! 698: @kindex 1302 @kbd{X Z} (@code{suspend-emacs}) ! 699: Suspend Emacs. ! 700: @item Z Z ! 701: Exit Emacs. ! 702: @itemx Q ! 703: Query replace. ! 704: @itemx R ! 705: Replace. ! 706: @end table ! 707: ! 708: @node Vi Commands, Numeric Arguments, Misc Commands, Top ! 709: @chapter Vi Commands ! 710: ! 711: This chapter describes Vi commands other than Ex commands implemented in ! 712: VIP. Except for the last section which discusses insert mode, all the ! 713: commands described in this chapter are to be used in vi mode. ! 714: ! 715: @menu ! 716: * Numeric Arguments:: Many commands accept numeric arguments ! 717: * Important Keys:: Some very important keys. ! 718: * Buffers and Windows:: Commands for handling buffers and windows. ! 719: * Files:: Commands for handling files. ! 720: * Viewing the Buffer:: How you can view the current buffer. ! 721: * Mark Commands:: Marking positions in a buffer. ! 722: * Motion Commands:: Commands for moving point. ! 723: * Modifying Commands:: Commands for modifying the buffer. ! 724: @end menu ! 725: ! 726: @node Numeric Arguments, Important Keys, Vi Commands, Vi Commands ! 727: @section Numeric Arguments ! 728: ! 729: @cindex numeric arguments ! 730: @cindex count ! 731: @kindex 061 @kbd{1} (numeric argument) ! 732: @kindex 062 @kbd{2} (numeric argument) ! 733: @kindex 063 @kbd{3} (numeric argument) ! 734: @kindex 064 @kbd{4} (numeric argument) ! 735: @kindex 065 @kbd{5} (numeric argument) ! 736: @kindex 066 @kbd{6} (numeric argument) ! 737: @kindex 067 @kbd{7} (numeric argument) ! 738: @kindex 068 @kbd{8} (numeric argument) ! 739: @kindex 069 @kbd{9} (numeric argument) ! 740: ! 741: Most Vi commands accept a @dfn{numeric argument} which can be supplied as ! 742: a prefix to the commands. A numeric argument is also called a @dfn{count}. ! 743: In many cases, if a count is given, the command is executed that many times. ! 744: For instance, @kbd{5 d d} deletes 5 lines while simple @kbd{d d} deletes a ! 745: line. In this manual the metavariable @var{n} will denote a count.@refill ! 746: ! 747: @node Important Keys, Buffers and Windows, Numeric Arguments, Vi Commands ! 748: @section Important Keys ! 749: ! 750: The keys @kbd{C-g} and @kbd{C-l} are unique in that their associated ! 751: functions are the same in any of emacs, vi and insert mode. ! 752: ! 753: @table @kbd ! 754: @item C-g ! 755: @kindex 007 @kbd{C-g} (@code{vip-keyboard-quit}) ! 756: Quit. Cancel running or partially typed command (@code{keyboard-quit}). ! 757: @item C-l ! 758: @kindex 014 @kbd{C-l} (@code{recenter}) ! 759: Clear the screen and reprint everything (@code{recenter}). ! 760: @end table ! 761: ! 762: In Emacs many commands are bound to the key strokes that start with ! 763: @kbd{C-x}, @kbd{C-c} and @key{ESC}. These commands can be ! 764: accessed from vi mode as easily as from emacs mode.@refill ! 765: ! 766: @table @kbd ! 767: @item C-x ! 768: @itemx C-c ! 769: @itemx @key{ESC} ! 770: @kindex 003 @kbd{C-c} (@code{vip-ctl-c}) ! 771: @kindex 0300 @kbd{C-x} (@code{vip-ctl-x}) ! 772: @kindex 033 @kbd{ESC} (@code{vip-ESC}) ! 773: Typing one of these keys have the same effect as typing it in emacs mode. ! 774: Appropriate command will be executed according as the keys you type after ! 775: it. You will be in vi mode again after the execution of the command. ! 776: For instance, if you type @kbd{@key{ESC} <} (in vi mode) then the cursor will ! 777: move to the beginning of the buffer and you will still be in vi mode. ! 778: @item C ! 779: @itemx X ! 780: @kindex 103 @kbd{C} (@code{vip-ctl-c-equivalent}) ! 781: @kindex 1300 @kbd{X} (@code{vip-ctl-x-equivalent}) ! 782: Typing one of these keys have the effect of typing the corresponding ! 783: control character in emacs mode. Moreover, if you type an upper case ! 784: character following it, that character will also be translated to the ! 785: corresponding control character. Thus typing @kbd{X W} in vi mode is the ! 786: same as typing @kbd{C-x C-w} in emacs mode. You will be in vi mode again ! 787: after the execution of a command. ! 788: @item \ ! 789: @kindex 134 @kbd{\} (@code{vip-escape-to-emacs}) ! 790: Escape to emacs mode. Hitting the @kbd{\} key will take you to emacs mode, ! 791: and you can execute a single Emacs command. After executing the ! 792: Emacs command you will be in vi mode again. You can give a count before ! 793: typing @kbd{\}. Thus @kbd{5 \ +}, as well as @kbd{\ C-u 5 +}, will insert ! 794: @samp{+++++} before point.@refill ! 795: @end table ! 796: ! 797: @node Buffers and Windows, Files, Important Keys, Vi Commands ! 798: @section Buffers and Windows ! 799: ! 800: @cindex buffer ! 801: @cindex selected buffer ! 802: @cindex current buffer ! 803: ! 804: In Emacs the text you edit is stored in a @dfn{buffer}. ! 805: See GNU Emacs Manual, for details. There is always one @dfn{selected} ! 806: buffer which is called the @dfn{current buffer}.@refill ! 807: ! 808: @cindex window ! 809: @cindex modified (buffer) ! 810: ! 811: You can see the contents of buffers through @dfn{windows} created by Emacs. ! 812: When you have multiple windows on the screen only one of them is selected. ! 813: Each buffer has a unique name, and each window has a mode line which shows ! 814: the name of the buffer associated with the window and other information ! 815: about the status of the buffer. You can change the format of the mode ! 816: line, but normally if you see @samp{**} at the beginning of a mode line it ! 817: means that the buffer is @dfn{modified}. If you write out the content of ! 818: the buffer to a file, then the buffer will become not modified. Also if ! 819: you see @samp{%%} at the beginning of the mode line, it means that the file ! 820: associated with the buffer is write protected. ! 821: ! 822: We have the following commands related to windows and buffers. ! 823: ! 824: @table @kbd ! 825: @item C-n ! 826: @kindex 016 @kbd{C-n} (@code{vip-next-window}) ! 827: Move cursor to the next-window (@code{vip-next-window}). ! 828: @item X 1 ! 829: @kindex 1301 @kbd{X 1} (@code{delete-other-windows}) ! 830: Delete other windows and make the selected window fill the screen ! 831: @*(@code{delete-other-windows}). ! 832: @item X 2 ! 833: @kindex 1301 @kbd{X 2} (@code{split-window-vertically}) ! 834: Split current window into two windows (@code{split-window-vertically}). ! 835: @item X 3 ! 836: @kindex 1301 @kbd{X 3} (@code{vip-buffer-in-two-windows}) ! 837: Show current buffer in two windows. ! 838: @item s @var{buffer} @key{RET} ! 839: @kindex 163 @kbd{s} (@code{vip-switch-to-buffer}) ! 840: Select or create a buffer named @var{buffer} (@code{vip-switch-to-buffer}). ! 841: @item S @var{buffer} @key{RET} ! 842: @kindex 123 @kbd{S} (@code{vip-switch-to-buffer-other-window}) ! 843: Similar but select a buffer named @var{buffer} in another window ! 844: @*(@code{vip-switch-to-buffer-other-window}). ! 845: @item K ! 846: @kindex 113 @kbd{K} (@code{vip-kill-buffer}) ! 847: Kill the current buffer if it is not modified or if it is not associated ! 848: with a file @*(@code{vip-kill-buffer}). ! 849: @item X B ! 850: @kindex 1302 @kbd{X B} (@code{list-buffers}) ! 851: List the existing buffers (@code{list-buffers}). ! 852: @end table ! 853: ! 854: @cindex buffer name completion ! 855: ! 856: As @dfn{buffer name completion} is provided, you have only to type in ! 857: initial substring of the buffer name which is sufficient to identify it ! 858: among names of existing buffers. After that, if you hit @key{TAB} the rest ! 859: of the buffer name will be supplied by the system, and you can confirm it ! 860: by @key{RET}. The default buffer name to switch to will also be prompted, ! 861: and you can select it by giving a simple @key{RET}. See GNU Emacs Manual ! 862: for details of completion. ! 863: ! 864: @node Files, Viewing the Buffer, Buffers and Windows, Vi Commands ! 865: @section Files ! 866: ! 867: We have the following commands related to files. They are used to visit, ! 868: save and insert files. ! 869: ! 870: @table @kbd ! 871: @item v @var{file} @key{RET} ! 872: @kindex 166 @kbd{v} (@code{vip-find-file}) ! 873: Visit specified file in the current window (@code{vip-find-file}). ! 874: @item V @var{file} @key{RET} ! 875: @kindex 126 @kbd{V} (@code{vip-find-file-other-window}) ! 876: Visit specified file in another window (@code{vip-find-file-other-window}). ! 877: @item X S ! 878: @kindex 1302 @kbd{X S} (@code{save-buffer}) ! 879: Save current buffer to the file associated with the buffer. If no file is ! 880: associated with the buffer, the name of the file to write out the content ! 881: of the buffer will be asked in the minibuffer. ! 882: @item X W @var{file} @key{RET} ! 883: @kindex 1302 @kbd{X W} (@code{write-file}) ! 884: Write current buffer into a specified file. ! 885: @item X I @var{file} @key{RET} ! 886: @kindex 1302 @kbd{X I} (@code{insert-file}) ! 887: Insert a specified file at point. ! 888: @item g ! 889: @kindex 147 @kbd{g} (@code{vip-info-on-file}) ! 890: Give information on the file associated with the current buffer. Tell you ! 891: the name of the file associated with the buffer, the line number of the ! 892: current point and total line numbers in the buffer. If no file is ! 893: associated with the buffer, this fact will be indicated by the null file ! 894: name @samp{""}. ! 895: @end table ! 896: ! 897: @cindex visiting (a file) ! 898: @cindex default directory ! 899: ! 900: In Emacs, you can edit a file by @dfn{visiting} it. If you wish to visit a ! 901: file in the current window, you can just type @kbd{v}. Emacs maintains the ! 902: @dfn{default directory} which is specific to each buffer. Suppose, for ! 903: instance, that the default directory of the current buffer is ! 904: @file{/usr/masahiko/lisp/}. Then you will get the following prompt in the ! 905: minibuffer.@refill ! 906: @example ! 907: visit file: /usr/masahiko/lisp/ ! 908: @end example ! 909: @noindent ! 910: @cindex file name completion ! 911: If you wish to visit, say, @file{vip.el} in this directory, then you can ! 912: just type @samp{vip.el} followed by @key{RET}. If the file @file{vip.el} ! 913: already exists in the directory, Emacs will visit that file, and if not, ! 914: the file will be created. Emacs will use the file name (@file{vip.el}, in ! 915: this case) as the name of the buffer visiting the file. In order to make ! 916: the buffer name unique, Emacs may append @samp{<2>}, @samp{<3>} etc., to ! 917: the buffer name. As the @dfn{file name completion} is provided here, you ! 918: can sometime save typing. For instance, suppose there is only one file in the ! 919: default directory whose name starts with @samp{v}, that is @samp{vip.el}. ! 920: Then if you just type @kbd{v @key{TAB}} then it will be completed to ! 921: @samp{vip.el}. Thus, in this case, you just have to type @kbd{v v @key{TAB} ! 922: @key{RET}} to visit @file{/usr/masahiko/lisp/vip.el}. Continuing the ! 923: example, let us now suppose that you wished to visit the file ! 924: @file{/usr/masahiko/man/vip.texinfo}. Then to the same prompt which you get ! 925: after you typed @kbd{v}, you can enter @samp{/usr/masahiko/man/vip.texinfo} or ! 926: @samp{../man/vip.texinfo} followed by @key{RET}. ! 927: ! 928: Use @kbd{V} instead of @kbd{v}, if you wish to visit a file in another ! 929: window. ! 930: ! 931: You can verify which file you are editing by typing @kbd{g}. (You can also ! 932: type @kbd{X B} to get nformation on other buffers too.) If you type ! 933: @kbd{g} you will get an information like below in the echo area:@refill ! 934: @example ! 935: "/usr/masahiko/man/vip.texinfo" line 921 of 1949 ! 936: @end example ! 937: ! 938: After you edited the buffer (@samp{vip.texinfo}, in our example) for a while, ! 939: you may wish to save it in a file. If you wish to save it in the file ! 940: associated with the buffer (@file{/usr/masahiko/man/vip.texinfo}, in this ! 941: case), you can just say @kbd{X S}. If you wish to save it in another file, ! 942: you can type @kbd{X W}. You will then get a similar prompt as you get for ! 943: @kbd{v}, to which you can enter the file name.@refill ! 944: ! 945: @node Viewing the Buffer, Mark Commands, Files, Vi Commands ! 946: @section Viewing the Buffer ! 947: ! 948: In this and next section we discuss commands for moving around in the ! 949: buffer. These command do not change the content of the buffer. The ! 950: following commands are useful for viewing the content of the current ! 951: buffer. ! 952: ! 953: @table @kbd ! 954: @item @key{SPC} ! 955: @itemx C-f ! 956: @kindex 040 @kbd{SPC} (@code{vip-scroll}) ! 957: @kindex 006 @kbd{C-f} (@code{vip-scroll-back}) ! 958: Scroll text of current window upward almost full screen. You can go ! 959: @i{forward} in the buffer by this command (@code{vip-scroll}). ! 960: @item @key{RET} ! 961: @itemx C-b ! 962: @kindex 015 @kbd{RET} (@code{vip-scroll-back}) ! 963: @kindex 002 @kbd{C-b} (@code{vip-scroll-back}) ! 964: Scroll text of current window downward almost full screen. You can go ! 965: @i{backward} in the buffer by this command (@code{vip-scroll-back}). ! 966: @itemx C-d ! 967: @kindex 004 @kbd{C-d} (@code{vip-scroll-up}) ! 968: Scroll text of current window upward half screen. You can go ! 969: @i{down} in the buffer by this command (@code{vip-scroll-down}). ! 970: @itemx C-u ! 971: @kindex 025 @kbd{C-u} (@code{vip-scroll-down}) ! 972: Scroll text of current window downward half screen. You can go ! 973: @i{up} in the buffer by this command (@code{vip-scroll-up}). ! 974: @item C-y ! 975: @kindex 031 @kbd{C-y} (@code{vip-scroll-down-one}) ! 976: Scroll text of current window upward by one line (@code{vip-scroll-down-one}). ! 977: @item C-e ! 978: @kindex 005 @kbd{C-e} (@code{vip-scroll-up-one}) ! 979: Scroll text of current window downward by one line (@code{vip-scroll-up-one}). ! 980: @end table ! 981: @noindent ! 982: You can repeat these commands by giving a count. Thus, @kbd{2 @key{SPC}} ! 983: has the same effect as @kbd{@key{SPC} @key{SPC}}. ! 984: ! 985: The following commands reposition point in the window. ! 986: ! 987: @table @kbd ! 988: @item z H ! 989: @itemx z @key{RET} ! 990: @kindex 1723 @kbd{z H} (@code{vip-line-to-top}) ! 991: @kindex 1721 @kbd{z RET} (@code{vip-line-to-top}) ! 992: Put point on the top (@i{home}) line in the window. So the current line ! 993: becomes the top line in the window. Given a count @var{n}, point will be ! 994: placed in the @var{n}-th line from top (@code{vip-line-to-top}). ! 995: @item z M ! 996: @itemx z . ! 997: @kindex 1723 @kbd{z M} (@code{vip-line-to-middle}) ! 998: @kindex 1722 @kbd{z .} (@code{vip-line-to-middle}) ! 999: Put point on the @i{middle} line in the window. Given a count @var{n}, ! 1000: point will be placed in the @var{n}-th line from the middle line ! 1001: (@code{vip-line-to-middle}). ! 1002: @item z L ! 1003: @itemx z - ! 1004: @kindex 1723 @kbd{z L} (@code{vip-line-to-bottom}) ! 1005: @kindex 1722 @kbd{z -} (@code{vip-line-to-bottom}) ! 1006: Put point on the @i{bottom} line in the window. Given a count @var{n}, ! 1007: point will be placed in the @var{n}-th line from bottom ! 1008: (@code{vip-line-to-bottom}). ! 1009: @item C-l ! 1010: Center point in window and redisplay screen (@code{recenter}). ! 1011: @end table ! 1012: ! 1013: @node Mark Commands, Motion Commands, Viewing the Buffer, Vi Commands ! 1014: @section Mark Commands ! 1015: ! 1016: The following commands are used to mark positions in the buffer. ! 1017: ! 1018: @table @kbd ! 1019: @item m @var{ch} ! 1020: @kindex 155 @kbd{m} (@code{vip-mark-point}) ! 1021: Store current point in the register @var{ch}. @var{ch} must be a lower ! 1022: case character between @kbd{a} and @kbd{z}. ! 1023: @item m < ! 1024: Set mark at the beginning of current buffer. ! 1025: @item m > ! 1026: Set mark at the end of current buffer. ! 1027: @item m . ! 1028: Set mark at point. ! 1029: @item m , ! 1030: Jump to mark (and pop mark off the mark ring). ! 1031: @end table ! 1032: ! 1033: @cindex mark ring ! 1034: ! 1035: Emacs uses the @dfn{mark ring} to store marked positions. The commands ! 1036: @kbd{m <}, @kbd{m >} and @kbd{m .}@: not only set mark but also add it as the ! 1037: latest element of the mark ring (replacing the oldest one). By repeating ! 1038: the command `@kbd{m ,}' you can visit older and older marked positions. You ! 1039: will eventually be in a loop as the mark ring is a ring. ! 1040: ! 1041: @node Motion Commands, Searching and Replacing, Mark Commands, Vi Commands ! 1042: @section Motion Commands ! 1043: ! 1044: Commands for moving around in the current buffer are collected here. These ! 1045: commands are used as an `argument' for the delete, change and yank commands ! 1046: to be described in the next section. ! 1047: ! 1048: @table @kbd ! 1049: @item h ! 1050: @kindex 150 @kbd{h} (@code{vip-backward-char}) ! 1051: Move point backward by one character. Signal error if point is at the ! 1052: beginning of buffer, but (unlike Vi) do not complain otherwise ! 1053: (@code{vip-backward-char}). ! 1054: @item l ! 1055: @kindex 154 @kbd{l} (@code{vip-forward-char}) ! 1056: Move point backward by one character. Signal error if point is at the ! 1057: end of buffer, but (unlike Vi) do not complain otherwise ! 1058: (@code{vip-forward-char}). ! 1059: @item j ! 1060: @kindex 152 @kbd{j} (@code{vip-next-line}) ! 1061: Move point to the next line keeping the current column. If point is on the ! 1062: last line of the buffer, a new line will be created and point will move to ! 1063: that line (@code{vip-next-line}). ! 1064: @item k ! 1065: @kindex 153 @kbd{k} (@code{vip-previous-line}) ! 1066: Move point to the previous line keeping the current column ! 1067: (@code{vip-next-line}). ! 1068: @item + ! 1069: @kindex 053 @kbd{+} (@code{vip-next-line-at-bol}) ! 1070: Move point to the next line at the first non-white character. If point is ! 1071: on the last line of the buffer, a new line will be created and point will ! 1072: move to the beginning of that line (@code{vip-next-line-at-bol}). ! 1073: @item - ! 1074: @kindex 055 @kbd{-} (@code{vip-previous-line-at-bol}) ! 1075: Move point to the previous line at the first non-white character ! 1076: (@code{vip-previous-line-at-bol}). ! 1077: @end table ! 1078: @noindent ! 1079: If a count is given to these commands, the commands will be repeated that ! 1080: many times. ! 1081: ! 1082: @table @kbd ! 1083: @item 0 ! 1084: @kindex 060 @kbd{0} (@code{vip-beginning-of-line}) ! 1085: Move point to the beginning of line (@code{vip-beginning-of-line}). ! 1086: @item ^ ! 1087: @kindex 136 @kbd{^} (@code{vip-bol-and-skip-white}) ! 1088: Move point to the first non-white character on the line ! 1089: (@code{vip-bol-and-skip-white}). ! 1090: @item $ ! 1091: @kindex 044 @kbd{$} (@code{vip-goto-eol}) ! 1092: Move point to the end of line (@code{vip-goto-eol}). ! 1093: @item @var{n} | ! 1094: @kindex 174 @kbd{|} (@code{vip-goto-col}) ! 1095: Move point to the @var{n}-th column on the line (@code{vip-goto-col}). ! 1096: @end table ! 1097: @noindent ! 1098: Except for the @kbd{|} command, these commands neglect a count. ! 1099: ! 1100: @cindex word ! 1101: ! 1102: @table @kbd ! 1103: @item w ! 1104: @kindex 167 @kbd{w} (@code{vip-forward-word}) ! 1105: Move point forward to the beginning of the next word ! 1106: (@code{vip-forward-word}). ! 1107: @item W ! 1108: @kindex 127 @kbd{W} (@code{vip-forward-Word}) ! 1109: Move point forward to the beginning of the next word, where a @dfn{word} is ! 1110: considered as a sequence of non-white characters (@code{vip-forward-Word}). ! 1111: @item b ! 1112: @kindex 142 @kbd{b} (@code{vip-backward-word}) ! 1113: Move point backward to the beginning of a word (@code{vip-backward-word}). ! 1114: @item B ! 1115: @kindex 102 @kbd{B} (@code{vip-backward-Word}) ! 1116: Move point backward to the beginning of a word, where a @i{word} is ! 1117: considered as a sequence of non-white characters (@code{vip-forward-Word}). ! 1118: @item e ! 1119: @kindex 145 @kbd{e} (@code{vip-end-of-word}) ! 1120: Move point forward to the end of a word (@code{vip-end-of-word}). ! 1121: @item E ! 1122: @kindex 105 @kbd{E} (@code{vip-end-of-Word}) ! 1123: Move point forward to the end of a word, where a @i{word} is ! 1124: considered as a sequence of non-white characters (@code{vip-end-of-Word}). ! 1125: @end table ! 1126: @noindent ! 1127: @cindex syntax table ! 1128: Here the meaning of the word `word' for the @kbd{w}, @kbd{b} and @kbd{e} ! 1129: commands is determined by the @dfn{syntax table} effective in the current ! 1130: buffer. Each major mode has its syntax mode, and therefore the meaning of ! 1131: a word also changes as the major mode changes. See GNU Emacs Manual for ! 1132: details of syntax table. ! 1133: ! 1134: @table @kbd ! 1135: @item H ! 1136: @kindex 110 @kbd{H} (@code{vip-window-top}) ! 1137: Move point to the beginning of the @i{home} (top) line of the window. ! 1138: Given a count @var{n}, go to the @var{n}-th line from top ! 1139: (@code{vip-window-top}). ! 1140: @item M ! 1141: @kindex 115 @kbd{M} (@code{vip-window-middle}) ! 1142: Move point to the beginning of the @i{middle} line of the window. Given ! 1143: a count @var{n}, go to the @var{n}-th line from the middle line ! 1144: (@code{vip-window-middle}). ! 1145: @item L ! 1146: @kindex 114 @kbd{L} (@code{vip-window-bottom}) ! 1147: Move point to the beginning of the @i{lowest} (bottom) line of the ! 1148: window. Given count, go to the @var{n}-th line from bottom ! 1149: (@code{vip-window-bottom}). ! 1150: @end table ! 1151: @noindent ! 1152: These commands can be used to go to the desired line visible on the screen. ! 1153: ! 1154: @table @kbd ! 1155: @item ( ! 1156: @kindex 050 @kbd{(} (@code{vip-backward-sentence}) ! 1157: Move point backward to the beginning of the sentence ! 1158: (@code{vip-backward-sentence}). ! 1159: @item ) ! 1160: @kindex 051 @kbd{)} (@code{vip-forward-sentence}) ! 1161: Move point forward to the end of the sentence ! 1162: (@code{vip-forward-sentence}). ! 1163: @item @{ ! 1164: @kindex 173 @kbd{@{} (@code{vip-backward-paragraph}) ! 1165: Move point backward to the beginning of the paragraph ! 1166: (@code{vip-backward-paragraph}). ! 1167: @item @} ! 1168: @kindex 175 @kbd{@}} (@code{vip-forward-paragraph}) ! 1169: Move point forward to the end of the paragraph ! 1170: (@code{vip-forward-paragraph}). ! 1171: @end table ! 1172: @noindent ! 1173: A count repeats the effect for these commands. ! 1174: ! 1175: @table @kbd ! 1176: @item G ! 1177: @kindex 107 @kbd{G} (@code{vip-goto-line}) ! 1178: Given a count @var{n}, move point to the @var{n}-th line in the buffer on ! 1179: the first non-white character. Without a count, go to the end of the buffer ! 1180: (@code{vip-goto-line}). ! 1181: @item ` ` ! 1182: @kindex 140 @kbd{`} (@code{vip-goto-mark}) ! 1183: Exchange point and mark (@code{vip-goto-mark}). ! 1184: @item ` @var{ch} ! 1185: Move point to the position stored in the register @var{ch}. @var{ch} must ! 1186: be a lower case letter. ! 1187: @item ' ' ! 1188: @kindex 047 @kbd{'} (@code{vip-goto-mark-and-skip-white}) ! 1189: Exchange point and mark, and then move point to the first non-white ! 1190: character on the line (@code{vip-goto-mark-and-skip-white}). ! 1191: @item ' @var{ch} ! 1192: Move point to the position stored in the register @var{ch} and skip to the ! 1193: first non-white character on the line. @var{ch} must be a lower case letter. ! 1194: @item % ! 1195: @kindex 045 @kbd{%} (@code{vip-paren-match}) ! 1196: Move point to the matching parenthesis if point is looking at @kbd{(}, ! 1197: @kbd{)}, @kbd{@{}, @kbd{@}}, @kbd{[} or @kbd{]} ! 1198: @*(@code{vip-paren-match}). ! 1199: @end table ! 1200: @noindent ! 1201: The command @kbd{G} mark point before move, so that you can return to the ! 1202: original point by @kbd{` `}. The original point will also be stored in ! 1203: the mark ring. ! 1204: ! 1205: The following commands are useful for moving points on the line. A count ! 1206: will repeat the effect. ! 1207: ! 1208: @table @kbd ! 1209: @item f @var{ch} ! 1210: @kindex 146 @kbd{f} (@code{vip-find-char-forward}) ! 1211: Move point forward to the character @var{ch} on the line. Signal error if ! 1212: @var{ch} could not be found (@code{vip-find-char-forward}). ! 1213: @item F @var{ch} ! 1214: @kindex 106 @kbd{F} (@code{vip-find-char-backward}) ! 1215: Move point backward to the character @var{ch} on the line. Signal error if ! 1216: @var{ch} could not be found (@code{vip-find-char-backward}). ! 1217: @item t @var{ch} ! 1218: @kindex 164 @kbd{t} (@code{vip-goto-char-forward}) ! 1219: Move point forward upto the character @var{ch} on the line. Signal error if ! 1220: @var{ch} could not be found (@code{vip-goto-char-forward}). ! 1221: @item T @var{ch} ! 1222: @kindex 124 @kbd{T} (@code{vip-goto-char-backward}) ! 1223: Move point backward upto the character @var{ch} on the line. Signal error if ! 1224: @var{ch} could not be found (@code{vip-goto-char-backward}). ! 1225: @item ; ! 1226: @kindex 073 @kbd{;} (@code{vip-repeat-find}) ! 1227: Repeat previous @kbd{f}, @kbd{t}, @kbd{F} or @kbd{T} command ! 1228: (@code{vip-repeat-find}). ! 1229: @item , ! 1230: @kindex 054 @kbd{,} (@code{vip-repeat-find-opposite}) ! 1231: Repeat previous @kbd{f}, @kbd{t}, @kbd{F} or @kbd{T} command, in the ! 1232: opposite direction (@code{vip-repeat-find-opposite}). ! 1233: @end table ! 1234: ! 1235: @node Searching and Replacing, Modifying Commands, Motion Commands, Vi Commands ! 1236: @section Searching and Replacing ! 1237: ! 1238: Following commands are available for searching and replacing. ! 1239: ! 1240: @cindex regular expression (search) ! 1241: ! 1242: @table @kbd ! 1243: @item / @var{string} @key{RET} ! 1244: @kindex 057 @kbd{/} (@code{vip-search-forward}) ! 1245: Search the first occurrence of the string @var{string} forward starting ! 1246: from point. Given a count @var{n}, the @var{n}-th occurrence of ! 1247: @var{string} will be searched. If the variable @code{vip-re-search} has value ! 1248: @code{t} then @dfn{regular expression} search is done and the string ! 1249: matching the regular expression @var{string} is found. If you give an ! 1250: empty string as @var{string} then the search mode will change from vanilla ! 1251: search to regular expression search and vice versa ! 1252: (@code{vip-search-forward}). ! 1253: @item ? @var{string} @key{RET} ! 1254: @kindex 077 @kbd{?} (@code{vip-search-backward}) ! 1255: Same as @kbd{/}, except that search is done backward ! 1256: (@code{vip-search-backward}). ! 1257: @item n ! 1258: @kindex 156 @kbd{n} (@code{vip-search-next}) ! 1259: Search the previous search pattern in the same direction as before ! 1260: (@code{vip-search-next}). ! 1261: @item N ! 1262: @kindex 116 @kbd{N} (@code{vip-search-Next}) ! 1263: Search the previous search pattern in the opposite direction ! 1264: (@code{vip-search-Next}). ! 1265: @item C-s ! 1266: @kindex 023 @kbd{C-s} (@code{isearch-forward}) ! 1267: Search forward incrementally. See GNU Emacs Manual for details ! 1268: (@code{isearch-forward}). ! 1269: @item C-r ! 1270: @kindex 022 @kbd{C-r} (@code{isearch-backward}) ! 1271: Search backward incrementally (@code{isearch-backward}). ! 1272: @cindex vanilla (replacement) ! 1273: @cindex regular expression (replacement) ! 1274: @item R @var{string} RET @var{newstring} ! 1275: @kindex 122 @kbd{R} (@code{vip-replace-string}) ! 1276: There are two modes of replacement, @dfn{vanilla} and @dfn{regular expression}. ! 1277: If the mode is @i{vanilla} you will get a prompt @samp{Replace string:}, ! 1278: and if the mode is @i{regular expression} you will ge a prompt ! 1279: @samp{Replace regexp:}. The mode is initially @i{vanilla}, but you can ! 1280: toggle these modes by giving a null string as @var{string}. If the mode is ! 1281: vanilla, this command replaces every occurrence of @var{string} with ! 1282: @var{newstring}. If the mode is regular expression, @var{string} is ! 1283: treated as a regular expression and every string matching the regular ! 1284: expression is replaced with @var{newstring} (@code{vip-replace-string}). ! 1285: @item Q @var{string} RET @var{newstring} ! 1286: @kindex 121 @kbd{Q} (@code{vip-query-replace}) ! 1287: Same as @kbd{R} except that you will be asked form confirmation before each ! 1288: replacement ! 1289: @*(@code{vip-query-replace}). ! 1290: @item r @var{ch} ! 1291: @kindex 162 @kbd{r} (@code{vip-replace-char}) ! 1292: Replace the character point is looking at by the character @var{ch}. Give ! 1293: count, replace that many characters by @var{ch} (@code{vip-replace-char}). ! 1294: @end table ! 1295: @noindent ! 1296: The commands @kbd{/} and @kbd{?} mark point before move, so that you can ! 1297: return to the original point by @w{@kbd{` `}}. ! 1298: ! 1299: @node Modifying Commands, Delete Commands, Searching and Replacing, Vi Commands ! 1300: @section Modifying Commands ! 1301: ! 1302: In this section, commands for modifying the content of a buffer are ! 1303: described. These commands affect the region determined by a motion command ! 1304: which is given to the commands as their argument. ! 1305: ! 1306: @cindex point commands ! 1307: @cindex line commands ! 1308: ! 1309: We classify motion commands into @dfn{point commands} and ! 1310: @dfn{line commands}. The point commands are as follows: ! 1311: @example ! 1312: @kbd{h}, @kbd{l}, @kbd{0}, @kbd{^}, @kbd{$}, @kbd{w}, @kbd{W}, @kbd{b}, @kbd{B}, @kbd{e}, @kbd{E}, @kbd{(}, @kbd{)}, @kbd{/}, @kbd{?}, @kbd{`}, @kbd{f}, @kbd{F}, @kbd{t}, @kbd{T}, @kbd{%}, @kbd{;}, @kbd{,} ! 1313: @end example ! 1314: @noindent ! 1315: The line commands are as follows: ! 1316: @example ! 1317: @kbd{j}, @kbd{k}, @kbd{+}, @kbd{-}, @kbd{H}, @kbd{M}, @kbd{L}, @kbd{@{}, @kbd{@}}, @kbd{G}, @kbd{'} ! 1318: @end example ! 1319: @noindent ! 1320: @cindex expanding (region) ! 1321: If a point command is given as an argument to a modifying command, the ! 1322: region determined by the point command will be affected by the modifying ! 1323: command. On the other hand, if a line command is given as an argument to a ! 1324: modifying command, the region determined by the line command will be ! 1325: enlarged so that it will become the smallest region properly containing the ! 1326: region and consisting of whole lines (we call this process @dfn{expanding ! 1327: the region}), and then the enlarged region will be affected by the modifying ! 1328: command. ! 1329: ! 1330: @menu ! 1331: * Delete Commands:: Commands for deleting text. ! 1332: * Yank Commands:: Commands for yanking text in Vi's sense. ! 1333: * Put Back Commands:: Commands for putting bake deleted/yanked text. ! 1334: * Change Commands:: Commands for changing text. ! 1335: @end menu ! 1336: @node Delete Commands, Yank Commands, Modifying Commands, Modifying Commands ! 1337: @subsection Delete Commands ! 1338: ! 1339: @table @kbd ! 1340: @item d @var{motion-command} ! 1341: @kindex 1440 @kbd{d} (@code{vip-command-argument}) ! 1342: Delete the region determined by the motion command @var{motion-command}. ! 1343: @end table ! 1344: @noindent ! 1345: For example, @kbd{d $} will delete the region between point and end of ! 1346: current line since @kbd{$} is a point command that moves point to end of line. ! 1347: @kbd{d G} will delete the region between the beginning of current line and ! 1348: end of the buffer, since @kbd{G} is a line command. A count given to the ! 1349: command above will become the count for the associated motion command. ! 1350: Thus, @kbd{3 d w} will delete three words. ! 1351: ! 1352: @kindex 042 @kbd{"} (@code{vip-command-argument}) ! 1353: It is also possible to save the deleted text into a register you specify. ! 1354: For example, you can say @kbd{" t 3 d w} to delete three words and save it ! 1355: to register @kbd{t}. The name of a register is a lower case letter between ! 1356: @kbd{a} and @kbd{z}. If you give an upper case letter as an argument to ! 1357: a delete command, then the deleted text will be appended to the content of ! 1358: the register having the corresponding lower case letter as its name. So, ! 1359: @kbd{" T d w} will delete a word and append it to register @kbd{t}. Other ! 1360: modifying commands also accept a register name as their argument, and we ! 1361: will not repeat similar explanations. ! 1362: ! 1363: We have more delete commands as below. ! 1364: ! 1365: @table @kbd ! 1366: @item d d ! 1367: @kindex 1442 @kbd{d d} ! 1368: Delete a line. Given a count @var{n}, delete @var{n} lines. ! 1369: @item d r ! 1370: @kindex 1442 @kbd{d r} ! 1371: Delete current region. ! 1372: @item d R ! 1373: @kindex 1441 @kbd{d R} ! 1374: Expand current region and delete it. ! 1375: @item D ! 1376: @kindex 104 @kbd{D} (@code{vip-kill-line}) ! 1377: Delete to the end of a line (@code{vip-kill-line}). ! 1378: @item x ! 1379: @kindex 170 @kbd{x} (@code{vip-delete-char}) ! 1380: Delete a character after point. Given @var{n}, delete @var{n} characters ! 1381: (@code{vip-delete-char}). ! 1382: @item @key{DEL} ! 1383: @kindex 177 @kbd{DEL} (@code{vip-delete-backward-char}) ! 1384: Delete a character before point. Given @var{n}, delete @var{n} characters ! 1385: (@code{vip-delete-backward-char}). ! 1386: @end table ! 1387: ! 1388: @node Yank Commands, Put Back Commands, Delete Commands, Modifying Commands ! 1389: @subsection Yank Commands ! 1390: ! 1391: @cindex yank ! 1392: ! 1393: Yank commands @dfn{yank} a text of buffer into a (usually anonymous) register. ! 1394: Here the word `yank' is used in Vi's sense. Thus yank commands do not ! 1395: alter the content of the buffer, and useful only in combination with ! 1396: commands that put back the yanked text into the buffer. ! 1397: ! 1398: @table @kbd ! 1399: @item y @var{motion-command} ! 1400: @kindex 1710 @kbd{y} (@code{vip-command-argument}) ! 1401: Yank the region determined by the motion command @var{motion-command}. ! 1402: @end table ! 1403: @noindent ! 1404: For example, @kbd{y $} will yank the text between point and the end of line ! 1405: into an anonymous register, while @kbd{"c y $} will yank the same text into ! 1406: register @kbd{c}. ! 1407: ! 1408: Use the following command to yank consecutive lines of text. ! 1409: ! 1410: @table @kbd ! 1411: @item y y ! 1412: @itemx Y ! 1413: @kindex 131 @kbd{Y} (@code{vip-yank-line}) ! 1414: @kindex 1712 @kbd{y y} (@code{vip-yank-line}) ! 1415: Yank a line. Given @var{n}, yank @var{n} lines (@code{vip-yank-line}). ! 1416: @item y r ! 1417: @kindex 1712 @kbd{y r} ! 1418: Yank current region. ! 1419: @item y R ! 1420: @kindex 1711 @kbd{y R} ! 1421: Expand current region and yank it. ! 1422: @end table ! 1423: ! 1424: @node Put Back Commands, Change Commands, Yank Commands, Modifying Commands ! 1425: @subsection Put Back Commands ! 1426: Deleted or yanked texts can be put back into the buffer by the command ! 1427: below. ! 1428: ! 1429: @table @kbd ! 1430: @item p ! 1431: @kindex 160 @kbd{p} (@code{vip-put-back}) ! 1432: Insert, after the character point is looking at, most recently ! 1433: deleted/yanked text from anonymous register. Given a register name ! 1434: argument, the content of the named register will be put back. Given a ! 1435: count, the command will be repeated that many times. This command also ! 1436: checks if the text to put back ends with a new line character, and if so ! 1437: the text will be put below the current line (@code{vip-put-back}). ! 1438: @item P ! 1439: @kindex 120 @kbd{P} (@code{vip-Put-back}) ! 1440: Insert at point most recently deleted/yanked text from anonymous register. ! 1441: Given a register name argument, the content of the named register will ! 1442: be put back. Given a count, the command will be repeated that many times. ! 1443: This command also checks if the text to put back ends with a new line ! 1444: character, and if so the text will be put above the current line rather ! 1445: than at point (@code{vip-Put-back}). ! 1446: @end table ! 1447: @noindent ! 1448: @cindex number register ! 1449: Thus, @kbd{" c p} will put back the content of the register @kbd{c} into the ! 1450: buffer. It is also possible to specify @dfn{number register} which is a ! 1451: numeral between @kbd{1} and @kbd{9}. If the number register @var{n} is ! 1452: specified, @var{n}-th previously deleted/yanked text will be put back. It ! 1453: is an error to specify a number register for the delete/yank commands. ! 1454: ! 1455: @node Change Commands, Repeating and Undoing Modifications, Put Back Commands, Modifying Commands ! 1456: @subsection Change Commands ! 1457: ! 1458: Most commonly used change command takes the following form. ! 1459: ! 1460: @table @kbd ! 1461: @item c @var{motion-command} ! 1462: @kindex 1430 @kbd{c} (@code{vip-command-argument}) ! 1463: Replace the content of the region determined by the motion command ! 1464: @var{motion-command} by the text you type. If the motion command is a ! 1465: point command then you will type the text into minibuffer, and if the ! 1466: motion command is a line command then the region will be deleted first and ! 1467: you can insert the text in @var{insert mode}. ! 1468: @end table ! 1469: @noindent ! 1470: For example, if point is at the beginning of a word @samp{foo} and you ! 1471: wish to change it to @samp{bar}, you can type @kbd{c w}. Then, as @kbd{w} ! 1472: is a point command, you will get the prompt @samp{foo =>} in the ! 1473: minibuffer, for which you can type @kbd{b a r @key{RET}} to complete the change ! 1474: command.@refill ! 1475: ! 1476: @table @kbd ! 1477: @item c c ! 1478: @kindex 1432 @kbd{c c} ! 1479: Change a line. Given a count, that many lines are changed. ! 1480: @item c r ! 1481: @kindex 1432 @kbd{c r} ! 1482: Change current region. ! 1483: @item c R ! 1484: @kindex 1431 @kbd{c R} ! 1485: Expand current region and change it. ! 1486: @end table ! 1487: ! 1488: @node Repeating and Undoing Modifications, Other Vi Commands, Change Commands, Modifying Commands ! 1489: @subsection Repeating and Undoing Modifications ! 1490: ! 1491: VIP records the previous modifying command, so that it is easy to repeat ! 1492: it. It is also very easy to undo changes made by modifying commands. ! 1493: ! 1494: @table @kbd ! 1495: @item u ! 1496: @kindex 165 @kbd{u} (@code{vip-undo}) ! 1497: Undo the last change. You can undo more by repeating undo by the repeat ! 1498: command @samp{.}. For example, you can undo 5 previous changes by typing ! 1499: @samp{u....}. If you type @samp{uu}, then the second @samp{u} undoes the ! 1500: first undo command (@code{vip-undo}). ! 1501: @item . ! 1502: @kindex 056 @kbd{.} (@code{vip-repeat}) ! 1503: Repeat the last modifying command. Given count @var{n} it becomes the new ! 1504: count for the repeated command. Otherwise, the count for the last ! 1505: modifying command is used again (@code{vip-repeat}). ! 1506: @end table ! 1507: ! 1508: @node Other Vi Commands, Commands in Insert Mode, Repeating and Undoing Modifications, Vi Commands ! 1509: @section Other Vi Commands ! 1510: ! 1511: Miscellaneous Vi commands are collected here. ! 1512: ! 1513: @table @kbd ! 1514: @item Z Z ! 1515: @kindex 132 @kbd{Z Z} (@code{save-buffers-kill-emacs}) ! 1516: Exit Emacs. If modified buffers exist, you will be asked whether you wish ! 1517: to save them or not (@code{save-buffers-kill-emacs}). ! 1518: @item !@: @var{motion-command} @var{format-command} ! 1519: @itemx @var{n} !@: !@: @var{format-command} ! 1520: @kindex 041 @kbd{!} (@code{vip-command-argument}) ! 1521: The region determined by the motion command @var{motion-command} will be ! 1522: given to the shell command @var{format-command} and the region will be ! 1523: replaced by its output. If a count is given, it will be passed to ! 1524: @var{motion-command}. For example, @samp{3!Gsort} will sort the region ! 1525: between point and the 3rd line. If @kbd{!} is used instead of ! 1526: @var{motion-command} then @var{n} lines will be processed by ! 1527: @var{format-command} (@code{vip-command-argument}). ! 1528: @item J ! 1529: @kindex 112 @kbd{J} (@code{vip-join-lines}) ! 1530: Join two lines. Given count, join that many lines. A space will be ! 1531: inserted at each junction (@code{vip-join-lines}). ! 1532: @item < @var{motion-command} ! 1533: @itemx @var{n} < < ! 1534: @kindex 074 @kbd{<} (@code{vip-command-argument}) ! 1535: Shift region determined by the motion command @var{motion-command} to ! 1536: left by @var{shift-width} (default is 8). If @kbd{<} is used instead of ! 1537: @var{motion-command} then shift @var{n} lines ! 1538: @*(@code{vip-command-argument}). ! 1539: @item > @var{motion-command} ! 1540: @itemx @var{n} > > ! 1541: @kindex 076 @kbd{>} (@code{vip-command-argument}) ! 1542: Shift region determined by the motion command @var{motion-command} to ! 1543: right by @var{shift-width} (default is 8). If @kbd{<} is used instead of ! 1544: @var{motion-command} then shift @var{n} lines ! 1545: @*(@code{vip-command-argument}). ! 1546: @item = @var{motion-command} ! 1547: @kindex 075 @kbd{=} (@code{vip-command-argument}) ! 1548: Indent region determined by the motion command @var{motion-command}. If ! 1549: @kbd{=} is used instead of @var{motion-command} then indent @var{n} lines ! 1550: (@code{vip-command-argument}). ! 1551: @item * ! 1552: @kindex 052 @kbd{*} (@code{vip-call-last-kbd-macro}) ! 1553: Call last remembered keyboard macro. ! 1554: @item # ! 1555: A new vi operator. @xref{New Commands}, for more details. ! 1556: @end table ! 1557: ! 1558: The following keys are reserved for future extensions, and currently ! 1559: assigned to a function that just beeps (@code{vip-nil}). ! 1560: ! 1561: @kindex 046 @kbd{&} (@code{vip-nil}) ! 1562: @kindex 100 @kbd{@@} (@code{vip-nil}) ! 1563: @kindex 125 @kbd{U} (@code{vip-nil}) ! 1564: @kindex 133 @kbd{[} (@code{vip-nil}) ! 1565: @kindex 135 @kbd{]} (@code{vip-nil}) ! 1566: @kindex 137 @kbd{_} (@code{vip-nil}) ! 1567: @kindex 161 @kbd{q} (@code{vip-nil}) ! 1568: @kindex 176 @kbd{~} (@code{vip-nil}) ! 1569: ! 1570: @example ! 1571: &, @@, U, [, ], _, q, ~ ! 1572: @end example ! 1573: ! 1574: VIP uses a special local keymap to interpret key strokes you enter in vi ! 1575: mode. The following keys are bound to @var{nil} in the keymap. Therefore, ! 1576: these keys are interpreted by the global keymap of Emacs. We give below a ! 1577: short description of the functions bound to these keys in the global ! 1578: keymap. See GNU Emacs Manual for details. ! 1579: ! 1580: @table @kbd ! 1581: @item C-@@ ! 1582: @kindex 000 @kbd{C-@@} (@code{set-mark-command}) ! 1583: Set mark and push previous mark on mark ring (@code{set-mark-command}). ! 1584: @item TAB ! 1585: @kindex 011 @kbd{TAB} (@code{indent-for-tab-command}) ! 1586: Indent line for current major mode (@code{indent-for-tab-command}). ! 1587: @item LFD ! 1588: @kindex 012 @kbd{LFD} (@code{newline-and-indent}) ! 1589: Insert a newline, then indent according to mode (@code{newline-and-indent}). ! 1590: @item C-k ! 1591: @kindex 013 @kbd{C-k} (@code{kill-line}) ! 1592: Kill the rest of the current line; before a newline, kill the newline. ! 1593: With prefix argument, kill that many lines from point. Negative arguments ! 1594: kill lines backward (@code{kill-line}). ! 1595: @item C-l ! 1596: @kindex 014 @kbd{C-l} (@code{recenter}) ! 1597: Clear the screen and reprint everything (@code{recenter}). ! 1598: @item @var{n} C-p ! 1599: @kindex 020 @kbd{C-p} (@code{previous-line}) ! 1600: Move cursor vertically up @var{n} lines (@code{previous-line}). ! 1601: @item C-q ! 1602: @kindex 021 @kbd{C-q} (@code{quoted-insert}) ! 1603: Read next input character and insert it. Useful for inserting control ! 1604: characters ! 1605: @*(@code{quoted-insert}). ! 1606: @item C-r ! 1607: @kindex 022 @kbd{C-r} (@code{isearch-backward}) ! 1608: Search backward incrementally (@code{isearch-backward}). ! 1609: @item C-s ! 1610: @kindex 023 @kbd{C-s} (@code{isearch-forward}) ! 1611: Search forward incrementally (@code{isearch-forward}). ! 1612: @item @var{n} C-t ! 1613: @kindex 024 @kbd{C-t} (@code{transpose-chars}) ! 1614: Interchange charcters around point, moving forward one character. With ! 1615: count @var{n}, take character before point and drag it forward past @var{n} ! 1616: other characters. If no argument and at end of line, the previous two ! 1617: characters are exchanged (@code{transpose-chars}). ! 1618: @item @var{n} C-v ! 1619: @kindex 026 @kbd{C-v} (@code{scroll-up}) ! 1620: Scroll text upward @var{n} lines. If @var{n} is not given, scroll near ! 1621: full screen (@code{scroll-up}). ! 1622: @item C-w ! 1623: @kindex 027 @kbd{C-w} (@code{kill-region}) ! 1624: Kill between point and mark. The text is save in the kill ring. The ! 1625: command @kbd{P} or @kbd{p} can retrieve it from kill ring ! 1626: (@code{kill-region}). ! 1627: @end table ! 1628: ! 1629: @node Commands in Insert Mode, Ex Commands, Other Vi Commands, Vi Commands ! 1630: @section Insert Mode ! 1631: ! 1632: You can enter insert mode by one of the following commands. In addition to ! 1633: these, you will enter insert mode if you give a change command with a line ! 1634: command as the motion command. Insert commands are also modifying commands ! 1635: and you can repeat them by the repeat command @kbd{.} (@code{vip-repeat}). ! 1636: ! 1637: @table @kbd ! 1638: @item i ! 1639: @kindex 151 @kbd{i} (@code{vip-insert}) ! 1640: Enter insert mode at point (@code{vip-insert}). ! 1641: @item I ! 1642: @kindex 111 @kbd{I} (@code{vip-Insert}) ! 1643: Enter insert mode at the first non white character on the line ! 1644: (@code{vip-Insert}). ! 1645: @item a ! 1646: @kindex 141 @kbd{a} (@code{vip-append}) ! 1647: Move point forward by one character and then enter insert mode ! 1648: (@code{vip-append}). ! 1649: @item A ! 1650: @kindex 101 @kbd{A} (@code{vip-Append}) ! 1651: Enter insert mode at end of line (@code{vip-Append}). ! 1652: @item o ! 1653: @kindex 157 @kbd{o} (@code{vip-open-line}) ! 1654: Open a new line below the current line and enter insert mode ! 1655: (@code{vip-open-line}). ! 1656: @item O ! 1657: @kindex 117 @kbd{O} (@code{vip-Open-line}) ! 1658: Open a new line above the current line and enter insert mode ! 1659: (@code{vip-Open-line}). ! 1660: @item C-o ! 1661: @kindex 017 @kbd{C-o} (@code{vip-open-line-at-point}) ! 1662: Insert a newline and leave point before it, and then enter insert mode ! 1663: @*(@code{vip-open-line-at-point}). ! 1664: @end table ! 1665: ! 1666: Insert mode is almost like emacs mode. Only the following 4 keys behave ! 1667: differently from emacs mode. ! 1668: ! 1669: @table @kbd ! 1670: @item @key{ESC} ! 1671: @kindex 033 @kbd{ESC} (@code{vip-change-mode-to-vi}) (insert mode) ! 1672: This key will take you back to vi mode (@code{vip-change-mode-to-vi}). ! 1673: @item C-h ! 1674: @kindex 010 @kbd{C-h} (@code{delete-backward-char}) (insert mode) ! 1675: Delete previous character (@code{delete-backward-char}). ! 1676: @item C-w ! 1677: @kindex 027 @kbd{C-w} (@code{vip-delete-backward-word}) (insert mode) ! 1678: Delete previous word (@code{vip-delete-backward-word}). ! 1679: @item C-z ! 1680: @kindex 032 @kbd{C-z} (@code{vip-ESC}) (insert mode) ! 1681: This key simulates @key{ESC} key in emacs mode. For instance, typing ! 1682: @kbd{C-z x} in insert mode iw the same as typing @kbd{ESC x} in emacs mode ! 1683: (@code{vip-ESC}). ! 1684: @end table ! 1685: @noindent ! 1686: You can also bind @kbd{C-h} to @code{help-command} if you like. ! 1687: (@xref{Customizing Key Bindings}, for details.) Binding @kbd{C-h} to ! 1688: @code{help-command} has the effect of making the meaning of @kbd{C-h} ! 1689: uniform among emacs, vi and insert modes. ! 1690: ! 1691: When you enter insert mode, VIP records point as the start point of ! 1692: insertion, and when you leave insert mode the region between point and ! 1693: start point is saved for later use by repeat command etc. Therefore, repeat ! 1694: command will not really repeat insertion if you move point by emacs ! 1695: commands while in insert mode. ! 1696: ! 1697: @node Ex Commands, Ex Command Reference, Commands in Insert Mode, Top ! 1698: @chapter Ex Commands ! 1699: ! 1700: @kindex 072 @kbd{:} (@code{vip-ex}) ! 1701: ! 1702: In vi mode, you can execute an Ex command @var{ex-command} by typing: ! 1703: @example ! 1704: @kbd{:@: @var{ex-command} @key{RET}} ! 1705: @end example ! 1706: Every Ex command follows the following pattern: ! 1707: @example ! 1708: @var{address command} @kbd{!}@: @var{parameters count flags} ! 1709: @end example ! 1710: @noindent ! 1711: @cindex address ! 1712: where all parts are optional. For the syntax of @dfn{address}, the reader ! 1713: is referred to the reference manual of Ex. ! 1714: ! 1715: @cindex magic ! 1716: @cindex regular expression ! 1717: ! 1718: In the current version of VIP, searching by Ex commands is always ! 1719: @dfn{magic}. That is, search patterns are always treated as @dfn{regular ! 1720: expressions}. For example, a typical forward search would be invoked by ! 1721: @kbd{:/@var{pat}/}. If you wish to include @samp{/} as part of ! 1722: @var{pat} you must preceded it by @samp{\}. VIP strips off these @kbd{\}'s ! 1723: before @kbd{/} and the resulting @var{pat} becomes the actual search ! 1724: pattern. Emacs provides a different and richer class or regular ! 1725: expressions than Vi/Ex, and VIP uses Emacs' regular expressions. See GNU ! 1726: Emacs Manual for details of regular expressions. ! 1727: ! 1728: Several Ex commands can be entered in a line by separating them by a pipe ! 1729: character @samp{|}. ! 1730: ! 1731: @menu ! 1732: * Ex Command Reference:: Explain all the Ex commands available in VIP. ! 1733: @end menu ! 1734: @node Ex Command Reference, Customization, Ex Commands, Ex Commands ! 1735: @section Ex Command Reference ! 1736: In this section we briefly explain all the Ex commands supported by VIP. ! 1737: Most Ex commands expect @var{address} as their argument, and they use ! 1738: default addresses if they are not explicitly given. In the following, such ! 1739: default addresses will be shown in parentheses. ! 1740: ! 1741: Most command names can and preferably be given in abbreviated forms. In ! 1742: the following, optional parts of command names will be enclosed in ! 1743: brackets. For example, @samp{co[py]} will mean that copy command can be ! 1744: give as @samp{co} or @samp{cop} or @samp{copy}. ! 1745: ! 1746: If @var{command} is empty, point will move to the beginning of the line ! 1747: specified by the @var{address}. If @var{address} is also empty, point will ! 1748: move to the beginning of the current line. ! 1749: ! 1750: @cindex flag ! 1751: ! 1752: Some commands accept @dfn{flags} which are one of @kbd{p}, @kbd{l} and ! 1753: @kbd{#}. If @var{flags} are given, the text affected by the commands will ! 1754: be displayed on a temporary window, and you will be asked to hit return to ! 1755: continue. In this way, you can see the text affected by the commands ! 1756: before the commands will be executed. If you hit @kbd{C-g} instead of ! 1757: @key{RET} then the commands will be aborted. Note that the meaning of ! 1758: @var{flags} is different in VIP from that in Vi/Ex. ! 1759: ! 1760: @table @kbd ! 1761: @item (.,.@:) co[py] @var{addr} @var{flags} ! 1762: @itemx (.,.@:) t @var{addr} @var{flags} ! 1763: Place a copy of specified lines after @var{addr}. If @var{addr} is ! 1764: @kbd{0}, it will be placed before the first line. ! 1765: @item (.,.@:) d[elete] @var{register} @var{count} @var{flags} ! 1766: Delete specified lines. Text will be saved in a named @var{register} if a ! 1767: lower case letter is given, and appended to a register if a capital letter is ! 1768: given. ! 1769: @item e[dit] !@: +@var{addr} @var{file} ! 1770: @itemx e[x] !@: +@var{addr} @var{file} ! 1771: @itemx vi[sual] !@: +@var{addr} @var{file} ! 1772: Edit a new file @var{file} in the current window. The command will abort ! 1773: if current buffer is modified, which you can override by giving @kbd{!}. ! 1774: If @kbd{+}@var{addr} is given, @var{addr} becomes the current line. ! 1775: @item file ! 1776: Give information about the current file. ! 1777: @item (1,$) g[lobal] !@: /@var{pat}/ @var{cmds} ! 1778: @itemx (1,$) v /@var{pat}/ @var{cmds} ! 1779: Among specified lines first mark each line which matches the regular ! 1780: expression @var{pat}, and then execute @var{cmds} on each marked line. ! 1781: If @kbd{!}@: is given, @var{cmds} will be executed on each line not matching ! 1782: @var{pat}. @kbd{v} is same as @kbd{g!}. ! 1783: @item (.,.+1) j[oin] !@: @var{count} @var{flags} ! 1784: Join specified lines into a line. Without @kbd{!}, a space character will ! 1785: be inserted at each junction. ! 1786: @item (.@:) k @var{ch} ! 1787: @itemx (.@:) mar[k] @var{ch} ! 1788: Mark specified line by a lower case character @var{ch}. Then the ! 1789: addressing form @kbd{'}@var{ch} will refer to this line. No white space is ! 1790: required between @kbd{k} and @var{ch}. A white space is necessary between ! 1791: @kbd{mark} and @var{ch}, however. ! 1792: @item map @var{ch} @var{rhs} ! 1793: Define a macro for vi mode. After this command, the character @var{ch} ! 1794: will be expanded to @var{rhs} in vi mode. ! 1795: @item (.,.@:) m[ove] @var{addr} ! 1796: Move specified lines after @var{addr}. ! 1797: @item (.@:) pu[t] @var{register} ! 1798: Put back previously deleted or yanked text. If @var{register} is given, ! 1799: the text saved in the register will be put back; otherwise, last deleted or ! 1800: yanked text will be put back. ! 1801: @item q[uit] ! ! 1802: Quit from Emacs. If modified buffers with associated files exist, you will ! 1803: be asked whether you wish to save each of them. At this point, you may ! 1804: choose not to quit, by hitting @kbd{C-g}. If @kbd{!}@: is given, exit from ! 1805: Emacs without saving modified buffers. ! 1806: @item (.@:) r[ead] @var{file} ! 1807: Read in the content of the file @var{file} after the specified line. ! 1808: @item (.@:) r[ead] !@: @var{command} ! 1809: Read in the output of the shell command @var{command} after the specified ! 1810: line. ! 1811: @item se[t] ! 1812: Set a variable's value. @xref{Customizing Constants}, for the list of variables ! 1813: you can set. ! 1814: @item sh[ell] ! 1815: Run a subshell in a window. ! 1816: @item (.,.@:) s[ubstitute] /@var{pat}/@var{repl}/ @var{options} @var{count} @var{flags} ! 1817: @itemx (.,.@:) & @var{options} @var{count} @var{flags} ! 1818: On each specified line, the first occurrence of string matching regular ! 1819: expression @var{pat} is replaced by replacement pattern @var{repl}. Option ! 1820: characters are @kbd{g} and @kbd{c}. If global option character @kbd{g} ! 1821: appears as part of @var{options}, all occurrences are substituted. If ! 1822: confirm option character @kbd{c} appears, you will be asked to give ! 1823: confirmation before each substitution. If @kbd{/@var{pat}/@var{repl}/} is ! 1824: missing, the last substitution is repeated. ! 1825: @item st[op] ! 1826: Suspend Emacs. ! 1827: @item ta[g] @var{tag} ! 1828: @cindex tag ! 1829: @cindex selected tag table ! 1830: Find first definition of @var{tag}. If no @var{tag} is given, previously ! 1831: given @var{tag} is used and next alternate definition is find. By default, ! 1832: the file @file{TAGS} in the current directory becomes the @dfn{selected tag ! 1833: table}. You can select another tag table by @kbd{set} command. ! 1834: @xref{Customizing Constants}, for details. ! 1835: @item und[o] ! 1836: Undo the last change. ! 1837: @item unm[ap] @var{ch} ! 1838: The macro expansion associated with @var{ch} is removed. ! 1839: @item ve[rsion] ! 1840: Tell the version number of VIP. ! 1841: @item (1,$) w[rite] !@: @var{file} ! 1842: Write out specified lines into file @var{file}. If no @var{file} is given, ! 1843: text will be written to the file associated to the current buffer. Unless ! 1844: @kbd{!}@: is given, if @var{file} is different from the file associated to ! 1845: the current buffer and if the file @var{file} exists, the command will not ! 1846: be executed. Unlike Ex, @var{file} becomes the file associated to the ! 1847: current buffer. ! 1848: @item (1,$) w[rite]>> @var{file} ! 1849: Write out specified lines at the end of file @var{file}. @var{file} ! 1850: becomes the file associated to the current buffer. ! 1851: @item (1,$) wq !@: @var{file} ! 1852: Same as @kbd{write} and then @kbd{quit}. If @kbd{!}@: is given, same as ! 1853: @kbd{write !}@: then @kbd{quit}. ! 1854: @item (.,.) y[ank] @var{register} @var{count} ! 1855: Save specified lines into register @var{register}. If no register is ! 1856: specified, text will be saved in an anonymous register. ! 1857: @item @var{addr} !@: @var{command} ! 1858: Execute shell command @var{command}. The output will be shown in a new ! 1859: window. If @var{addr} is given, specified lines will be used as standard ! 1860: input to @var{command}. ! 1861: @item ($) = ! 1862: Print the line number of the addressed line. ! 1863: @item (.,.) > @var{count} @var{flags} ! 1864: Shift specified lines to the right. The variable @code{vip-shift-width} ! 1865: (default value is 8) determines the amount of shift. ! 1866: @item (.,.) < @var{count} @var{flags} ! 1867: Shift specified lines to the left. The variable @code{vip-shift-width} ! 1868: (default value is 8) determines the amount of shift. ! 1869: @item (.,.@:) ~ @var{options} @var{count} @var{flags} ! 1870: Repeat the previous @kbd{substitute} command using previous search pattern ! 1871: as @var{pat} for matching. ! 1872: @end table ! 1873: ! 1874: The following Ex commands are available in Vi, but not implemented in VIP. ! 1875: @example ! 1876: @kbd{abbreviate}, @kbd{list}, @kbd{next}, @kbd{print}, @kbd{preserve}, @kbd{recover}, @kbd{rewind}, @kbd{source}, ! 1877: @kbd{unabbreviate}, @kbd{xit}, @kbd{z} ! 1878: @end example ! 1879: ! 1880: @node Customization, Customizing Constants, Ex Command Reference, Top ! 1881: @chapter Customization ! 1882: ! 1883: If you have a file called @file{.vip} in your home directory, then it ! 1884: will also be loaded when VIP is loaded. This file is thus useful for ! 1885: customizing VIP. ! 1886: ! 1887: @menu ! 1888: * Customizing Constants:: How to change values of constants. ! 1889: * Customizing Key Bindings:: How to change key bindings. ! 1890: @end menu ! 1891: ! 1892: @node Customizing Constants, Customizing Key Bindings, Customization, Customization ! 1893: @section Customizing Constants ! 1894: An easy way to customize VIP is to change the values of constants used ! 1895: in VIP. Here is the list of the constants used in VIP and their default ! 1896: values. ! 1897: ! 1898: @table @code ! 1899: @item vip-shift-width 8 ! 1900: The number of columns shifted by @kbd{>} and @kbd{<} command. ! 1901: @item vip-re-replace nil ! 1902: If @code{t} then do regexp replace, if @code{nil} then do string replace. ! 1903: @item vip-search-wrap-around t ! 1904: If @code{t}, search wraps around the buffer. ! 1905: @item vip-re-search nil ! 1906: If @code{t} then search is reg-exp search, if @code{nil} then vanilla ! 1907: search. ! 1908: @item vip-case-fold-search nil ! 1909: If @code{t} search ignores cases. ! 1910: @item vip-re-query-replace nil ! 1911: If @code{t} then do reg-exp replace in query replace. ! 1912: @item vip-open-with-indent nil ! 1913: If @code{t} then indent to the previous current line when open a new line ! 1914: by @kbd{o} or @kbd{O} command. ! 1915: @item vip-tags-file-name "TAGS" ! 1916: The name of the file used as the tag table. ! 1917: @item vip-help-in-insert-mode nil ! 1918: If @code{t} then @key{C-h} is bound to @code{help-command} in insert mode, ! 1919: if @code{nil} then it sis bound to @code{delete-backward-char}. ! 1920: @end table ! 1921: @noindent ! 1922: You can reset these constants in VIP by the Ex command @kbd{set}. Or you ! 1923: can include a line like this in your @file{.vip} file: ! 1924: @example ! 1925: (setq vip-case-fold-search t) ! 1926: @end example ! 1927: ! 1928: @node Customizing Key Bindings,, Customizing Constants, Customization ! 1929: @section Customizing Key Bindings ! 1930: ! 1931: @cindex local keymap ! 1932: ! 1933: VIP uses @code{vip-command-mode-map} as the @dfn{local keymap} for vi mode. ! 1934: For example, in vi mode, @key{SPC} is bound to the function ! 1935: @code{vip-scroll}. But, if you wish to make @key{SPC} and some other keys ! 1936: behave like Vi, you can include the following lines in your @file{.vip} ! 1937: file. ! 1938: ! 1939: @example ! 1940: (define-key vip-command-mode-map "\C-g" 'vip-info-on-file) ! 1941: (define-key vip-command-mode-map "\C-h" 'vip-backward-char) ! 1942: (define-key vip-command-mode-map "\C-m" 'vip-next-line-at-bol) ! 1943: (define-key vip-command-mode-map " " 'vip-forward-char) ! 1944: (define-key vip-command-mode-map "g" 'vip-keyboard-quit) ! 1945: (define-key vip-command-mode-map "s" 'vip-substitute) ! 1946: (define-key vip-command-mode-map "C" 'vip-change-to-eol) ! 1947: (define-key vip-command-mode-map "R" 'vip-change-to-eol) ! 1948: (define-key vip-command-mode-map "S" 'vip-substitute-line) ! 1949: (define-key vip-command-mode-map "X" 'vip-delete-backward-char) ! 1950: @end example ! 1951: ! 1952: @unnumbered Key Index ! 1953: ! 1954: @printindex ky ! 1955: ! 1956: @unnumbered Concept Index ! 1957: @printindex cp ! 1958: ! 1959: @contents ! 1960: @bye
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.