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