Bump Emacs version to 25.1.90
[emacs.git] / etc / refcards / vipcard.tex
blob5eca55cc582cd6e3da704f8685cf9d7bdb5e48e6
1 % Quick Reference Card for VIP
3 % Copyright (C) 1987, 2001-2016 Free Software Foundation, Inc.
5 % Author: Masahiko Sato <ms@sail.stanford.edu>, <masahiko@sato.riec.tohoku.junet>
7 % This document is free software: you can redistribute it and/or modify
8 % it under the terms of the GNU General Public License as published by
9 % the Free Software Foundation, either version 3 of the License, or
10 % (at your option) any later version.
12 % As a special additional permission, you may distribute reference cards
13 % printed, or formatted for printing, with the notice "Released under
14 % the terms of the GNU General Public License version 3 or later"
15 % instead of the usual distributed-under-the-GNU-GPL notice, and without
16 % a copy of the GPL itself.
18 % This document is distributed in the hope that it will be useful,
19 % but WITHOUT ANY WARRANTY; without even the implied warranty of
20 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 % GNU General Public License for more details.
23 % You should have received a copy of the GNU General Public License
24 % along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
27 % This file is intended to be processed by plain TeX (TeX82).
29 % The final reference card has six columns, three on each side.
30 % This file can be used to produce it in any of three ways:
31 % 1 column per page
32 % produces six separate pages, each of which needs to be reduced to 80%.
33 % This gives the best resolution.
34 % 2 columns per page
35 % produces three already-reduced pages.
36 % You will still need to cut and paste.
37 % 3 columns per page
38 % produces two pages which must be printed sideways to make a
39 % ready-to-use 8.5 x 11 inch reference card.
40 % For this you need a dvi device driver that can print sideways.
41 % Which mode to use is controlled by setting \columnsperpage.
44 %**start of header
45 \newcount\columnsperpage
47 % This file can be printed with 1, 2, or 3 columns per page.
48 % Specify how many you want here.
49 \columnsperpage=1
51 % PDF output layout. 0 for A4, 1 for letter (US), a `l' is added for
52 % a landscape layout.
53 \input pdflayout.sty
54 \pdflayout=(1)
56 \input emacsver.tex
57 \def\versionemacs{18} % version of Emacs this is for
58 \def\versionvip{3.5}
60 % Nothing else needs to be changed.
62 \def\shortcopyrightnotice{\vskip 1ex plus 2 fill
63 \centerline{\small \copyright\ \year\ Free Software Foundation, Inc.
64 Permissions on back.}}
66 \def\copyrightnotice{
67 %\vskip 1ex plus 2 fill\begingroup\small
68 \vskip 1ex \begingroup\small
69 \centerline{Copyright \copyright\ \year\ Free Software Foundation, Inc.}
70 \centerline{For VIP \versionvip\ with GNU Emacs version \versionemacs}
71 \centerline{Written by Masahiko Sato,}
72 \centerline{using refcard layout designed by Stephen Gildea.}
74 Released under the terms of the GNU General Public License version 3 or later.
76 \TeX{} source for this card is distributed with Emacs in {\tt etc/refcards/}
78 For copies of the GNU Emacs manual, see:
80 {\tt http://www.gnu.org/software/emacs/\#Manuals}
81 \endgroup}
83 % make \bye not \outer so that the \def\bye in the \else clause below
84 % can be scanned without complaint.
85 \def\bye{\par\vfill\supereject\end}
87 \newdimen\intercolumnskip
88 \newbox\columna
89 \newbox\columnb
91 \def\ncolumns{\the\columnsperpage}
93 \message{[\ncolumns\space
94 column\if 1\ncolumns\else s\fi\space per page]}
96 \def\scaledmag#1{ scaled \magstep #1}
98 % This multi-way format was designed by Stephen Gildea
99 % October 1986.
100 % Slightly modified by Masahiko Sato, September 1987.
101 \if 1\ncolumns
102 \hsize 4in
103 \vsize 10in
104 %\voffset -.7in
105 \voffset -.57in
106 \font\titlefont=\fontname\tenbf \scaledmag3
107 \font\headingfont=\fontname\tenbf \scaledmag2
108 \font\miniheadingfont=\fontname\tenbf \scaledmag1 % masahiko
109 \font\smallfont=\fontname\sevenrm
110 \font\smallsy=\fontname\sevensy
112 \footline{\hss\folio}
113 \def\makefootline{\baselineskip10pt\hsize6.5in\line{\the\footline}}
114 \else
115 %\hsize 3.2in
116 %\vsize 7.95in
117 \hsize 3.41in % masahiko
118 \vsize 8in % masahiko
119 \hoffset -.75in
120 \voffset -.745in
121 \font\titlefont=cmbx10 \scaledmag2
122 \font\headingfont=cmbx10 \scaledmag1
123 \font\miniheadingfont=cmbx10 % masahiko
124 \font\smallfont=cmr6
125 \font\smallsy=cmsy6
126 \font\eightrm=cmr8
127 \font\eightbf=cmbx8
128 \font\eightit=cmti8
129 \font\eightsl=cmsl8
130 \font\eighttt=cmtt8
131 \font\eightsy=cmsy8
132 \textfont0=\eightrm
133 \textfont2=\eightsy
134 \def\rm{\eightrm}
135 \def\bf{\eightbf}
136 \def\it{\eightit}
137 \def\sl{\eightsl} % masahiko
138 \def\tt{\eighttt}
139 \normalbaselineskip=.8\normalbaselineskip
140 \normallineskip=.8\normallineskip
141 \normallineskiplimit=.8\normallineskiplimit
142 \normalbaselines\rm %make definitions take effect
144 \if 2\ncolumns
145 \let\maxcolumn=b
146 \footline{\hss\rm\folio\hss}
147 \def\makefootline{\vskip 2in \hsize=6.86in\line{\the\footline}}
148 \else \if 3\ncolumns
149 \let\maxcolumn=c
150 \nopagenumbers
151 \else
152 \errhelp{You must set \columnsperpage equal to 1, 2, or 3.}
153 \errmessage{Illegal number of columns per page}
154 \fi\fi
156 %\intercolumnskip=.46in
157 \intercolumnskip=.19in % masahiko .19x4 + 3.41x3 = 10.99
158 \def\abc{a}
159 \output={%
160 % This next line is useful when designing the layout.
161 %\immediate\write16{Column \folio\abc\space starts with \firstmark}
162 \if \maxcolumn\abc \multicolumnformat \global\def\abc{a}
163 \else\if a\abc
164 \global\setbox\columna\columnbox \global\def\abc{b}
165 %% in case we never use \columnb (two-column mode)
166 \global\setbox\columnb\hbox to -\intercolumnskip{}
167 \else
168 \global\setbox\columnb\columnbox \global\def\abc{c}\fi\fi}
169 \def\multicolumnformat{\shipout\vbox{\makeheadline
170 \hbox{\box\columna\hskip\intercolumnskip
171 \box\columnb\hskip\intercolumnskip\columnbox}
172 \makefootline}\advancepageno}
173 \def\columnbox{\leftline{\pagebody}}
175 \def\bye{\par\vfill\supereject
176 \if a\abc \else\null\vfill\eject\fi
177 \if a\abc \else\null\vfill\eject\fi
178 \end}
181 % we won't be using math mode much, so redefine some of the characters
182 % we might want to talk about
183 \catcode`\^=12
184 \catcode`\_=12
186 \chardef\\=`\\
187 \chardef\{=`\{
188 \chardef\}=`\}
190 \hyphenation{mini-buf-fer}
192 \parindent 0pt
193 \parskip 1ex plus .5ex minus .5ex
195 \def\small{\smallfont\textfont2=\smallsy\baselineskip=.8\baselineskip}
197 \outer\def\newcolumn{\vfill\eject}
199 \outer\def\title#1{{\titlefont\centerline{#1}}\vskip 1ex plus .5ex}
201 \outer\def\section#1{\par\filbreak
202 \vskip 3ex plus 2ex minus 2ex {\headingfont #1}\mark{#1}%
203 \vskip 2ex plus 1ex minus 1.5ex}
205 % masahiko
206 \outer\def\subsection#1{\par\filbreak
207 \vskip 2ex plus 2ex minus 2ex {\miniheadingfont #1}\mark{#1}%
208 \vskip 1ex plus 1ex minus 1.5ex}
210 \newdimen\keyindent
212 \def\beginindentedkeys{\keyindent=1em}
213 \def\endindentedkeys{\keyindent=0em}
214 \endindentedkeys
216 \def\paralign{\vskip\parskip\halign}
218 \def\<#1>{$\langle${\rm #1}$\rangle$}
220 \def\kbd#1{{\tt#1}\null} %\null so not an abbrev even if period follows
222 \def\beginexample{\par\leavevmode\begingroup
223 \obeylines\obeyspaces\parskip0pt\tt}
224 {\obeyspaces\global\let =\ }
225 \def\endexample{\endgroup}
227 \def\key#1#2{\leavevmode\hbox to \hsize{\vtop
228 {\hsize=.75\hsize\rightskip=1em
229 \hskip\keyindent\relax#1}\kbd{#2}\hfil}}
231 \newbox\metaxbox
232 \setbox\metaxbox\hbox{\kbd{M-x }}
233 \newdimen\metaxwidth
234 \metaxwidth=\wd\metaxbox
236 \def\metax#1#2{\leavevmode\hbox to \hsize{\hbox to .75\hsize
237 {\hskip\keyindent\relax#1\hfil}%
238 \hskip -\metaxwidth minus 1fil
239 \kbd{#2}\hfil}}
241 \def\fivecol#1#2#3#4#5{\hskip\keyindent\relax#1\hfil&\kbd{#2}\quad
242 &\kbd{#3}\quad&\kbd{#4}\quad&\kbd{#5}\cr}
244 \def\fourcol#1#2#3#4{\hskip\keyindent\relax#1\hfil&\kbd{#2}\quad
245 &\kbd{#3}\quad&\kbd{#4}\quad\cr}
247 \def\threecol#1#2#3{\hskip\keyindent\relax#1\hfil&\kbd{#2}\quad
248 &\kbd{#3}\quad\cr}
250 \def\twocol#1#2{\hskip\keyindent\relax\kbd{#1}\hfil&\kbd{#2}\quad\cr}
252 \def\twocolkey#1#2#3#4{\hskip\keyindent\relax#1\hfil&\kbd{#2}\quad&\relax#3\hfil&\kbd{#4}\quad\cr}
254 %**end of header
256 \beginindentedkeys
258 \title{VIP Quick Reference Card}
260 \centerline{(Based on VIP \versionvip\ in GNU Emacs \versionemacs)}
262 %\copyrightnotice
264 \section{Loading VIP}
266 Just type \kbd{M-x vip-mode} followed by \kbd{RET}
268 \section{VIP Modes}
270 VIP has three modes: {\it emacs mode}, {\it vi mode} and {\it insert mode}.
271 Mode line tells you which mode you are in.
272 In emacs mode you can do all the normal GNU Emacs editing.
273 This card explains only vi mode and insert mode.
274 {\bf GNU Emacs Reference Card} explains emacs mode.
275 You can switch modes as follows.
277 \key{from emacs mode to vi mode}{C-z}
278 \key{from vi mode to emacs mode}{C-z}
279 \metax{from vi mode to insert mode}{i, I, a, A, o, O {\rm or} C-o}
280 \key{from insert mode to vi mode}{ESC}
282 If you wish to be in vi mode just after you startup Emacs,
283 include the line:
285 \hskip 5ex
286 \kbd{(add-hook 'emacs-startup-hook 'vip-mode)}
288 in your \kbd{.emacs} file.
289 Or, you can put the following alias in your \kbd{.cshrc} file.
291 \hskip 5ex
292 \kbd{alias vip 'emacs \\!* -f vip-mode'}
295 \section{Insert Mode}
296 Insert mode is like emacs mode except for the following.
298 \key{go back to vi mode}{ESC}
299 \key{delete previous character}{C-h}
300 \key{delete previous word}{C-w}
301 \key{emulate \kbd{ESC} key in emacs mode}{C-z}
303 The rest of this card explains commands in {\bf vi mode}.
305 \section{Getting Information on VIP}
307 Execute info command by typing \kbd{M-x info} and select menu item
308 \kbd{vip}. Also:
310 \key{describe function attached to the key {\it x}}{C-h k {\it x}}
312 \section{Leaving Emacs}
314 \key{suspend Emacs}{X Z {\rm or} :st}
315 \metax{exit Emacs permanently}{Z Z {\rm or} X C {\rm or} :q}
317 \section{Error Recovery}
319 \key{abort partially typed or executing command}{C-g}
320 \key{redraw messed up screen}{C-l}
321 \metax{{\bf recover} a file lost by a system crash}{M-x recover-file}
322 \metax{restore a buffer to its original contents}{M-x revert-buffer}
324 \shortcopyrightnotice
326 \section{Counts}
328 Most commands in vi mode accept a {\it count} which can be supplied as a
329 prefix to the commands. In most cases, if a count is given, the
330 command is executed that many times. E.g., \kbd{5 d d} deletes 5
331 lines.
333 %\shortcopyrightnotice
334 \section{Registers}
336 There are 26 registers (\kbd{a} to \kbd{z}) that can store texts
337 and marks.
338 You can append a text at the end of a register (say \kbd{x}) by
339 specifying the register name in capital letter (say \kbd{X}).
340 There are also 9 read only registers (\kbd{1} to \kbd{9}) that store
341 up to 9 previous changes.
342 We will use {\it x\/} to denote a register.
343 \section{Entering Insert Mode}
345 \key{{\bf insert} at point}{i}
346 \key{{\bf append} after cursor}{a}
347 \key{{\bf insert} before first non-white}{I}
348 \key{{\bf append} at end of line}{A}
349 \key{{\bf open} line below}{o}
350 \key{{\bf open} line above}{O}
351 \key{{\bf open} line at point}{C-o}
353 \section{Buffers and Windows}
355 \key{move cursor to {\bf next} window}{C-n}
356 \key{delete current window}{X 0}
357 \key{delete other windows}{X 1}
358 \key{split current window into two windows}{X 2}
359 \key{show current buffer in two windows}{X 3}
360 \key{{\bf switch} to a buffer in the current window}{s {\sl buffer}}
361 \key{{\bf switch} to a buffer in another window}{S {\sl buffer}}
362 \key{{\bf kill} a buffer}{K}
363 \key{list existing {\bf buffers}}{X B}
365 \section{Files}
367 \metax{{\bf visit} file in the current window}{v {\sl file} {\rm or} :e {\sl file}}
368 \key{{\bf visit} file in another window}{V {\sl file}}
369 \key{{\bf save} buffer to the associated file}{X S}
370 \key{{\bf write} buffer to a specified file}{X W}
371 \key{{\bf insert} a specified file at point}{X I}
372 \key{{\bf get} information on the current {\bf file}}{g {\rm or} :f}
373 \key{run the {\bf directory} editor}{X d}
375 \section{Viewing the Buffer}
377 \key{scroll to next screen}{SPC {\rm or} C-f}
378 \key{scroll to previous screen}{RET {\rm or} C-b}
379 \key{scroll {\bf down} half screen}{C-d}
380 \key{scroll {\bf up} half screen}{C-u}
381 \key{scroll down one line}{C-e}
382 \key{scroll up one line}{C-y}
384 \key{put current line on the {\bf home} line}{z H {\rm or} z RET}
385 \key{put current line on the {\bf middle} line}{z M {\rm or} z .}
386 \key{put current line on the {\bf last} line}{z L {\rm or} z -}
388 \section{Marking and Returning}
390 \key{{\bf mark} point in register {\it x}}{m {\it x}}
391 \key{set mark at buffer beginning}{m <}
392 \key{set mark at buffer end}{m >}
393 \key{set mark at point}{m .}
394 \key{jump to mark}{m ,}
395 \key{exchange point and mark}{` `}
396 \key{... and skip to first non-white on line}{' '}
397 \key{go to mark {\it x}}{` {\it x}}
398 \key{... and skip to first non-white on line}{' {\it x}}
400 \section{Macros}
402 \key{start remembering keyboard macro}{X (}
403 \key{finish remembering keyboard macro}{X )}
404 \key{call last keyboard macro}{*}
405 \key{execute macro stored in register {\it x}}{@ {\it x}}
407 \section{Motion Commands}
409 \key{go backward one character}{h}
410 \key{go forward one character}{l}
411 \key{next line keeping the column}{j}
412 \key{previous line keeping the column}{k}
413 \key{next line at first non-white}{+}
414 \key{previous line at first non-white}{-}
416 \key{beginning of line}{0}
417 \key{first non-white on line}{^}
418 \key{end of line}{\$}
419 \key{go to {\it n}-th column on line}{{\it n} |}
421 \key{go to {\it n}-th line}{{\it n} G}
422 \key{go to last line}{G}
423 \key{find matching parenthesis for \kbd{()}, \kbd{\{\}} and \kbd{[]}}{\%}
425 \key{go to {\bf home} window line}{H}
426 \key{go to {\bf middle} window line}{M}
427 \key{go to {\bf last} window line}{L}
429 \subsection{Words, Sentences, Paragraphs}
431 \key{forward {\bf word}}{w {\rm or} W}
432 \key{{\bf backward} word}{b {\rm or} B}
433 \key{{\bf end} of word}{e {\rm or} E}
435 In the case of capital letter commands, a word is delimited by a
436 non-white character.
438 \key{forward sentence}{)}
439 \key{backward sentence}{(}
441 \key{forward paragraph}{\}}
442 \key{backward paragraph}{\{}
444 \subsection{Find Characters on the Line}
446 \key{{\bf find} {\it c} forward on line}{f {\it c}}
447 \key{{\bf find} {\it c} backward on line}{F {\it c}}
448 \key{up {\bf to} {\it c} forward on line}{t {\it c}}
449 \key{up {\bf to} {\it c} backward on line}{T {\it c}}
450 \key{repeat previous \kbd{f}, \kbd{F}, \kbd{t} or \kbd{T}}{;}
451 \key{... in the opposite direction}{,}
453 \newcolumn
454 \title{VIP Quick Reference Card}
456 \section{Searching and Replacing}
458 \key{search forward for {\sl pat}}{/ {\sl pat}}
459 \key{search backward for {\sl pat}}{?\ {\sl pat}}
460 \key{repeat previous search}{n}
461 \key{... in the opposite direction}{N}
463 \key{incremental {\bf search}}{C-s}
464 \key{{\bf reverse} incremental search}{C-r}
466 \key{{\bf replace}}{R}
467 \key{{\bf query} replace}{Q}
468 \key{{\bf replace} a character by another character {\it c}}{r {\it c}}
470 \section{Modifying Commands}
472 The delete (yank, change) commands explained below accept a motion command as
473 their argument and delete (yank, change) the region determined by the motion
474 command. Motion commands are classified into {\it point commands} and
475 {\it line commands}. In the case of line commands, whole lines will
476 be affected by the command. Motion commands will be represented by
477 {\it m} below.
479 The point commands are as follows:
481 \hskip 5ex
482 \kbd{h l 0 ^ \$ w W b B e E ( ) / ?\ ` f F t T \% ; ,}
484 The line commands are as follows:
486 \hskip 5ex
487 \kbd{j k + - H M L \{ \} G '}
489 \subsection{Delete/Yank/Change Commands}
491 \paralign to \hsize{#\tabskip=10pt plus 1 fil&#\tabskip=0pt&#\tabskip=0pt&#\cr
492 \fourcol{}{{\bf delete}}{{\bf yank}}{{\bf change}}
493 \fourcol{region determined by {\it m}}{d {\it m}}{y {\it m}}{c {\it m}}
494 \fourcol{... into register {\it x}}{" {\it x\/} d {\it m}}{" {\it x\/} y {\it m}}{" {\it x\/} c {\it m}}
495 \fourcol{a line}{d d}{Y {\rm or} y y}{c c}
496 \fourcol{current {\bf region}}{d r}{y r}{c r}
497 \fourcol{expanded {\bf region}}{d R}{y R}{c R}
498 \fourcol{to end of line}{D}{y \$}{c \$}
499 \fourcol{a character after point}{x}{y l}{c l}
500 \fourcol{a character before point}{DEL}{y h}{c h}
503 \subsection{Put Back Commands}
505 Deleted/yanked/changed text can be put back by the following commands.
507 \key{{\bf Put} back at point/above line}{P}
508 \key{... from register {\it x}}{" {\it x\/} P}
509 \key{{\bf put} back after point/below line}{p}
510 \key{... from register {\it x}}{" {\it x\/} p}
512 \subsection{Repeating and Undoing Modifications}
514 \key{{\bf undo} last change}{u {\rm or} :und}
515 \key{repeat last change}{.\ {\rm (dot)}}
517 Undo is undoable by \kbd{u} and repeatable by \kbd{.}.
518 For example, \kbd{u...} will undo 4 previous changes.
519 A \kbd{.} after \kbd{5dd} is equivalent to \kbd{5dd},
520 while \kbd{3.} after \kbd{5dd} is equivalent to \kbd{3dd}.
522 \section{Miscellaneous Commands}
524 \endindentedkeys
526 \paralign to \hsize{#\tabskip=5pt plus 1 fil&#\tabskip=0pt&#\tabskip=0pt&#\tabskip=0pt&#\cr
527 \fivecol{}{{\bf shift left}}{{\bf shift right}}{{\bf filter shell command}}{{\bf indent}}
528 \fivecol{region}{< {\it m}}{> {\it m}}{!\ {\it m\/} {\sl shell-com}}{= {\it m}}
529 \fivecol{line}{< <}{> >}{!\ !\ {\sl shell-com}}{= =}
532 \key{emulate \kbd{ESC}/\kbd{C-h} in emacs mode}{ESC{\rm /}C-h}
533 \key{emulate \kbd{C-c}/\kbd{C-x} in emacs mode}{C{\rm /}X}
535 \key{{\bf join} lines}{J}
537 \key{lowercase region}{\# c {\it m}}
538 \key{uppercase region}{\# C {\it m}}
539 \key{execute last keyboard macro on each line in the region}{\# g {\it m}}
541 \key{insert specified string for each line in the region}{\# q {\it m}}
542 \key{check spelling of the words in the region}{\# s {\it m}}
544 \section{Differences from Vi}
546 \beginindentedkeys
548 In VIP some keys behave rather differently from Vi.
549 The table below lists such keys, and you can get the effect of typing
550 these keys by typing the corresponding keys in the VIP column.
552 \paralign to \hsize{#\tabskip=10pt plus 1 fil&#\tabskip=0pt&#\cr
553 \threecol{}{{\bf Vi}}{{\bf VIP}}
554 \threecol{forward character}{SPC}{l}
555 \threecol{backward character}{C-h}{h}
556 \threecol{next line at first non-white}{RET}{+}
557 \threecol{delete previous character}{X}{DEL}
558 \threecol{get information on file}{C-g}{g}
559 \threecol{substitute characters}{s}{x i}
560 \threecol{substitute line}{S}{c c}
561 \threecol{change to end of line}{C {\rm or} R}{c \$}
564 (Strictly speaking, \kbd{C} and \kbd{R} behave slightly differently in Vi.)
566 \section{Customization}
568 By default, search is case sensitive.
569 You can change this by including the following line in your \kbd{.vip} file.
571 \hskip 5ex
572 \kbd{(setq vip-case-fold-search t)}
574 \beginindentedkeys
576 \paralign to \hsize{#\tabskip=10pt plus 1 fil&#\tabskip=0pt&#\cr
577 \twocol{{\bf variable}}{{\bf default value}}
578 \twocol{vip-search-wrap-around}{t}
579 \twocol{vip-case-fold-search}{nil}
580 \twocol{vip-re-search}{nil}
581 \twocol{vip-re-replace}{nil}
582 \twocol{vip-re-query-replace}{nil}
583 \twocol{vip-open-with-indent}{nil}
584 \twocol{vip-help-in-insert-mode}{nil}
585 \twocol{vip-shift-width}{8}
586 \twocol{vip-tags-file-name}{"TAGS"}
589 %\subsection{Customizing Key Bindings}
591 Include (some of) following lines in your \kbd{.vip} file
592 to restore Vi key bindings.
594 \beginexample
595 (define-key vip-mode-map "\\C-g" 'vip-info-on-file)
596 (define-key vip-mode-map "\\C-h" 'vip-backward-char)
597 (define-key vip-mode-map "\\C-m" 'vip-next-line-at-bol)
598 (define-key vip-mode-map " " 'vip-forward-char)
599 (define-key vip-mode-map "g" 'vip-keyboard-quit)
600 (define-key vip-mode-map "s" 'vip-substitute)
601 (define-key vip-mode-map "C" 'vip-change-to-eol)
602 (define-key vip-mode-map "R" 'vip-change-to-eol)
603 (define-key vip-mode-map "S" 'vip-substitute-line)
604 (define-key vip-mode-map "X" 'vip-delete-backward-char)
605 \endexample
607 \newcolumn
609 \title{Ex Commands in VIP}
611 In vi mode, an Ex command is entered by typing:
613 \hskip 5ex
614 \kbd{:\ {\sl ex-command} RET}
616 \section{Ex Addresses}
618 \paralign to \hsize{#\tabskip=5pt plus 1 fil&#\tabskip=2pt&#\tabskip=5pt plus 1 fil&#\cr
619 \twocolkey{current line}{.}{next line with {\sl pat}}{/ {\sl pat} /}
620 \twocolkey{line {\it n}}{{\it n}}{previous line with {\sl pat}}{?\ {\sl pat} ?}
621 \twocolkey{last line}{\$}{{\it n\/} line before {\it a}}{{\it a} - {\it n}}
622 \twocolkey{next line}{+}{{\it a\/} through {\it b}}{{\it a\/} , {\it b}}
623 \twocolkey{previous line}{-}{line marked with {\it x}}{' {\it x}}
624 \twocolkey{entire buffer}{\%}{previous context}{' '}
627 Addresses can be specified in front of a command.
628 For example,
630 \hskip 5ex
631 \kbd{:.,.+10m\$}
633 moves 11 lines below current line to the end of buffer.
635 \section{Ex Commands}
637 \endindentedkeys
639 \key{mark lines matching {\sl pat} and execute {\sl cmds} on these lines}{:g /{\sl pat}/ {\sl cmds}}
641 \key{mark lines {\it not\/} matching {\sl pat} and execute {\sl cmds} on these lines}{:v /{\sl pat}/ {\sl cmds}}
644 \key{{\bf move} specified lines after {\sl addr}}{:m {\sl addr}}
645 \key{{\bf copy} specified lines after {\sl addr}}{:co\rm\ (or \kbd{:t})\ \sl addr}
646 \key{{\bf delete} specified lines [into register {\it x\/}]}{:d {\rm [{\it x\/}]}}
647 \key{{\bf yank} specified lines [into register {\it x\/}]}{:y {\rm [{\it x\/}]}}
648 \key{{\bf put} back text [from register {\it x\/}]}{:pu {\rm [{\it x\/}]}}
650 \key{{\bf substitute} {\sl repl} for first string on line matching {\sl pat}}{:s /{\sl pat}/{\sl repl}/}
652 \key{repeat last substitution}{:\&}
653 \key{repeat previous substitute with previous search pattern as {\sl pat}}{:\~{}}
655 \key{{\bf read} in a file}{:r {\sl file}}
656 \key{{\bf read} in the output of a shell command}{:r!\ {\sl command}}
657 \key{write out specified lines into {\sl file}}{:w {\sl file}}
658 \key{write out specified lines at the end of {\sl file}}{:w>> {\sl file}}
659 \key{write out and then quit}{:wq {\sl file}}
661 \key{define a macro {\it x} that expands to {\sl cmd}}{:map {\it x} {\sl cmd}}
662 \key{remove macro expansion associated with {\it x}}{:unma {\it x}}
664 \key{print line number}{:=}
665 \key{print {\bf version} number of VIP}{:ve}
667 \key{shift specified lines to the right}{:>}
668 \key{shift specified lines to the left}{:<}
670 \key{{\bf join} lines}{:j}
671 \key{mark specified line to register {\it x}}{:k {\it x}}
672 \key{{\bf set} a variable's value}{:se}
673 \key{run a sub{\bf shell} in a window}{:sh}
674 \key{execute shell command {\sl command}}{:!\ {\sl command}}
675 \key{find first definition of {\bf tag} {\sl tag}}{:ta {\sl tag}}
678 \copyrightnotice
680 \bye
682 % Local variables:
683 % compile-command: "pdftex vipcard"
684 % End: