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