comparison etc/vipcard.tex @ 25853:e96ffe544684

#
author Dave Love <fx@gnu.org>
date Sun, 03 Oct 1999 12:39:42 +0000
parents
children e69aa66ec7cc
comparison
equal deleted inserted replaced
25852:03ddf0b96330 25853:e96ffe544684
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 Free Software Foundation, Inc.
11
12 % This file is part of GNU Emacs.
13
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.
20 %
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.
24 %
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.
28
29 % This file is intended to be processed by plain TeX (TeX82).
30 %
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.
44 %
45 % Author:
46 % Masahiko Sato
47 % Internet: ms@sail.stanford.edu
48 % Junet: masahiko@sato.riec.tohoku.junet
49 %
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
54
55
56 \def\versionnumber{1.2}
57 \def\year{1987}
58 \def\version{September \year\ v\versionnumber}
59
60 \def\shortcopyrightnotice{\vskip 1ex plus 2 fill
61 \centerline{\small \copyright\ \year\ Free Software Foundation, Inc.
62 Permissions on back. v\versionnumber}}
63
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}
70
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.
74
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.
77
78 \endgroup}
79
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}
83
84 \newdimen\intercolumnskip
85 \newbox\columna
86 \newbox\columnb
87
88 \def\ncolumns{\the\columnsperpage}
89
90 \message{[\ncolumns\space
91 column\if 1\ncolumns\else s\fi\space per page]}
92
93 \def\scaledmag#1{ scaled \magstep #1}
94
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
108
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
140
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
152
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}}
171
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}
176 \fi
177
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
182
183 \chardef\\=`\\
184 \chardef\{=`\{
185 \chardef\}=`\}
186
187 \hyphenation{mini-buf-fer}
188
189 \parindent 0pt
190 \parskip 1ex plus .5ex minus .5ex
191
192 \def\small{\smallfont\textfont2=\smallsy\baselineskip=.8\baselineskip}
193
194 \outer\def\newcolumn{\vfill\eject}
195
196 \outer\def\title#1{{\titlefont\centerline{#1}}\vskip 1ex plus .5ex}
197
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}
201
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}
206
207 \newdimen\keyindent
208
209 \def\beginindentedkeys{\keyindent=1em}
210 \def\endindentedkeys{\keyindent=0em}
211 \endindentedkeys
212
213 \def\paralign{\vskip\parskip\halign}
214
215 \def\<#1>{$\langle${\rm #1}$\rangle$}
216
217 \def\kbd#1{{\tt#1}\null} %\null so not an abbrev even if period follows
218
219 \def\beginexample{\par\leavevmode\begingroup
220 \obeylines\obeyspaces\parskip0pt\tt}
221 {\obeyspaces\global\let =\ }
222 \def\endexample{\endgroup}
223
224 \def\key#1#2{\leavevmode\hbox to \hsize{\vtop
225 {\hsize=.75\hsize\rightskip=1em
226 \hskip\keyindent\relax#1}\kbd{#2}\hfil}}
227
228 \newbox\metaxbox
229 \setbox\metaxbox\hbox{\kbd{M-x }}
230 \newdimen\metaxwidth
231 \metaxwidth=\wd\metaxbox
232
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}}
237
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}
240
241 \def\fourcol#1#2#3#4{\hskip\keyindent\relax#1\hfil&\kbd{#2}\quad
242 &\kbd{#3}\quad&\kbd{#4}\quad\cr}
243
244 \def\threecol#1#2#3{\hskip\keyindent\relax#1\hfil&\kbd{#2}\quad
245 &\kbd{#3}\quad\cr}
246
247 \def\twocol#1#2{\hskip\keyindent\relax\kbd{#1}\hfil&\kbd{#2}\quad\cr}
248
249 \def\twocolkey#1#2#3#4{\hskip\keyindent\relax#1\hfil&\kbd{#2}\quad&\relax#3\hfil&\kbd{#4}\quad\cr}
250
251 %**end of header
252
253 \beginindentedkeys
254
255 \title{VIP Quick Reference Card}
256
257 \centerline{(for version 3.5 under GNU Emacs version 18)}
258
259 %\copyrightnotice
260
261 \section{Loading VIP}
262
263 Just type \kbd{M-x vip-mode} followed by \kbd{RET}
264
265 \section{VIP Modes}
266
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.
273
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}
278
279 If you wish to be in vi mode just after you startup Emacs,
280 include the line:
281
282 \hskip 5ex
283 \kbd{(setq term-setup-hook 'vip-mode)}
284
285 in your \kbd{.emacs} file.
286 Or, you can put the following alias in your \kbd{.cshrc} file.
287
288 \hskip 5ex
289 \kbd{alias vip 'emacs \\!* -f vip-mode'}
290
291
292 \section{Insert Mode}
293 Insert mode is like emacs mode except for the following.
294
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}
299
300 The rest of this card explains commands in {\bf vi mode}.
301
302 \section{Getting Information on VIP}
303
304 Execute info command by typing \kbd{M-x info} and select menu item
305 \kbd{vip}. Also:
306
307 \key{describe function attached to the key {\it x}}{C-h k {\it x}}
308
309 \section{Leaving Emacs}
310
311 \key{suspend Emacs}{X Z {\rm or} :st}
312 \metax{exit Emacs permanently}{Z Z {\rm or} X C {\rm or} :q}
313
314 \section{Error Recovery}
315
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}
320
321 \shortcopyrightnotice
322
323 \section{Counts}
324
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.
329
330 %\shortcopyrightnotice
331 \section{Registers}
332
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}
341
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}
349
350 \section{Buffers and Windows}
351
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}
361
362 \section{Files}
363
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}
371
372 \section{Viewing the Buffer}
373
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}
380
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 -}
384
385 \section{Marking and Returning}
386
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}}
396
397 \section{Macros}
398
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}}
403
404 \section{Motion Commands}
405
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}{-}
412
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} |}
417
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{[]}}{\%}
421
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}
425
426 \subsection{Words, Sentences, Paragraphs}
427
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}
431
432 In the case of capital letter commands, a word is delimited by a
433 non-white character.
434
435 \key{forward sentence}{)}
436 \key{backward sentence}{(}
437
438 \key{forward paragraph}{\}}
439 \key{backward paragraph}{\{}
440
441 \subsection{Find Characters on the Line}
442
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}{,}
449
450 \newcolumn
451 \title{VIP Quick Reference Card}
452
453 \section{Searching and Replacing}
454
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}
459
460 \key{incremental {\bf search}}{C-s}
461 \key{{\bf reverse} incremental search}{C-r}
462
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}}
466
467 \section{Modifying Commands}
468
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.
475
476 The point commands are as follows:
477
478 \hskip 5ex
479 \kbd{h l 0 ^ \$ w W b B e E ( ) / ?\ ` f F t T \% ; ,}
480
481 The line commands are as follows:
482
483 \hskip 5ex
484 \kbd{j k + - H M L \{ \} G '}
485
486 \subsection{Delete/Yank/Change Commands}
487
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}
498 }
499
500 \subsection{Put Back Commands}
501
502 Deleted/yanked/changed text can be put back by the following commands.
503
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}
508
509 \subsection{Repeating and Undoing Modifications}
510
511 \key{{\bf undo} last change}{u {\rm or} :und}
512 \key{repeat last change}{.\ {\rm (dot)}}
513
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}.
518
519 \section{Miscellaneous Commands}
520
521 \endindentedkeys
522
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}}{= =}
527 }
528
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}
531
532 \key{{\bf join} lines}{J}
533
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}}
537
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}}
540
541 \section{Differences from Vi}
542
543 \beginindentedkeys
544
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.
548
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 \$}
559 }
560
561 (Strictly speaking, \kbd{C} and \kbd{R} behave slightly differently in Vi.)
562
563 \section{Customization}
564
565 By default, search is case sensitive.
566 You can change this by including the following line in your \kbd{.vip} file.
567
568 \hskip 5ex
569 \kbd{(setq vip-case-fold-search t)}
570
571 \beginindentedkeys
572
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"}
584 }
585
586 %\subsection{Customizing Key Bindings}
587
588 Include (some of) following lines in your \kbd{.vip} file
589 to restore Vi key bindings.
590
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
603
604 \newcolumn
605
606 \title{Ex Commands in VIP}
607
608 In vi mode, an Ex command is entered by typing:
609
610 \hskip 5ex
611 \kbd{:\ {\sl ex-command} RET}
612
613 \section{Ex Addresses}
614
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}{' '}
622 }
623
624 Addresses can be specified in front of a command.
625 For example,
626
627 \hskip 5ex
628 \kbd{:.,.+10m\$}
629
630 moves 11 lines below current line to the end of buffer.
631
632 \section{Ex Commands}
633
634 \endindentedkeys
635
636 \key{mark lines matching {\sl pat} and execute {\sl cmds} on these lines}{:g /{\sl pat}/ {\sl cmds}}
637
638 \key{mark lines {\it not\/} matching {\sl pat} and execute {\sl cmds} on these lines}{:v /{\sl pat}/ {\sl cmds}}
639
640
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\/}]}}
646
647 \key{{\bf substitute} {\sl repl} for first string on line matching {\sl pat}}{:s /{\sl pat}/{\sl repl}/}
648
649 \key{repeat last substitution}{:\&}
650 \key{repeat previous substitute with previous search pattern as {\sl pat}}{:\~{}}
651
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}}
657
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}}
660
661 \key{print line number}{:=}
662 \key{print {\bf version} number of VIP}{:ve}
663
664 \key{shift specified lines to the right}{:>}
665 \key{shift specified lines to the left}{:<}
666
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}}
673
674
675 \copyrightnotice
676
677 \bye
678
679 % Local variables:
680 % compile-command: "tex refcard"
681 % End: