2000-07-05 Michael Kifer <kifer@cs.sunysb.edu>
[emacs.git] / etc / vipcard.tex
blob26bd05b8fc3ffd799bf3c0cf7ecf3b26263f7097
1 % Quick Reference Card for VIP 3.5 under GNU Emacs version 18 on Unix systems
2 %**start of header
3 \newcount\columnsperpage
5 % This file can be printed with 1, 2, or 3 columns per page (see below).
6 % Specify how many you want here. Nothing else needs to be changed.
8 \columnsperpage=1
10 % Copyright (c) 1987 Free Software Foundation, Inc.
12 % This file is part of GNU Emacs.
14 % This file is distributed in the hope that it will be useful,
15 % but WITHOUT ANY WARRANTY. No author or distributor
16 % accepts responsibility to anyone for the consequences of using it
17 % or for whether it serves any particular purpose or describes
18 % any piece of software unless they say so in writing. Refer to the
19 % GNU Emacs General Public License for full details.
21 % Permission is granted to copy, modify and redistribute this source
22 % file provided the copyright notice and permission notices are
23 % preserved on all copies.
25 % Permission is granted to process this file through TeX and print the
26 % results, provided the printed document carries copyright and
27 % permission notices identical to the ones below.
29 % This file is intended to be processed by plain TeX (TeX82).
31 % The final reference card has six columns, three on each side.
32 % This file can be used to produce it in any of three ways:
33 % 1 column per page
34 % produces six separate pages, each of which needs to be reduced to 80%.
35 % This gives the best resolution.
36 % 2 columns per page
37 % produces three already-reduced pages.
38 % You will still need to cut and paste.
39 % 3 columns per page
40 % produces two pages which must be printed sideways to make a
41 % ready-to-use 8.5 x 11 inch reference card.
42 % For this you need a dvi device driver that can print sideways.
43 % Which mode to use is controlled by setting \columnsperpage above.
45 % Author:
46 % Masahiko Sato
47 % Internet: ms@sail.stanford.edu
48 % Junet: masahiko@sato.riec.tohoku.junet
50 % The original TeX code for formatting the reference card was written by:
51 % Stephen Gildea
52 % UUCP: mit-erl!gildea
53 % Internet: gildea@erl.mit.edu
56 \def\versionnumber{1.2}
57 \def\year{1987}
58 \def\version{September \year\ v\versionnumber}
60 \def\shortcopyrightnotice{\vskip 1ex plus 2 fill
61 \centerline{\small \copyright\ \year\ Free Software Foundation, Inc.
62 Permissions on back. v\versionnumber}}
64 \def\copyrightnotice{
65 %\vskip 1ex plus 2 fill\begingroup\small
66 \vskip 1ex \begingroup\small
67 \centerline{Copyright \copyright\ \year\ Free Software Foundation, Inc.}
68 \centerline{designed by Masahiko Sato, \version}
69 \centerline{for VIP 3.5 under GNU Emacs version 18 on Unix systems}
71 Permission is granted to make and distribute copies of
72 this card provided the copyright notice and this permission notice
73 are preserved on all copies.
75 For copies of the GNU Emacs manual, write to the Free Software
76 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
78 \endgroup}
80 % make \bye not \outer so that the \def\bye in the \else clause below
81 % can be scanned without complaint.
82 \def\bye{\par\vfill\supereject\end}
84 \newdimen\intercolumnskip
85 \newbox\columna
86 \newbox\columnb
88 \def\ncolumns{\the\columnsperpage}
90 \message{[\ncolumns\space
91 column\if 1\ncolumns\else s\fi\space per page]}
93 \def\scaledmag#1{ scaled \magstep #1}
95 % This multi-way format was designed by Stephen Gildea
96 % October 1986.
97 % Slightly modified by Masahiko Sato, September 1987.
98 \if 1\ncolumns
99 \hsize 4in
100 \vsize 10in
101 %\voffset -.7in
102 \voffset -.57in
103 \font\titlefont=\fontname\tenbf \scaledmag3
104 \font\headingfont=\fontname\tenbf \scaledmag2
105 \font\miniheadingfont=\fontname\tenbf \scaledmag1 % masahiko
106 \font\smallfont=\fontname\sevenrm
107 \font\smallsy=\fontname\sevensy
109 \footline{\hss\folio}
110 \def\makefootline{\baselineskip10pt\hsize6.5in\line{\the\footline}}
111 \else
112 %\hsize 3.2in
113 %\vsize 7.95in
114 \hsize 3.41in % masahiko
115 \vsize 8in % masahiko
116 \hoffset -.75in
117 \voffset -.745in
118 \font\titlefont=cmbx10 \scaledmag2
119 \font\headingfont=cmbx10 \scaledmag1
120 \font\miniheadingfont=cmbx10 % masahiko
121 \font\smallfont=cmr6
122 \font\smallsy=cmsy6
123 \font\eightrm=cmr8
124 \font\eightbf=cmbx8
125 \font\eightit=cmti8
126 \font\eightsl=cmsl8
127 \font\eighttt=cmtt8
128 \font\eightsy=cmsy8
129 \textfont0=\eightrm
130 \textfont2=\eightsy
131 \def\rm{\eightrm}
132 \def\bf{\eightbf}
133 \def\it{\eightit}
134 \def\sl{\eightsl} % masahiko
135 \def\tt{\eighttt}
136 \normalbaselineskip=.8\normalbaselineskip
137 \normallineskip=.8\normallineskip
138 \normallineskiplimit=.8\normallineskiplimit
139 \normalbaselines\rm %make definitions take effect
141 \if 2\ncolumns
142 \let\maxcolumn=b
143 \footline{\hss\rm\folio\hss}
144 \def\makefootline{\vskip 2in \hsize=6.86in\line{\the\footline}}
145 \else \if 3\ncolumns
146 \let\maxcolumn=c
147 \nopagenumbers
148 \else
149 \errhelp{You must set \columnsperpage equal to 1, 2, or 3.}
150 \errmessage{Illegal number of columns per page}
151 \fi\fi
153 %\intercolumnskip=.46in
154 \intercolumnskip=.19in % masahiko .19x4 + 3.41x3 = 10.99
155 \def\abc{a}
156 \output={%
157 % This next line is useful when designing the layout.
158 %\immediate\write16{Column \folio\abc\space starts with \firstmark}
159 \if \maxcolumn\abc \multicolumnformat \global\def\abc{a}
160 \else\if a\abc
161 \global\setbox\columna\columnbox \global\def\abc{b}
162 %% in case we never use \columnb (two-column mode)
163 \global\setbox\columnb\hbox to -\intercolumnskip{}
164 \else
165 \global\setbox\columnb\columnbox \global\def\abc{c}\fi\fi}
166 \def\multicolumnformat{\shipout\vbox{\makeheadline
167 \hbox{\box\columna\hskip\intercolumnskip
168 \box\columnb\hskip\intercolumnskip\columnbox}
169 \makefootline}\advancepageno}
170 \def\columnbox{\leftline{\pagebody}}
172 \def\bye{\par\vfill\supereject
173 \if a\abc \else\null\vfill\eject\fi
174 \if a\abc \else\null\vfill\eject\fi
175 \end}
178 % we won't be using math mode much, so redefine some of the characters
179 % we might want to talk about
180 \catcode`\^=12
181 \catcode`\_=12
183 \chardef\\=`\\
184 \chardef\{=`\{
185 \chardef\}=`\}
187 \hyphenation{mini-buf-fer}
189 \parindent 0pt
190 \parskip 1ex plus .5ex minus .5ex
192 \def\small{\smallfont\textfont2=\smallsy\baselineskip=.8\baselineskip}
194 \outer\def\newcolumn{\vfill\eject}
196 \outer\def\title#1{{\titlefont\centerline{#1}}\vskip 1ex plus .5ex}
198 \outer\def\section#1{\par\filbreak
199 \vskip 3ex plus 2ex minus 2ex {\headingfont #1}\mark{#1}%
200 \vskip 2ex plus 1ex minus 1.5ex}
202 % masahiko
203 \outer\def\subsection#1{\par\filbreak
204 \vskip 2ex plus 2ex minus 2ex {\miniheadingfont #1}\mark{#1}%
205 \vskip 1ex plus 1ex minus 1.5ex}
207 \newdimen\keyindent
209 \def\beginindentedkeys{\keyindent=1em}
210 \def\endindentedkeys{\keyindent=0em}
211 \endindentedkeys
213 \def\paralign{\vskip\parskip\halign}
215 \def\<#1>{$\langle${\rm #1}$\rangle$}
217 \def\kbd#1{{\tt#1}\null} %\null so not an abbrev even if period follows
219 \def\beginexample{\par\leavevmode\begingroup
220 \obeylines\obeyspaces\parskip0pt\tt}
221 {\obeyspaces\global\let =\ }
222 \def\endexample{\endgroup}
224 \def\key#1#2{\leavevmode\hbox to \hsize{\vtop
225 {\hsize=.75\hsize\rightskip=1em
226 \hskip\keyindent\relax#1}\kbd{#2}\hfil}}
228 \newbox\metaxbox
229 \setbox\metaxbox\hbox{\kbd{M-x }}
230 \newdimen\metaxwidth
231 \metaxwidth=\wd\metaxbox
233 \def\metax#1#2{\leavevmode\hbox to \hsize{\hbox to .75\hsize
234 {\hskip\keyindent\relax#1\hfil}%
235 \hskip -\metaxwidth minus 1fil
236 \kbd{#2}\hfil}}
238 \def\fivecol#1#2#3#4#5{\hskip\keyindent\relax#1\hfil&\kbd{#2}\quad
239 &\kbd{#3}\quad&\kbd{#4}\quad&\kbd{#5}\cr}
241 \def\fourcol#1#2#3#4{\hskip\keyindent\relax#1\hfil&\kbd{#2}\quad
242 &\kbd{#3}\quad&\kbd{#4}\quad\cr}
244 \def\threecol#1#2#3{\hskip\keyindent\relax#1\hfil&\kbd{#2}\quad
245 &\kbd{#3}\quad\cr}
247 \def\twocol#1#2{\hskip\keyindent\relax\kbd{#1}\hfil&\kbd{#2}\quad\cr}
249 \def\twocolkey#1#2#3#4{\hskip\keyindent\relax#1\hfil&\kbd{#2}\quad&\relax#3\hfil&\kbd{#4}\quad\cr}
251 %**end of header
253 \beginindentedkeys
255 \title{VIP Quick Reference Card}
257 \centerline{(for version 3.5 under GNU Emacs version 18)}
259 %\copyrightnotice
261 \section{Loading VIP}
263 Just type \kbd{M-x vip-mode} followed by \kbd{RET}
265 \section{VIP Modes}
267 VIP has three modes: {\it emacs mode}, {\it vi mode} and {\it insert mode}.
268 Mode line tells you which mode you are in.
269 In emacs mode you can do all the normal GNU Emacs editing.
270 This card explains only vi mode and insert mode.
271 {\bf GNU Emacs Reference Card} explains emacs mode.
272 You can switch modes as follows.
274 \key{from emacs mode to vi mode}{C-z}
275 \key{from vi mode to emacs mode}{C-z}
276 \metax{from vi mode to insert mode}{i, I, a, A, o, O {\rm or} C-o}
277 \key{from insert mode to vi mode}{ESC}
279 If you wish to be in vi mode just after you startup Emacs,
280 include the line:
282 \hskip 5ex
283 \kbd{(setq term-setup-hook 'vip-mode)}
285 in your \kbd{.emacs} file.
286 Or, you can put the following alias in your \kbd{.cshrc} file.
288 \hskip 5ex
289 \kbd{alias vip 'emacs \\!* -f vip-mode'}
292 \section{Insert Mode}
293 Insert mode is like emacs mode except for the following.
295 \key{go back to vi mode}{ESC}
296 \key{delete previous character}{C-h}
297 \key{delete previous word}{C-w}
298 \key{emulate \kbd{ESC} key in emacs mode}{C-z}
300 The rest of this card explains commands in {\bf vi mode}.
302 \section{Getting Information on VIP}
304 Execute info command by typing \kbd{M-x info} and select menu item
305 \kbd{vip}. Also:
307 \key{describe function attached to the key {\it x}}{C-h k {\it x}}
309 \section{Leaving Emacs}
311 \key{suspend Emacs}{X Z {\rm or} :st}
312 \metax{exit Emacs permanently}{Z Z {\rm or} X C {\rm or} :q}
314 \section{Error Recovery}
316 \key{abort partially typed or executing command}{C-g}
317 \key{redraw messed up screen}{C-l}
318 \metax{{\bf recover} a file lost by a system crash}{M-x recover-file}
319 \metax{restore a buffer to its original contents}{M-x revert-buffer}
321 \shortcopyrightnotice
323 \section{Counts}
325 Most commands in vi mode accept a {\it count} which can be supplied as a
326 prefix to the commands. In most cases, if a count is given, the
327 command is executed that many times. E.g., \kbd{5 d d} deletes 5
328 lines.
330 %\shortcopyrightnotice
331 \section{Registers}
333 There are 26 registers (\kbd{a} to \kbd{z}) that can store texts
334 and marks.
335 You can append a text at the end of a register (say \kbd{x}) by
336 specifying the register name in capital letter (say \kbd{X}).
337 There are also 9 read only registers (\kbd{1} to \kbd{9}) that store
338 up to 9 previous changes.
339 We will use {\it x\/} to denote a register.
340 \section{Entering Insert Mode}
342 \key{{\bf insert} at point}{i}
343 \key{{\bf append} after cursor}{a}
344 \key{{\bf insert} before first non-white}{I}
345 \key{{\bf append} at end of line}{A}
346 \key{{\bf open} line below}{o}
347 \key{{\bf open} line above}{O}
348 \key{{\bf open} line at point}{C-o}
350 \section{Buffers and Windows}
352 \key{move cursor to {\bf next} window}{C-n}
353 \key{delete current window}{X 0}
354 \key{delete other windows}{X 1}
355 \key{split current window into two windows}{X 2}
356 \key{show current buffer in two windows}{X 3}
357 \key{{\bf switch} to a buffer in the current window}{s {\sl buffer}}
358 \key{{\bf switch} to a buffer in another window}{S {\sl buffer}}
359 \key{{\bf kill} a buffer}{K}
360 \key{list existing {\bf buffers}}{X B}
362 \section{Files}
364 \metax{{\bf visit} file in the current window}{v {\sl file} {\rm or} :e {\sl file}}
365 \key{{\bf visit} file in another window}{V {\sl file}}
366 \key{{\bf save} buffer to the associated file}{X S}
367 \key{{\bf write} buffer to a specified file}{X W}
368 \key{{\bf insert} a specified file at point}{X I}
369 \key{{\bf get} information on the current {\bf file}}{g {\rm or} :f}
370 \key{run the {\bf directory} editor}{X d}
372 \section{Viewing the Buffer}
374 \key{scroll to next screen}{SPC {\rm or} C-f}
375 \key{scroll to previous screen}{RET {\rm or} C-b}
376 \key{scroll {\bf down} half screen}{C-d}
377 \key{scroll {\bf up} half screen}{C-u}
378 \key{scroll down one line}{C-e}
379 \key{scroll up one line}{C-y}
381 \key{put current line on the {\bf home} line}{z H {\rm or} z RET}
382 \key{put current line on the {\bf middle} line}{z M {\rm or} z .}
383 \key{put current line on the {\bf last} line}{z L {\rm or} z -}
385 \section{Marking and Returning}
387 \key{{\bf mark} point in register {\it x}}{m {\it x}}
388 \key{set mark at buffer beginning}{m <}
389 \key{set mark at buffer end}{m >}
390 \key{set mark at point}{m .}
391 \key{jump to mark}{m ,}
392 \key{exchange point and mark}{` `}
393 \key{... and skip to first non-white on line}{' '}
394 \key{go to mark {\it x}}{` {\it x}}
395 \key{... and skip to first non-white on line}{' {\it x}}
397 \section{Macros}
399 \key{start remembering keyboard macro}{X (}
400 \key{finish remembering keyboard macro}{X )}
401 \key{call last keyboard macro}{*}
402 \key{execute macro stored in register {\it x}}{@ {\it x}}
404 \section{Motion Commands}
406 \key{go backward one character}{h}
407 \key{go forward one character}{l}
408 \key{next line keeping the column}{j}
409 \key{previous line keeping the column}{k}
410 \key{next line at first non-white}{+}
411 \key{previous line at first non-white}{-}
413 \key{beginning of line}{0}
414 \key{first non-white on line}{^}
415 \key{end of line}{\$}
416 \key{go to {\it n}-th column on line}{{\it n} |}
418 \key{go to {\it n}-th line}{{\it n} G}
419 \key{go to last line}{G}
420 \key{find matching parenthesis for \kbd{()}, \kbd{\{\}} and \kbd{[]}}{\%}
422 \key{go to {\bf home} window line}{H}
423 \key{go to {\bf middle} window line}{M}
424 \key{go to {\bf last} window line}{L}
426 \subsection{Words, Sentences, Paragraphs}
428 \key{forward {\bf word}}{w {\rm or} W}
429 \key{{\bf backward} word}{b {\rm or} B}
430 \key{{\bf end} of word}{e {\rm or} E}
432 In the case of capital letter commands, a word is delimited by a
433 non-white character.
435 \key{forward sentence}{)}
436 \key{backward sentence}{(}
438 \key{forward paragraph}{\}}
439 \key{backward paragraph}{\{}
441 \subsection{Find Characters on the Line}
443 \key{{\bf find} {\it c} forward on line}{f {\it c}}
444 \key{{\bf find} {\it c} backward on line}{F {\it c}}
445 \key{up {\bf to} {\it c} forward on line}{t {\it c}}
446 \key{up {\bf to} {\it c} backward on line}{T {\it c}}
447 \key{repeat previous \kbd{f}, \kbd{F}, \kbd{t} or \kbd{T}}{;}
448 \key{... in the opposite direction}{,}
450 \newcolumn
451 \title{VIP Quick Reference Card}
453 \section{Searching and Replacing}
455 \key{search forward for {\sl pat}}{/ {\sl pat}}
456 \key{search backward for {\sl pat}}{?\ {\sl pat}}
457 \key{repeat previous search}{n}
458 \key{... in the opposite direction}{N}
460 \key{incremental {\bf search}}{C-s}
461 \key{{\bf reverse} incremental search}{C-r}
463 \key{{\bf replace}}{R}
464 \key{{\bf query} replace}{Q}
465 \key{{\bf replace} a character by another character {\it c}}{r {\it c}}
467 \section{Modifying Commands}
469 The delete (yank, change) commands explained below accept a motion command as
470 their argument and delete (yank, change) the region determined by the motion
471 command. Motion commands are classified into {\it point commands} and
472 {\it line commands}. In the case of line commands, whole lines will
473 be affected by the command. Motion commands will be represented by
474 {\it m} below.
476 The point commands are as follows:
478 \hskip 5ex
479 \kbd{h l 0 ^ \$ w W b B e E ( ) / ?\ ` f F t T \% ; ,}
481 The line commands are as follows:
483 \hskip 5ex
484 \kbd{j k + - H M L \{ \} G '}
486 \subsection{Delete/Yank/Change Commands}
488 \paralign to \hsize{#\tabskip=10pt plus 1 fil&#\tabskip=0pt&#\tabskip=0pt&#\cr
489 \fourcol{}{{\bf delete}}{{\bf yank}}{{\bf change}}
490 \fourcol{region determined by {\it m}}{d {\it m}}{y {\it m}}{c {\it m}}
491 \fourcol{... into register {\it x}}{" {\it x\/} d {\it m}}{" {\it x\/} y {\it m}}{" {\it x\/} c {\it m}}
492 \fourcol{a line}{d d}{Y {\rm or} y y}{c c}
493 \fourcol{current {\bf region}}{d r}{y r}{c r}
494 \fourcol{expanded {\bf region}}{d R}{y R}{c R}
495 \fourcol{to end of line}{D}{y \$}{c \$}
496 \fourcol{a character after point}{x}{y l}{c l}
497 \fourcol{a character before point}{DEL}{y h}{c h}
500 \subsection{Put Back Commands}
502 Deleted/yanked/changed text can be put back by the following commands.
504 \key{{\bf Put} back at point/above line}{P}
505 \key{... from register {\it x}}{" {\it x\/} P}
506 \key{{\bf put} back after point/below line}{p}
507 \key{... from register {\it x}}{" {\it x\/} p}
509 \subsection{Repeating and Undoing Modifications}
511 \key{{\bf undo} last change}{u {\rm or} :und}
512 \key{repeat last change}{.\ {\rm (dot)}}
514 Undo is undoable by \kbd{u} and repeatable by \kbd{.}.
515 For example, \kbd{u...} will undo 4 previous changes.
516 A \kbd{.} after \kbd{5dd} is equivalent to \kbd{5dd},
517 while \kbd{3.} after \kbd{5dd} is equivalent to \kbd{3dd}.
519 \section{Miscellaneous Commands}
521 \endindentedkeys
523 \paralign to \hsize{#\tabskip=5pt plus 1 fil&#\tabskip=0pt&#\tabskip=0pt&#\tabskip=0pt&#\cr
524 \fivecol{}{{\bf shift left}}{{\bf shift right}}{{\bf filter shell command}}{{\bf indent}}
525 \fivecol{region}{< {\it m}}{> {\it m}}{!\ {\it m\/} {\sl shell-com}}{= {\it m}}
526 \fivecol{line}{< <}{> >}{!\ !\ {\sl shell-com}}{= =}
529 \key{emulate \kbd{ESC}/\kbd{C-h} in emacs mode}{ESC{\rm /}C-h}
530 \key{emulate \kbd{C-c}/\kbd{C-x} in emacs mode}{C{\rm /}X}
532 \key{{\bf join} lines}{J}
534 \key{lowercase region}{\# c {\it m}}
535 \key{uppercase region}{\# C {\it m}}
536 \key{execute last keyboard macro on each line in the region}{\# g {\it m}}
538 \key{insert specified string for each line in the region}{\# q {\it m}}
539 \key{check spelling of the words in the region}{\# s {\it m}}
541 \section{Differences from Vi}
543 \beginindentedkeys
545 In VIP some keys behave rather differently from Vi.
546 The table below lists such keys, and you can get the effect of typing
547 these keys by typing the corresponding keys in the VIP column.
549 \paralign to \hsize{#\tabskip=10pt plus 1 fil&#\tabskip=0pt&#\cr
550 \threecol{}{{\bf Vi}}{{\bf VIP}}
551 \threecol{forward character}{SPC}{l}
552 \threecol{backward character}{C-h}{h}
553 \threecol{next line at first non-white}{RET}{+}
554 \threecol{delete previous character}{X}{DEL}
555 \threecol{get information on file}{C-g}{g}
556 \threecol{substitute characters}{s}{x i}
557 \threecol{substitute line}{S}{c c}
558 \threecol{change to end of line}{C {\rm or} R}{c \$}
561 (Strictly speaking, \kbd{C} and \kbd{R} behave slightly differently in Vi.)
563 \section{Customization}
565 By default, search is case sensitive.
566 You can change this by including the following line in your \kbd{.vip} file.
568 \hskip 5ex
569 \kbd{(setq vip-case-fold-search t)}
571 \beginindentedkeys
573 \paralign to \hsize{#\tabskip=10pt plus 1 fil&#\tabskip=0pt&#\cr
574 \twocol{{\bf variable}}{{\bf default value}}
575 \twocol{vip-search-wrap-around}{t}
576 \twocol{vip-case-fold-search}{nil}
577 \twocol{vip-re-search}{nil}
578 \twocol{vip-re-replace}{nil}
579 \twocol{vip-re-query-replace}{nil}
580 \twocol{vip-open-with-indent}{nil}
581 \twocol{vip-help-in-insert-mode}{nil}
582 \twocol{vip-shift-width}{8}
583 \twocol{vip-tags-file-name}{"TAGS"}
586 %\subsection{Customizing Key Bindings}
588 Include (some of) following lines in your \kbd{.vip} file
589 to restore Vi key bindings.
591 \beginexample
592 (define-key vip-mode-map "\\C-g" 'vip-info-on-file)
593 (define-key vip-mode-map "\\C-h" 'vip-backward-char)
594 (define-key vip-mode-map "\\C-m" 'vip-next-line-at-bol)
595 (define-key vip-mode-map " " 'vip-forward-char)
596 (define-key vip-mode-map "g" 'vip-keyboard-quit)
597 (define-key vip-mode-map "s" 'vip-substitute)
598 (define-key vip-mode-map "C" 'vip-change-to-eol)
599 (define-key vip-mode-map "R" 'vip-change-to-eol)
600 (define-key vip-mode-map "S" 'vip-substitute-line)
601 (define-key vip-mode-map "X" 'vip-delete-backward-char)
602 \endexample
604 \newcolumn
606 \title{Ex Commands in VIP}
608 In vi mode, an Ex command is entered by typing:
610 \hskip 5ex
611 \kbd{:\ {\sl ex-command} RET}
613 \section{Ex Addresses}
615 \paralign to \hsize{#\tabskip=5pt plus 1 fil&#\tabskip=2pt&#\tabskip=5pt plus 1 fil&#\cr
616 \twocolkey{current line}{.}{next line with {\sl pat}}{/ {\sl pat} /}
617 \twocolkey{line {\it n}}{{\it n}}{previous line with {\sl pat}}{?\ {\sl pat} ?}
618 \twocolkey{last line}{\$}{{\it n\/} line before {\it a}}{{\it a} - {\it n}}
619 \twocolkey{next line}{+}{{\it a\/} through {\it b}}{{\it a\/} , {\it b}}
620 \twocolkey{previous line}{-}{line marked with {\it x}}{' {\it x}}
621 \twocolkey{entire buffer}{\%}{previous context}{' '}
624 Addresses can be specified in front of a command.
625 For example,
627 \hskip 5ex
628 \kbd{:.,.+10m\$}
630 moves 11 lines below current line to the end of buffer.
632 \section{Ex Commands}
634 \endindentedkeys
636 \key{mark lines matching {\sl pat} and execute {\sl cmds} on these lines}{:g /{\sl pat}/ {\sl cmds}}
638 \key{mark lines {\it not\/} matching {\sl pat} and execute {\sl cmds} on these lines}{:v /{\sl pat}/ {\sl cmds}}
641 \key{{\bf move} specified lines after {\sl addr}}{:m {\sl addr}}
642 \key{{\bf copy} specified lines after {\sl addr}}{:co\rm\ (or \kbd{:t})\ \sl addr}
643 \key{{\bf delete} specified lines [into register {\it x\/}]}{:d {\rm [{\it x\/}]}}
644 \key{{\bf yank} specified lines [into register {\it x\/}]}{:y {\rm [{\it x\/}]}}
645 \key{{\bf put} back text [from register {\it x\/}]}{:pu {\rm [{\it x\/}]}}
647 \key{{\bf substitute} {\sl repl} for first string on line matching {\sl pat}}{:s /{\sl pat}/{\sl repl}/}
649 \key{repeat last substitution}{:\&}
650 \key{repeat previous substitute with previous search pattern as {\sl pat}}{:\~{}}
652 \key{{\bf read} in a file}{:r {\sl file}}
653 \key{{\bf read} in the output of a shell command}{:r!\ {\sl command}}
654 \key{write out specified lines into {\sl file}}{:w {\sl file}}
655 \key{write out specified lines at the end of {\sl file}}{:w>> {\sl file}}
656 \key{write out and then quit}{:wq {\sl file}}
658 \key{define a macro {\it x} that expands to {\sl cmd}}{:map {\it x} {\sl cmd}}
659 \key{remove macro expansion associated with {\it x}}{:unma {\it x}}
661 \key{print line number}{:=}
662 \key{print {\bf version} number of VIP}{:ve}
664 \key{shift specified lines to the right}{:>}
665 \key{shift specified lines to the left}{:<}
667 \key{{\bf join} lines}{:j}
668 \key{mark specified line to register {\it x}}{:k {\it x}}
669 \key{{\bf set} a variable's value}{:se}
670 \key{run a sub{\bf shell} in a window}{:sh}
671 \key{execute shell command {\sl command}}{:!\ {\sl command}}
672 \key{find first definition of {\bf tag} {\sl tag}}{:ta {\sl tag}}
675 \copyrightnotice
677 \bye
679 % Local variables:
680 % compile-command: "tex refcard"
681 % End: