comparison etc/viperCard.tex @ 0:376386a54a3c r19-14

Import from CVS: tag r19-14
author cvs
date Mon, 13 Aug 2007 08:45:50 +0200
parents
children bcdc7deadc19
comparison
equal deleted inserted replaced
-1:000000000000 0:376386a54a3c
1 % ViperCard -- The Reference Card for Viper under GNU Emacs 19 and XEmacs 19
2 %**start of header
3 \newcount\columnsperpage
4
5 % This file can be printed with 1 or 2 columns per page (see below).
6 % Specify how many you want here. Nothing else needs to be changed.
7
8 \columnsperpage=2
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 of Viper:
46 % Michael Kifer
47 % Internet: kifer@cs.sunysb.edu
48 %
49 % Author of VIP 4.3:
50 % Aamod Sane
51 % Internet: sane@cs.uiuc.edu
52 %
53 % Author of VIP 3.5:
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@erl.mit.edu
62
63
64 \def\versionnumber{2.70}
65 \def\year{1995}
66 \def\version{February \year\ 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{by Michael Kifer, Viper \version}
77 \centerline{by Aamod Sane, VIP version 4.3}
78 \centerline{by Masahiko Sato, VIP version 3.5}
79
80 Permission is granted to make and distribute copies of
81 this card provided the copyright notice and this permission notice
82 are preserved on all copies.
83
84 For copies of the GNU Emacs manual, write to the Free Software
85 Foundation, Inc., 1000 Massachusetts Ave, Cambridge MA 02138.
86
87 \endgroup}
88
89 % make \bye not \outer so that the \def\bye in the \else clause below
90 % can be scanned without complaint.
91 \def\bye{\par\vfill\supereject\end}
92
93 \newdimen\intercolumnskip
94 \newbox\columna
95 \newbox\columnb
96
97 \def\ncolumns{\the\columnsperpage}
98
99 \message{[\ncolumns\space
100 column\if 1\ncolumns\else s\fi\space per page]}
101
102 \def\scaledmag#1{ scaled \magstep #1}
103
104 % This multi-way format was designed by Stephen Gildea
105 % October 1986.
106 % Slightly modified by Masahiko Sato, September 1987.
107 \if 1\ncolumns
108 \hsize 4in
109 \vsize 10in
110 %\voffset -.7in
111 \voffset -.57in
112 \font\titlefont=\fontname\tenbf \scaledmag3
113 \font\headingfont=\fontname\tenbf \scaledmag2
114 \font\miniheadingfont=\fontname\tenbf \scaledmag1 % masahiko
115 \font\smallfont=\fontname\sevenrm
116 \font\smallsy=\fontname\sevensy
117
118 \footline{\hss\folio}
119 \def\makefootline{\baselineskip10pt\hsize6.5in\line{\the\footline}}
120 \else
121 %\hsize 3.2in
122 %\vsize 7.95in
123 \hsize 3.41in % masahiko
124 \vsize 8in % masahiko
125 \hoffset -.75in
126 \voffset -.745in
127 \font\titlefont=cmbx10 \scaledmag2
128 \font\headingfont=cmbx10 \scaledmag1
129 \font\miniheadingfont=cmbx10 % masahiko
130 \font\smallfont=cmr6
131 \font\smallsy=cmsy6
132 \font\eightrm=cmr8
133 \font\eightbf=cmbx8
134 \font\eightit=cmti8
135 \font\eightsl=cmsl8
136 \font\eighttt=cmtt8
137 \font\eightsy=cmsy8
138 \textfont0=\eightrm
139 \textfont2=\eightsy
140 \def\rm{\eightrm}
141 \def\bf{\eightbf}
142 \def\it{\eightit}
143 \def\sl{\eightsl} % masahiko
144 \def\tt{\eighttt}
145 \normalbaselineskip=.8\normalbaselineskip
146 \normallineskip=.8\normallineskip
147 \normallineskiplimit=.8\normallineskiplimit
148 \normalbaselines\rm %make definitions take effect
149
150 \if 2\ncolumns
151 \let\maxcolumn=b
152 \footline{\hss\rm\folio\hss}
153 \def\makefootline{\vskip 2in \hsize=6.86in\line{\the\footline}}
154 \else \if 3\ncolumns
155 \let\maxcolumn=c
156 \nopagenumbers
157 \else
158 \errhelp{You must set \columnsperpage equal to 1, 2, or 3.}
159 \errmessage{Illegal number of columns per page}
160 \fi\fi
161
162 %\intercolumnskip=.46in
163 \intercolumnskip=.19in % masahiko .19x4 + 3.41x3 = 10.99
164 \def\abc{a}
165 \output={%
166 % This next line is useful when designing the layout.
167 %\immediate\write16{Column \folio\abc\space starts with \firstmark}
168 \if \maxcolumn\abc \multicolumnformat \global\def\abc{a}
169 \else\if a\abc
170 \global\setbox\columna\columnbox \global\def\abc{b}
171 %% in case we never use \columnb (two-column mode)
172 \global\setbox\columnb\hbox to -\intercolumnskip{}
173 \else
174 \global\setbox\columnb\columnbox \global\def\abc{c}\fi\fi}
175 \def\multicolumnformat{\shipout\vbox{\makeheadline
176 \hbox{\box\columna\hskip\intercolumnskip
177 \box\columnb\hskip\intercolumnskip\columnbox}
178 \makefootline}\advancepageno}
179 \def\columnbox{\leftline{\pagebody}}
180
181 \def\bye{\par\vfill\supereject
182 \if a\abc \else\null\vfill\eject\fi
183 \if a\abc \else\null\vfill\eject\fi
184 \end}
185 \fi
186
187 % we won't be using math mode much, so redefine some of the characters
188 % we might want to talk about
189 \catcode`\^=12
190 \catcode`\_=12
191
192 \chardef\\=`\\
193 \chardef\{=`\{
194 \chardef\}=`\}
195
196 \hyphenation{mini-buf-fer}
197
198 \parindent 0pt
199 \parskip 1ex plus .5ex minus .5ex
200
201 \def\small{\smallfont\textfont2=\smallsy\baselineskip=.8\baselineskip}
202
203 \outer\def\newcolumn{\vfill\eject}
204
205 \outer\def\title#1{{\titlefont\centerline{#1}}\vskip 1ex plus .5ex}
206
207 \outer\def\section#1{\par\filbreak
208 \vskip 3ex plus 2ex minus 2ex {\headingfont #1}\mark{#1}%
209 \vskip 2ex plus 1ex minus 1.5ex}
210
211 % masahiko
212 \outer\def\subsection#1{\par\filbreak
213 \vskip 2ex plus 2ex minus 2ex {\miniheadingfont #1}\mark{#1}%
214 \vskip 1ex plus 1ex minus 1.5ex}
215
216 \newdimen\keyindent
217
218 \def\beginindentedkeys{\keyindent=1em}
219 \def\endindentedkeys{\keyindent=0em}
220 \endindentedkeys
221
222 \def\paralign{\vskip\parskip\halign}
223
224 \def\<#1>{$\langle${\rm #1}$\rangle$}
225
226 \def\kbd#1{{\tt#1}\null} %\null so not an abbrev even if period follows
227
228 \def\beginexample{\par\leavevmode\begingroup
229 \obeylines\obeyspaces\parskip0pt\tt}
230 {\obeyspaces\global\let =\ }
231 \def\endexample{\endgroup}
232
233 \def\key#1#2{\leavevmode\hbox to \hsize{\vtop
234 {\hsize=.75\hsize\rightskip=1em
235 \hskip\keyindent\relax#1}\kbd{#2}\hfil}}
236
237 \newbox\metaxbox
238 \setbox\metaxbox\hbox{\kbd{M-x }}
239 \newdimen\metaxwidth
240 \metaxwidth=\wd\metaxbox
241
242 \def\metax#1#2{\leavevmode\hbox to \hsize{\hbox to .75\hsize
243 {\hskip\keyindent\relax#1\hfil}%
244 \hskip -\metaxwidth minus 1fil
245 \kbd{#2}\hfil}}
246
247 \def\fivecol#1#2#3#4#5{\hskip\keyindent\relax#1\hfil&\kbd{#2}\quad
248 &\kbd{#3}\quad&\kbd{#4}\quad&\kbd{#5}\cr}
249
250 \def\fourcol#1#2#3#4{\hskip\keyindent\relax#1\hfil&\kbd{#2}\quad
251 &\kbd{#3}\quad&\kbd{#4}\quad\cr}
252
253 \def\threecol#1#2#3{\hskip\keyindent\relax#1\hfil&\kbd{#2}\quad
254 &\kbd{#3}\quad\cr}
255
256 \def\twocol#1#2{\hskip\keyindent\relax\kbd{#1}\hfil&\kbd{#2}\quad\cr}
257
258 \def\twocolkey#1#2#3#4{\hskip\keyindent\relax#1\hfil&\kbd{#2}\quad&\relax#3\hfil&\kbd{#4}\quad\cr}
259
260 %**end of header
261
262 \beginindentedkeys
263
264 \title{ViperCard --- The Viper Quick Reference Card}
265
266 \centerline{(for version 2.70 under GNU Emacs 19 and XEmacs 19)}
267
268 %\copyrightnotice
269
270 \section{Loading Viper}
271
272 Just type \kbd{M-x viper-mode} followed by \kbd{RET}
273
274 \section{Viper States}
275
276 Viper has four states: {\it emacs state}, {\it vi state}, {\it insert state},
277 {\it replace state}.
278 Mode line tells you which state you are in.
279 In emacs state you can do all the normal GNU Emacs editing.
280 This card explains only vi state and insert state (replace state is similar
281 to insert state).
282 {\bf GNU Emacs Reference Card} explains emacs state.
283 You can switch states as follows.
284
285 \key{from emacs state to vi state}{C-z}
286 \key{from vi state to emacs state}{C-z}
287 \metax{from vi state to insert state}{i, I, a, A, o, O}
288 \metax{from vi state to replace state}{c, C, R}
289 \metax{from replace state to insert state}{Cross \$ sign}
290 \key{from insert or replace state to vi state}{ESC}
291
292 If you wish to be in vi state when Emacs starts up and thereafter,
293 include the line:
294
295 \hskip 5ex
296 \kbd{(setq vip-always t)}
297
298 in your \kbd{\~{}/.vip} file.
299
300 \section{Insert Mode}
301 You can do editing in insert state.
302
303 \metax{go back to vi state}{ESC}
304 \metax{delete previous character}{C-h, DEL}
305 \key{delete previous word}{C-w}
306 \key{delete line word}{C-u}
307 \key{indent shiftwidth forward}{C-t}
308 \key{indent shiftwidth backward}{C-d}
309 \key{delete line word}{C-u}
310 \key{Quote following character}{C-v}
311 \key{emulate Meta key in emacs state}{C-z}
312
313 \vskip 2mm
314
315 {\bf The rest of this card explains commands in {\bf vi state}.}
316
317 \section{Getting Information on Viper}
318
319 Execute info command by typing \kbd{M-x info} and select menu item
320 \kbd{viper}. Also:
321
322 \key{describe function attached to the key {\it x}}{C-h k {\it x}}
323 \key{if you've enabled help; or if you didn't}{$\backslash$ C-h k {\it x}}
324
325 \section{Leaving Emacs}
326
327 \metax{suspend Emacs}{:st {\rm or} :su}
328 \metax{exit Emacs permanently}{C-xC-c}
329 \metax{exit current file}{:wq {\rm or} :q}
330
331 \shortcopyrightnotice
332
333 \section{Error Recovery}
334
335 \metax{abort command}{C-c (user level = 1)}
336 \metax{abort command}{C-g (user level > 1)}
337 \key{redraw messed up screen}{C-l}
338 \metax{{\bf recover} after system crash}{:rec file}
339 \metax{restore a buffer }{:e!\ {\rm or} M-x revert-buffer}
340
341
342 \section{Counts}
343
344 Most commands in vi state accept a {\it count} which can be supplied as a
345 prefix to the commands. In most cases, if a count is given, the
346 command is executed that many times. E.g., \kbd{5 d d} deletes 5
347 lines.
348
349 \section{Registers}
350
351 There are 26 registers (\kbd{a} to \kbd{z}) that can store texts
352 and marks.
353 You can append a text at the end of a register (say \kbd{x}) by
354 specifying the register name in capital letter (say \kbd{X}).
355 There are also 9 read only registers (\kbd{1} to \kbd{9}) that store
356 up to 9 previous changes.
357 We will use {\it x\/} to denote a register.
358 \section{Entering Insert Mode}
359
360 \key{{\bf insert} at point}{i}
361 \key{{\bf append} after cursor}{a}
362 \key{{\bf insert} before first non-white}{I}
363 \key{{\bf append} at end of line}{A}
364 \key{{\bf open} line below}{o}
365 \key{{\bf open} line above}{O}
366
367 \section{Buffers and Windows}
368
369 \key{move cursor to {\bf next} window}{C-x o}
370 \key{delete current window}{C-x 0}
371 \key{delete other windows}{C-x 1}
372 \key{split current window into two windows}{C-x 2}
373 \key{{\bf switch} to a buffer in the current window}{C-x {\sl buffer}}
374 \metax{{\bf switch} to a buffer in another window}{:n, :b, {\rm or} C-x 4 {\sl buf}}
375 \key{{\bf kill} a buffer}{:q! {\rm or} C-x k}
376 \key{list exisiting {\bf buffers}}{:args {\rm or} C-x b}
377
378 \section{Files}
379
380 \metax{{\bf visit} file in the current window}{v {\sl file} {\rm or} :e {\sl file}}
381 \key{{\bf visit} file in another window}{V {\sl file}}
382 \key{{\bf visit} file in another frame}{C-v {\sl file}}
383 \key{{\bf save} buffer to the associated file}{:w {\rm or} C-xC-s}
384 \metax{{\bf write} buffer to a specified file}{:w {\sl file} {\rm or} C-xC-w}
385 \metax{{\bf insert} a specified file at point}{:r {\sl file} {\rm or} C-xi}
386 \key{{\bf get} information on the current {\bf file}}{C-c g {\rm or} :f}
387 \key{run the {\bf directory} editor}{:e RET {\rm or} C-xd}
388
389 %\shortcopyrightnotice
390
391 \section{Viewing the Buffer}
392
393 \key{scroll to next screen}{C-f}
394 \key{scroll to previous screen}{C-b}
395 \key{scroll {\bf down} half screen}{C-d}
396 \key{scroll {\bf up} half screen}{C-u}
397 \key{scroll down one line}{C-e}
398 \key{scroll up one line}{C-y}
399
400 \key{put current line on the {\bf home} line}{z H {\rm or} z RET}
401 \key{put current line on the {\bf middle} line}{z M {\rm or} z .}
402 \key{put current line on the {\bf last} line}{z L {\rm or} z -}
403
404 \section{Marking and Returning}
405
406 \key{{\bf mark} point in register {\it x}}{m {\it x}}
407 \key{set mark at buffer beginning}{m <}
408 \key{set mark at buffer end}{m >}
409 \key{set mark at point}{m .}
410 \key{jump to mark}{m ,}
411 \key{exchange point and mark}{` `}
412 \key{... and skip to first non-white on line}{' '}
413 \key{go to mark {\it x}}{` {\it x}}
414 \key{... and skip to first non-white on line}{' {\it x}}
415 \key{view contents of marker {\it x}}{[ {\it x}}
416 \key{view contents of register {\it x}}{] {\it x}}
417
418 \section{Macros}
419
420 \key{start remembering keyboard macro}{@ \#}
421 \key{finish macro and put into register {\it x}}{@ {\it x}}
422 \key{execute macro stored in register {\it x}}{@ {\it x}}
423 \key{repeat last @{\it x} command}{@ @}
424
425 Emacs style macros:
426
427 \key{start remembering keyboard macro}{C-x (}
428 \key{finish remembering keyboard macro}{C-x )}
429 \key{call last keyboard macro}{*}
430
431 Combining:
432
433 \key{Pull last macro into register {\it x}}{@ ! {\it x}}
434
435 \section{Motion Commands}
436
437 \key{go backward one character}{h {\rm or} C-h}
438 \key{go forward one character}{l}
439 \metax{next line keeping the column}{j {\rm or} LF {\rm or} C-n}
440 \key{previous line keeping the column}{k}
441 \metax{next line at first non-white}{+ {\rm or} RET {\rm or} C-p}
442 \key{previous line at first non-white}{-}
443
444 \key{beginning of line}{0}
445 \key{first non-white on line}{^}
446 \key{end of line}{\$}
447 \key{go to {\it n}-th column on line}{{\it n} |}
448
449 \key{go to {\it n}-th line}{{\it n} G}
450 \key{go to last line}{G}
451 \key{find matching parenthesis for \kbd{()}, \kbd{\{\}} and \kbd{[]}}{\%}
452
453 \key{go to {\bf home} window line}{H}
454 \key{go to {\bf middle} window line}{M}
455 \key{go to {\bf last} window line}{L}
456
457 \subsection{Words, Sentences, Paragraphs, Headings}
458
459 \key{forward {\bf word}}{w {\rm or} W}
460 \key{{\bf backward} word}{b {\rm or} B}
461 \key{{\bf end} of word}{e {\rm or} E}
462
463 In the case of capital letter commands, a word is delimited by a
464 non-white character.
465
466 \key{forward sentence}{)}
467 \key{backward sentence}{(}
468
469 \key{forward paragraph}{\}}
470 \key{backward paragraph}{\{}
471
472 \key{forward heading}{]]}
473 \key{backward heading}{[[}
474 \key{end of heading}{[]}
475
476 \subsection{Find Characters on the Line}
477
478 \key{{\bf find} {\it c} forward on line}{f {\it c}}
479 \key{{\bf find} {\it c} backward on line}{F {\it c}}
480 \key{up {\bf to} {\it c} forward on line}{t {\it c}}
481 \key{up {\bf to} {\it c} backward on line}{T {\it c}}
482 \key{repeat previous \kbd{f}, \kbd{F}, \kbd{t} or \kbd{T}}{;}
483 \key{... in the opposite direction}{,}
484
485 %\newcolumn
486 %\title{Viper Quick Reference Card}
487
488 \section{Searching and Replacing}
489
490 \key{search forward for {\sl pat}}{/ {\sl pat}}
491 \key{search backward with previous {\sl pat}}{?\ RET}
492 \key{search forward with previous {\sl pat}}{/ RET}
493 \key{search backward for {\sl pat}}{?\ {\sl pat}}
494 \key{repeat previous search}{n}
495 \key{... in the opposite direction}{N}
496
497 \key{{\bf query} replace}{Q}
498 \key{{\bf replace} a character by another character {\it c}}{r {\it c}}
499 \key{{\bf overwrite} {\it n} lines}{{\it n} R}
500
501 \metax{{\bf buffer} search (if enabled)}{g {\it move command}}
502
503 \section{Modifying Commands}
504
505 Most commands that operate on text regions accept the motion commands,
506 to describe regions. They also accept the Emacs region specifications
507 {\bf r} and {\bf R}. {\bf r} describes the region between {\it point}
508 and {\it mark}, and {\bf R} describes whole lines in that region.
509 Motion commands are classified into {\it point commands} and
510 {\it line commands}. In the case of line commands, whole lines will
511 be affected by the command.
512
513 The point commands are as follows:
514
515 \hskip 5ex
516 \kbd{h l 0 ^ \$ w W b B e E ( ) / ?\ ` f F t T \% ; ,}
517
518 The line commands are as follows:
519
520 \hskip 5ex
521 \kbd{j k + - H M L \{ \} G '}
522
523 These region specifiers will be referred to as {\it m} below.
524
525 \subsection{Delete/Yank/Change Commands}
526
527 \paralign to \hsize{#\tabskip=10pt plus 1 fil&#\tabskip=0pt&#\tabskip=0pt&#\cr
528 \fourcol{}{{\bf delete}}{{\bf yank}}{{\bf change}}
529 \fourcol{region determined by {\it m}}{d {\it m}}{y {\it m}}{c {\it m}}
530 \fourcol{... into register {\it x}}{" {\it x\/} d {\it m}}{" {\it x\/} y {\it m}}{" {\it x\/} c {\it m}}
531 \fourcol{a line}{d d}{Y {\rm or} y y}{c c}
532 \fourcol{current {\bf region}}{d r}{y r}{c r}
533 \fourcol{expanded {\bf region}}{d R}{y R}{c R}
534 \fourcol{to end of line}{D}{y \$}{c \$}
535 \fourcol{a character after point}{x}{y l}{c l}
536 \fourcol{a character before point}{DEL}{y h}{c h}
537 }
538
539 \vskip 2ex
540 \key{Overwrite {\it n} lines}{{\it n} R}
541
542 \subsection{Put Back Commands}
543
544 Deleted/yanked/changed text can be put back by the following commands.
545
546 \key{{\bf Put} back at point/above line}{P}
547 \key{... from register {\it x}}{" {\it x\/} P}
548 \key{{\bf put} back after point/below line}{p}
549 \key{... from register {\it x}}{" {\it x\/} p}
550
551 \subsection{Repeating and Undoing Modifications}
552
553 \key{{\bf undo} last change}{u {\rm or} :und}
554 \key{repeat last change}{.\ {\rm (dot)}}
555
556 Undo is undoable by \kbd{u} and repeatable by \kbd{.}.
557 For example, \kbd{u...} will undo 4 previous changes.
558 A \kbd{.} after \kbd{5dd} is equivalent to \kbd{5dd},
559 while \kbd{3.} after \kbd{5dd} is equivalent to \kbd{3dd}.
560
561 \section{Miscellaneous Commands}
562
563 \endindentedkeys
564
565 \paralign to \hsize{#\tabskip=5pt plus 1 fil&#\tabskip=0pt&#\tabskip=0pt&#\tabskip=0pt&#\cr
566 \fivecol{}{{\bf shift left}}{{\bf shift right}}{{\bf filter shell command}}{{\bf indent}}
567 \fivecol{region}{< {\it m}}{> {\it m}}{!\ {\it m\/} {\sl shell-com}}{= {\it m}}
568 \fivecol{line}{< <}{> >}{!\ !\ {\sl shell-com}}{= =}
569 }
570
571 \key{{\bf join} lines}{J}
572 \key{toggle case (takes count)}{\~{}}
573
574 \key{view register {\it x}}{] {\it x}}
575 \key{view marker {\it x}}{] {\it x}}
576
577 \key{lowercase region}{\# c {\it m}}
578 \key{uppercase region}{\# C {\it m}}
579 \key{execute last keyboard macro on each line in the region}{\# g {\it m}}
580
581 \key{insert specified string for each line in the region}{\# q {\it m}}
582 \key{check spelling of the words in the region}{\# s {\it m}}
583
584 \key{repeat previous ex substitution}{\&}
585 \key{change to previous file}{C-^}
586
587 \key{Viper Meta key}{_}
588
589 \section{Customization}
590
591 By default, search is case sensitive.
592 You can change this by including the following line in your \kbd{\~{}/.vip} file.
593
594 \hskip 5ex
595 \kbd{(setq vip-case-fold-search t)}
596
597 The following is a subset of the variety of
598 options available for customizing Viper.
599 See the Viper manual for details on these and other options.
600
601 \beginindentedkeys
602
603 \paralign to \hsize{#\tabskip=10pt plus 1 fil&#\tabskip=0pt&#\cr
604 \twocol{{\bf variable}}{{\bf default value}}
605 \twocol{vip-search-wrap-around}{t}
606 \twocol{vip-case-fold-search}{nil}
607 \twocol{vip-re-search}{t}
608 \twocol{vip-re-replace}{t}
609 \twocol{vip-re-query-replace}{t}
610 \twocol{vip-auto-indent}{nil}
611 \twocol{vip-shift-width}{8}
612 \twocol{vip-tags-file-name}{"TAGS"}
613 \twocol{vip-no-multiple-ESC}{t}
614 \twocol{vip-ex-style-motion}{t}
615 \twocol{vip-always}{t}
616 \twocol{vip-custom-file-name}{"\~{}/.vip"}
617 \twocol{ex-find-file-shell}{"csh"}
618 \twocol{ex-cycle-other-window}{t}
619 \twocol{ex-cycle-through-non-buffers}{t}
620 \twocol{blink-matching-paren}{t}
621 \twocol{buffer-read-only}{{\it buffer dependent}}
622 }
623
624 To bind keys in Vi command state, put lines like these in your
625 \kbd{\~{}/.vip} file:
626
627 \beginexample
628 (define-key vip-vi-global-user-map "\\C-v" 'scroll-down)
629 (define-key vip-vi-global-user-map "\\C-cm" 'smail)
630 \endexample
631
632
633 \newcolumn
634
635 \title{Ex Commands in Viper}
636
637 In vi state, an Ex command is entered by typing:
638
639 \hskip 5ex
640 \kbd{:\ {\sl ex-command} RET}
641
642 \section{Ex Addresses}
643
644 \paralign to \hsize{#\tabskip=5pt plus 1 fil&#\tabskip=2pt&#\tabskip=5pt plus 1 fil&#\cr
645 \twocolkey{current line}{.}{next line with {\sl pat}}{/ {\sl pat} /}
646 \twocolkey{line {\it n}}{{\it n}}{previous line with {\sl pat}}{?\ {\sl pat} ?}
647 \twocolkey{last line}{\$}{{\it n\/} line before {\it a}}{{\it a} - {\it n}}
648 \twocolkey{next line}{+}{{\it a\/} through {\it b}}{{\it a\/} , {\it b}}
649 \twocolkey{previous line}{-}{line marked with {\it x}}{' {\it x}}
650 \twocolkey{entire buffer}{\%}{previous context}{' '}
651 }
652
653 Addresses can be specified in front of a command.
654 For example,
655
656 \hskip 5ex
657 \kbd{:.,.+10m\$}
658
659 moves 11 lines below current line to the end of buffer.
660
661 \section{Ex Commands}
662
663 Avoid Ex text manipulation commands except substitute.
664 There are better VI equivalents
665 for all of them. Also note that all Ex commands expand \% to
666 current file name. To include a \% in the command, escape it with a $\backslash$.
667 Similiarly, \# is replaced by previous file. For Viper, this is the
668 first file in the {\sl :args} listing for that buffer. This defaults
669 to the previous file in the VI sense if you have one window.
670 Ex commands can be made to have history. See the manual for details.
671
672 \subsection{Ex Text Commands}
673
674 \endindentedkeys
675
676 \key{mark lines matching {\sl pat} and execute {\sl cmds} on these lines}{:g /{\sl pat}/ {\sl cmds}}
677
678 \key{mark lines {\it not\/} matching {\sl pat} and execute {\sl cmds} on these lines}{:v /{\sl pat}/ {\sl cmds}}
679
680
681 \key{{\bf move} specified lines after {\sl addr}}{:m {\sl addr}}
682 \key{{\bf copy} specified lines after {\sl addr}}{:co\rm\ (or \kbd{:t})\ \sl addr}
683 \key{{\bf delete} specified lines [into register {\it x\/}]}{:d {\rm [{\it x\/}]}}
684 \key{{\bf yank} specified lines [into register {\it x\/}]}{:y {\rm [{\it x\/}]}}
685 \key{{\bf put} back text [from register {\it x\/}]}{:pu {\rm [{\it x\/}]}}
686
687 \key{{\bf substitute} {\sl repl} for first string on line matching {\sl pat}}{:s /{\sl pat}/{\sl repl}/}
688
689 \key{repeat last substitution}{:\&}
690 \key{repeat previous substitute with previous search pattern as {\sl pat}}{:\~{}}
691
692 \subsection{Ex File and Shell Commands}
693
694 \key{{\bf edit} file}{:e {\sl file}}
695 \key{reedit messed up current file}{:e!}
696 \key{edit previous file}{:e\#}
697 \key{{\bf read} in a file}{:r {\sl file}}
698 \key{{\bf read} in the output of a shell command}{:r {\sl !command}}
699 \key{write out specified lines into {\sl file}}{:w {\sl file}}
700 \key{save all modified buffers, ask confirmation}{:W {\sl file}}
701 \key{save all modified buffers, no confirmation}{:WW {\sl file}}
702 \key{write out specified lines at the end of {\sl file}}{:w>> {\sl file}}
703 \key{{\bf write} to the input of a shell command}{:w {\sl !command}}
704 \key{write out and then quit}{:wq {\sl file}}
705
706 \key{run a sub{\bf shell} in a window}{:sh}
707 \key{execute shell command {\sl command}}{:!\ {\sl command}}
708 \key{execute previous shell command with {\it args} appended}{:!! {\sl args}}
709
710 \subsection{Ex Miscellaneous Commands}
711
712 \key{define a macro {\it x} that expands to {\sl cmd}}{:map {\it x} {\sl cmd}}
713 \key{remove macro expansion associated with {\it x}}{:unma {\it x}}
714 \key{define a macro {\it x} that expands to {\sl cmd} in insert state}{:map!\ {\it x} {\sl cmd}}
715 \key{remove macro expansion associated with {\it x} in insert state}{:unma!\ {\it x}}
716
717 \key{print line number}{:.=}
718 \key{print last line number}{:=}
719 \key{print {\bf version} number of Viper}{:ve}
720
721 \key{shift specified lines to the right}{:>}
722 \key{shift specified lines to the left}{:<}
723
724 \key{{\bf join} lines}{:j}
725 \key{mark specified line to register {\it x}}{:k {\it x}}
726 \key{{\bf set} a variable's value}{:se}
727 \key{find first definition of {\bf tag} {\sl tag}}{:ta {\sl tag}}
728
729 \key{Current directory}{:pwd}
730
731
732 \copyrightnotice
733
734 \bye
735
736 % Local variables:
737 % compile-command: "tex viperCard"
738 % End: