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