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