Tweak recent flymake change
[emacs.git] / etc / refcards / viperCard.tex
blobd984ffc484fe71385f007d78ec72d5f5a4a92d5f
1 % ViperCard -- The Reference Card for Viper under GNU Emacs and XEmacs
3 % Copyright (C) 1995-1997, 2001-2016 Free Software Foundation, Inc.
5 % Author: Michael Kifer <kifer@cs.sunysb.edu> (Viper)
6 % Aamod Sane <sane@cs.uiuc.edu> (VIP 4.3)
7 % Masahiko Sato <ms@sail.stanford.edu> (VIP 3.5)
9 % This document is free software: you can redistribute it and/or modify
10 % it under the terms of the GNU General Public License as published by
11 % the Free Software Foundation, either version 3 of the License, or
12 % (at your option) any later version.
14 % As a special additional permission, you may distribute reference cards
15 % printed, or formatted for printing, with the notice "Released under
16 % the terms of the GNU General Public License version 3 or later"
17 % instead of the usual distributed-under-the-GNU-GPL notice, and without
18 % a copy of the GPL itself.
20 % This document is distributed in the hope that it will be useful,
21 % but WITHOUT ANY WARRANTY; without even the implied warranty of
22 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 % GNU General Public License for more details.
25 % You should have received a copy of the GNU General Public License
26 % along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
29 % This file is intended to be processed by plain TeX (TeX82).
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.
46 %**start of header
49 % This file can be printed with 1 or 2 columns per page.
50 % Specify how many you want here.
51 \newcount\columnsperpage
52 \columnsperpage=2
54 % PDF output layout. 0 for A4, 1 for letter (US), a `l' is added for
55 % a landscape layout.
56 \input pdflayout.sty
57 \pdflayout=(1)
59 \input emacsver.tex
60 \def\versionemacs{21} % version of Emacs this is for
61 \def\versionxemacs{20} % version of XEmacs this is for
62 \def\versionviper{3.0} % version of Viper this is for
64 % Nothing else needs to be changed.
66 \def\shortcopyrightnotice{\vskip 1ex plus 2 fill
67 \centerline{\small \copyright\ \year\ Free Software Foundation, Inc.
68 Permissions on back.}}
70 \def\copyrightnotice{
71 %\vskip 1ex plus 2 fill\begingroup\small
72 \vskip 1ex \begingroup\small
73 \centerline{Copyright \copyright\ \year\ Free Software Foundation, Inc.}
74 \centerline{by Michael Kifer, Viper \versionviper}
75 \centerline{by Aamod Sane, VIP version 4.3}
76 \centerline{by Masahiko Sato, VIP version 3.5}
78 Released under the terms of the GNU General Public License version 3 or later.
80 \TeX{} source for this card is distributed with Emacs in {\tt etc/refcards/}
82 For copies of the GNU Emacs manual, see:
84 {\tt http://www.gnu.org/software/emacs/\#Manuals}
85 \endgroup}
87 % make \bye not \outer so that the \def\bye in the \else clause below
88 % can be scanned without complaint.
89 \def\bye{\par\vfill\supereject\end}
91 \newdimen\intercolumnskip
92 \newbox\columna
93 \newbox\columnb
95 \def\ncolumns{\the\columnsperpage}
97 \message{[\ncolumns\space
98 column\if 1\ncolumns\else s\fi\space per page]}
100 \def\scaledmag#1{ scaled \magstep #1}
102 % This multi-way format was designed by Stephen Gildea
103 % October 1986.
104 % Slightly modified by Masahiko Sato, September 1987.
105 \if 1\ncolumns
106 \hsize 4in
107 \vsize 10in
108 %\voffset -.7in
109 \voffset -.57in
110 \font\titlefont=\fontname\tenbf \scaledmag3
111 \font\headingfont=\fontname\tenbf \scaledmag2
112 \font\miniheadingfont=\fontname\tenbf \scaledmag1 % masahiko
113 \font\smallfont=\fontname\sevenrm
114 \font\smallsy=\fontname\sevensy
116 \footline{\hss\folio}
117 \def\makefootline{\baselineskip10pt\hsize6.5in\line{\the\footline}}
118 \else
119 %\hsize 3.2in
120 %\vsize 7.95in
121 \hsize 3.41in % masahiko
122 \vsize 8in % masahiko
123 \hoffset -.75in
124 \voffset -.745in
125 \font\titlefont=cmbx10 \scaledmag2
126 \font\headingfont=cmbx10 \scaledmag1
127 \font\miniheadingfont=cmbx10 % masahiko
128 \font\smallfont=cmr6
129 \font\smallsy=cmsy6
130 \font\eightrm=cmr8
131 \font\eightbf=cmbx8
132 \font\eightit=cmti8
133 \font\eightsl=cmsl8
134 \font\eighttt=cmtt8
135 \font\eightsy=cmsy8
136 \textfont0=\eightrm
137 \textfont2=\eightsy
138 \def\rm{\eightrm}
139 \def\bf{\eightbf}
140 \def\it{\eightit}
141 \def\sl{\eightsl} % masahiko
142 \def\tt{\eighttt}
143 \normalbaselineskip=.8\normalbaselineskip
144 \normallineskip=.8\normallineskip
145 \normallineskiplimit=.8\normallineskiplimit
146 \normalbaselines\rm %make definitions take effect
148 \if 2\ncolumns
149 \let\maxcolumn=b
150 \footline{\hss\rm\folio\hss}
151 \def\makefootline{\vskip 2in \hsize=6.86in\line{\the\footline}}
152 \else \if 3\ncolumns
153 \let\maxcolumn=c
154 \nopagenumbers
155 \else
156 \errhelp{You must set \columnsperpage equal to 1, 2, or 3.}
157 \errmessage{Illegal number of columns per page}
158 \fi\fi
160 %\intercolumnskip=.46in
161 \intercolumnskip=.19in % masahiko .19x4 + 3.41x3 = 10.99
162 \def\abc{a}
163 \output={%
164 % This next line is useful when designing the layout.
165 %\immediate\write16{Column \folio\abc\space starts with \firstmark}
166 \if \maxcolumn\abc \multicolumnformat \global\def\abc{a}
167 \else\if a\abc
168 \global\setbox\columna\columnbox \global\def\abc{b}
169 %% in case we never use \columnb (two-column mode)
170 \global\setbox\columnb\hbox to -\intercolumnskip{}
171 \else
172 \global\setbox\columnb\columnbox \global\def\abc{c}\fi\fi}
173 \def\multicolumnformat{\shipout\vbox{\makeheadline
174 \hbox{\box\columna\hskip\intercolumnskip
175 \box\columnb\hskip\intercolumnskip\columnbox}
176 \makefootline}\advancepageno}
177 \def\columnbox{\leftline{\pagebody}}
179 \def\bye{\par\vfill\supereject
180 \if a\abc \else\null\vfill\eject\fi
181 \if a\abc \else\null\vfill\eject\fi
182 \end}
185 % we won't be using math mode much, so redefine some of the characters
186 % we might want to talk about
187 \catcode`\^=12
188 \catcode`\_=12
190 \chardef\\=`\\
191 \chardef\{=`\{
192 \chardef\}=`\}
194 \hyphenation{mini-buf-fer}
196 \parindent 0pt
197 \parskip 1ex plus .5ex minus .5ex
199 \def\small{\smallfont\textfont2=\smallsy\baselineskip=.8\baselineskip}
201 \outer\def\newcolumn{\vfill\eject}
203 \outer\def\title#1{{\titlefont\centerline{#1}}\vskip 1ex plus .5ex}
205 \outer\def\section#1{\par\filbreak
206 \vskip 3ex plus 2ex minus 2ex {\headingfont #1}\mark{#1}%
207 \vskip 2ex plus 1ex minus 1.5ex}
209 % masahiko
210 \outer\def\subsection#1{\par\filbreak
211 \vskip 2ex plus 2ex minus 2ex {\miniheadingfont #1}\mark{#1}%
212 \vskip 1ex plus 1ex minus 1.5ex}
214 \newdimen\keyindent
216 \def\beginindentedkeys{\keyindent=1em}
217 \def\endindentedkeys{\keyindent=0em}
218 \endindentedkeys
220 \def\paralign{\vskip\parskip\halign}
222 \def\<#1>{$\langle${\rm #1}$\rangle$}
224 \def\kbd#1{{\tt#1}\null} %\null so not an abbrev even if period follows
226 \def\beginexample{\par\leavevmode\begingroup
227 \obeylines\obeyspaces\parskip0pt\tt}
228 {\obeyspaces\global\let =\ }
229 \def\endexample{\endgroup}
231 \def\key#1#2{\leavevmode\hbox to \hsize{\vtop
232 {\hsize=.75\hsize\rightskip=1em
233 \hskip\keyindent\relax#1}\kbd{#2}\hfil}}
235 \newbox\metaxbox
236 \setbox\metaxbox\hbox{\kbd{M-x }}
237 \newdimen\metaxwidth
238 \metaxwidth=\wd\metaxbox
240 \def\metax#1#2{\leavevmode\hbox to \hsize{\hbox to .75\hsize
241 {\hskip\keyindent\relax#1\hfil}%
242 \hskip -\metaxwidth minus 1fil
243 \kbd{#2}\hfil}}
245 \def\fivecol#1#2#3#4#5{\hskip\keyindent\relax#1\hfil&\kbd{#2}\quad
246 &\kbd{#3}\quad&\kbd{#4}\quad&\kbd{#5}\cr}
248 \def\fourcol#1#2#3#4{\hskip\keyindent\relax#1\hfil&\kbd{#2}\quad
249 &\kbd{#3}\quad&\kbd{#4}\quad\cr}
251 \def\threecol#1#2#3{\hskip\keyindent\relax#1\hfil&\kbd{#2}\quad
252 &\kbd{#3}\quad\cr}
254 \def\twocol#1#2{\hskip\keyindent\relax\kbd{#1}\hfil&\kbd{#2}\quad\cr}
256 \def\twocolkey#1#2#3#4{\hskip\keyindent\relax#1\hfil&\kbd{#2}\quad&\relax#3\hfil&\kbd{#4}\quad\cr}
258 %**end of header
260 \beginindentedkeys
262 \title{ViperCard: Viper Reference Pal}
264 \centerline{(Version \versionviper\ for Emacs \versionemacs\ and XEmacs \versionxemacs)}
266 %\copyrightnotice
268 \section{Loading Viper}
270 Just type \kbd{M-x viper-mode} followed by \kbd{RET}
272 OR put
274 (setq viper-mode t)
275 (require 'viper)
277 in .emacs
279 \section{Viper States}
281 Viper has four states: {\it emacs state}, {\it vi state}, {\it insert state},
282 {\it replace state}.
283 Mode line tells you which state you are in.
284 In emacs state you can do all the normal GNU Emacs editing.
285 This card explains only vi state and insert state (replace state is similar
286 to insert state).
287 {\bf GNU Emacs Reference Card} explains emacs state.
288 You can switch states as follows.
290 \key{from emacs state to vi state}{C-z}
291 \key{from vi state to emacs state}{C-z}
292 \key{from vi state to emacs state for 1 command}{$\backslash$}
293 \metax{from vi state to insert state}{i, I, a, A, o, O}
294 \metax{from vi state to replace state}{c, C, R}
295 \key{from insert or replace state to vi state}{ESC}
296 \key{from insert state to vi state for 1 command}{C-z}
299 \section{Insert Mode}
300 You can do editing in insert state.
302 \metax{go back to vi state}{ESC}
303 \metax{delete previous character}{C-h, DEL}
304 \key{delete previous word}{C-w}
305 \key{delete line word}{C-u}
306 \key{indent shiftwidth forward}{C-t}
307 \key{indent shiftwidth backward}{C-d}
308 \key{delete line word}{C-u}
309 \key{quote following character}{C-v}
310 \key{emulate Meta key in emacs state}{C-$\backslash$}
311 \key{escape to Vi state for one command}{C-z}
313 \vskip 2mm
315 {\bf The rest of this card explains commands in {\bf vi state}.}
317 \section{Getting Information on Viper}
319 Execute info command by typing \kbd{M-x info} and select menu item
320 \kbd{viper}. Also:
322 \key{describe function attached to the key {\it x}}{$\backslash$ C-h k {\it x}}
324 \section{Leaving Emacs}
326 \metax{suspend Emacs}{:st {\rm or} :su}
327 \metax{exit Emacs permanently}{C-xC-c}
328 \metax{exit current file}{:wq {\rm or} :q}
330 \shortcopyrightnotice
332 \section{Error Recovery}
334 \metax{abort command}{C-c (user level = 1)}
335 \metax{abort command}{C-g (user level > 1)}
336 \key{redraw messed up screen}{C-l}
337 \metax{{\bf recover} after system crash}{:rec file}
338 \metax{restore a buffer }{:e!\ {\rm or} M-x revert-buffer}
341 \section{Counts}
343 Most commands in vi state accept a {\it count} which can be supplied as a
344 prefix to the commands. In most cases, if a count is given, the
345 command is executed that many times. E.g., \kbd{5 d d} deletes 5
346 lines.
348 \section{Registers}
350 There are 26 registers (\kbd{a} to \kbd{z}) that can store texts
351 and marks.
352 You can append a text at the end of a register (say \kbd{x}) by
353 specifying the register name in capital letter (say \kbd{X}).
354 There are also 9 read only registers (\kbd{1} to \kbd{9}) that store
355 up to 9 previous changes.
356 We will use {\it x\/} to denote a register.
357 \section{Entering Insert Mode}
359 \key{{\bf insert} at point}{i}
360 \key{{\bf append} after cursor}{a}
361 \key{{\bf insert} before first non-white}{I}
362 \key{{\bf append} at end of line}{A}
363 \key{{\bf open} line below}{o}
364 \key{{\bf open} line above}{O}
366 \section{Buffers and Windows}
368 \key{move cursor to {\bf next} window}{C-x o}
369 \key{delete current window}{C-x 0}
370 \key{delete other windows}{C-x 1}
371 \key{split current window into two windows}{C-x 2}
372 \key{{\bf switch} to a buffer in the current window}{C-x {\sl buffer}}
373 \metax{{\bf switch} to a buffer in another window}{:n, :b, {\rm or} C-x 4 {\sl buf}}
374 \key{{\bf kill} a buffer}{:q! {\rm or} C-x k}
375 \key{list existing {\bf buffers}}{:args {\rm or} C-x b}
377 \section{Files}
379 \metax{{\bf visit} file in the current window}{v {\sl file} {\rm or} :e {\sl file}}
380 \key{{\bf visit} file in another window}{V {\sl file}}
381 \key{{\bf visit} file in another frame}{C-v {\sl file}}
382 \key{{\bf save} buffer to the associated file}{:w {\rm or} C-xC-s}
383 \metax{{\bf write} buffer to a specified file}{:w {\sl file} {\rm or} C-xC-w}
384 \metax{{\bf insert} a specified file at point}{:r {\sl file} {\rm or} C-xi}
385 \key{{\bf get} information on the current {\bf file}}{C-c g {\rm or} :f}
386 \key{run the {\bf directory} editor}{:e RET {\rm or} C-xd}
388 %\shortcopyrightnotice
390 \section{Viewing the Buffer}
392 \key{scroll to next screen}{C-f}
393 \key{scroll to previous screen}{C-b}
394 \key{scroll {\bf down} half screen}{C-d}
395 \key{scroll {\bf up} half screen}{C-u}
396 \key{scroll down one line}{C-e}
397 \key{scroll up one line}{C-y}
399 \key{put current line on the {\bf home} line}{z H {\rm or} z RET}
400 \key{put current line on the {\bf middle} line}{z M {\rm or} z .}
401 \key{put current line on the {\bf last} line}{z L {\rm or} z -}
403 \section{Marking and Returning}
405 \key{{\bf mark} point in register {\it x}}{m {\it x}}
406 \key{set mark at buffer beginning}{m <}
407 \key{set mark at buffer end}{m >}
408 \key{set mark at point}{m .}
409 \key{jump to mark}{m ,}
410 \key{exchange point and mark}{` `}
411 \key{... and skip to first non-white on line}{' '}
412 \key{go to mark {\it x}}{` {\it x}}
413 \key{... and skip to first non-white on line}{' {\it x}}
414 \key{view contents of marker {\it x}}{[ {\it x}}
415 \key{view contents of register {\it x}}{] {\it x}}
417 \section{Macros}
419 Emacs style macros:
421 \key{start remembering keyboard macro}{C-x (}
422 \key{finish remembering keyboard macro}{C-x )}
423 \key{call last keyboard macro}{*}
425 \key{start remembering keyboard macro}{@ \#}
426 \key{finish macro and put into register {\it x}}{@ {\it x}}
427 \key{execute macro stored in register {\it x}}{@ {\it x}}
428 \key{repeat last @{\it x} command}{@ @}
430 \key{Pull last macro into register {\it x}}{@ ! {\it x}}
432 Vi-style macros (keys to be hit in quick succession):
434 \key{define Vi-style macro for Vi state}{:map}
435 \key{define Vi-style macro for Insert state}{:map!}
437 \key{toggle case-sensitive search}{//}
438 \key{toggle regular expression search}{///}
439 \key{toggle `\%' to ignore parentheses inside comments}{\%\%\%}
442 \section{Motion Commands}
444 \key{go backward one character}{h {\rm or} C-h}
445 \key{go forward one character}{l}
446 \metax{next line keeping the column}{j {\rm or} LF {\rm or} C-n}
447 \key{previous line keeping the column}{k}
448 \metax{next line at first non-white}{+ {\rm or} RET {\rm or} C-p}
449 \key{previous line at first non-white}{-}
451 \key{beginning of line}{0}
452 \key{first non-white on line}{^}
453 \key{end of line}{\$}
454 \key{go to {\it n}-th column on line}{{\it n} |}
456 \key{go to {\it n}-th line}{{\it n} G}
457 \key{go to last line}{G}
458 \key{find matching parenthesis for \kbd{()}, \kbd{\{\}} and \kbd{[]}}{\%}
460 \key{go to {\bf home} window line}{H}
461 \key{go to {\bf middle} window line}{M}
462 \key{go to {\bf last} window line}{L}
464 \subsection{Words, Sentences, Paragraphs, Headings}
466 \key{forward {\bf word}}{w {\rm or} W}
467 \key{{\bf backward} word}{b {\rm or} B}
468 \key{{\bf end} of word}{e {\rm or} E}
470 In the case of capital letter commands, a word is delimited by a
471 non-white character.
473 \key{forward sentence}{)}
474 \key{backward sentence}{(}
476 \key{forward paragraph}{\}}
477 \key{backward paragraph}{\{}
479 \key{forward heading}{]]}
480 \key{backward heading}{[[}
481 \key{end of heading}{[]}
483 \subsection{Find Characters on the Line}
485 \key{{\bf find} {\it c} forward on line}{f {\it c}}
486 \key{{\bf find} {\it c} backward on line}{F {\it c}}
487 \key{up {\bf to} {\it c} forward on line}{t {\it c}}
488 \key{up {\bf to} {\it c} backward on line}{T {\it c}}
489 \key{repeat previous \kbd{f}, \kbd{F}, \kbd{t} or \kbd{T}}{;}
490 \key{... in the opposite direction}{,}
492 %\newcolumn
493 %\title{Viper Quick Reference Card}
495 \section{Searching and Replacing}
497 \key{search forward for {\sl pat}}{/ {\sl pat}}
498 \key{search backward with previous {\sl pat}}{?\ RET}
499 \key{search forward with previous {\sl pat}}{/ RET}
500 \key{search backward for {\sl pat}}{?\ {\sl pat}}
501 \key{repeat previous search}{n}
502 \key{... in the opposite direction}{N}
504 \key{{\bf query} replace}{Q}
505 \key{{\bf replace} a character by another character {\it c}}{r {\it c}}
506 \key{{\bf overwrite} {\it n} lines}{{\it n} R}
508 \metax{{\bf buffer} search (if enabled)}{g {\it move command}}
510 \section{Modifying Commands}
512 Most commands that operate on text regions accept the motion commands,
513 to describe regions. They also accept the Emacs region specifications
514 {\bf r} and {\bf R}. {\bf r} describes the region between {\it point}
515 and {\it mark}, and {\bf R} describes whole lines in that region.
516 Motion commands are classified into {\it point commands} and
517 {\it line commands}. In the case of line commands, whole lines will
518 be affected by the command.
520 The point commands are as follows:
522 \hskip 5ex
523 \kbd{h l 0 ^ \$ w W b B e E ( ) / ?\ ` f F t T \% ; ,}
525 The line commands are as follows:
527 \hskip 5ex
528 \kbd{j k + - H M L \{ \} G '}
530 These region specifiers will be referred to as {\it m} below.
532 \subsection{Delete/Yank/Change Commands}
534 \paralign to \hsize{#\tabskip=10pt plus 1 fil&#\tabskip=0pt&#\tabskip=0pt&#\cr
535 \fourcol{}{{\bf delete}}{{\bf yank}}{{\bf change}}
536 \fourcol{region determined by {\it m}}{d {\it m}}{y {\it m}}{c {\it m}}
537 \fourcol{... into register {\it x}}{" {\it x\/} d {\it m}}{" {\it x\/} y {\it m}}{" {\it x\/} c {\it m}}
538 \fourcol{a line}{d d}{Y {\rm or} y y}{c c}
539 \fourcol{current {\bf region}}{d r}{y r}{c r}
540 \fourcol{expanded {\bf region}}{d R}{y R}{c R}
541 \fourcol{to end of line}{D}{y \$}{c \$}
542 \fourcol{a character after point}{x}{y l}{c l}
543 \fourcol{a character before point}{DEL}{y h}{c h}
546 \vskip 2ex
547 \key{Overwrite {\it n} lines}{{\it n} R}
549 \subsection{Put Back Commands}
551 Deleted/yanked/changed text can be put back by the following commands.
553 \key{{\bf Put} back at point/above line}{P}
554 \key{... from register {\it x}}{" {\it x\/} P}
555 \key{{\bf put} back after point/below line}{p}
556 \key{... from register {\it x}}{" {\it x\/} p}
558 \subsection{Repeating and Undoing Modifications}
560 \key{{\bf undo} last change}{u {\rm or} :und}
561 \key{repeat last change}{.\ {\rm (dot)}}
563 Undo is undoable by \kbd{u} and repeatable by \kbd{.}.
564 For example, \kbd{u...} will undo 4 previous changes.
565 A \kbd{.} after \kbd{5dd} is equivalent to \kbd{5dd},
566 while \kbd{3.} after \kbd{5dd} is equivalent to \kbd{3dd}.
568 \section{Miscellaneous Commands}
570 \endindentedkeys
572 \paralign to \hsize{#\tabskip=5pt plus 1 fil&#\tabskip=0pt&#\tabskip=0pt&#\tabskip=0pt&#\cr
573 \fivecol{}{{\bf shift left}}{{\bf shift right}}{{\bf filter shell command}}{{\bf indent}}
574 \fivecol{region}{< {\it m}}{> {\it m}}{!\ {\it m\/} {\sl shell-com}}{= {\it m}}
575 \fivecol{line}{< <}{> >}{!\ !\ {\sl shell-com}}{= =}
578 \key{{\bf join} lines}{J}
579 \key{toggle case (takes count)}{\~{}}
581 \key{view register {\it x}}{] {\it x}}
582 \key{view marker {\it x}}{] {\it x}}
584 \key{lowercase region}{\# c {\it m}}
585 \key{uppercase region}{\# C {\it m}}
586 \key{execute last keyboard macro on each line in the region}{\# g {\it m}}
588 \key{insert specified string for each line in the region}{\# q {\it m}}
589 \key{check spelling of the words in the region}{\# s {\it m}}
591 \key{repeat previous ex substitution}{\&}
592 \key{change to previous file}{C-^}
594 \key{Viper Meta key}{_}
596 \section{Customization}
598 By default, search is case sensitive.
599 You can change this by including the following line in your \kbd{\~{}/.vip} file.
601 \hskip 5ex
602 \kbd{(setq viper-case-fold-search t)}
604 The following is a subset of the variety of
605 options available for customizing Viper.
606 See the Viper manual for details on these and other options.
608 \beginindentedkeys
610 \paralign to \hsize{#\tabskip=10pt plus 1 fil&#\tabskip=0pt&#\cr
611 \twocol{{\bf variable}}{{\bf default value}}
612 \twocol{viper-search-wrap-around}{t}
613 \twocol{viper-case-fold-search}{nil}
614 \twocol{viper-re-search}{t}
615 \twocol{viper-re-replace}{t}
616 \twocol{viper-re-query-replace}{t}
617 \twocol{viper-auto-indent}{nil}
618 \twocol{viper-shift-width}{8}
619 \twocol{viper-tags-file-name}{"TAGS"}
620 \twocol{viper-no-multiple-ESC}{t}
621 \twocol{viper-ex-style-motion}{t}
622 \twocol{viper-always}{t}
623 \twocol{viper-custom-file-name}{"\~{}/.vip"}
624 \twocol{ex-find-file-shell}{"csh"}
625 \twocol{ex-cycle-other-window}{t}
626 \twocol{ex-cycle-through-non-buffers}{t}
627 \twocol{blink-matching-paren}{t}
628 \twocol{buffer-read-only}{{\it buffer dependent}}
631 To bind keys in Vi command state, put lines like these in your
632 \kbd{\~{}/.vip} file:
634 \beginexample
635 (define-key viper-vi-global-user-map "\\C-v" 'scroll-down)
636 (define-key viper-vi-global-user-map "\\C-cm" 'smail)
637 \endexample
640 \newcolumn
642 \title{Ex Commands in Viper}
644 In vi state, an Ex command is entered by typing:
646 \hskip 5ex
647 \kbd{:\ {\sl ex-command} RET}
649 \section{Ex Addresses}
651 \paralign to \hsize{#\tabskip=5pt plus 1 fil&#\tabskip=2pt&#\tabskip=5pt plus 1 fil&#\cr
652 \twocolkey{current line}{.}{next line with {\sl pat}}{/ {\sl pat} /}
653 \twocolkey{line {\it n}}{{\it n}}{previous line with {\sl pat}}{?\ {\sl pat} ?}
654 \twocolkey{last line}{\$}{{\it n\/} line before {\it a}}{{\it a} - {\it n}}
655 \twocolkey{next line}{+}{{\it a\/} through {\it b}}{{\it a\/} , {\it b}}
656 \twocolkey{previous line}{-}{line marked with {\it x}}{' {\it x}}
657 \twocolkey{entire buffer}{\%}{previous context}{' '}
660 Addresses can be specified in front of a command.
661 For example,
663 \hskip 5ex
664 \kbd{:.,.+10m\$}
666 moves 11 lines below current line to the end of buffer.
668 \section{Ex Commands}
670 Avoid Ex text manipulation commands except substitute.
671 There are better VI equivalents
672 for all of them. Also note that all Ex commands expand \% to
673 current file name. To include a \% in the command, escape it with a $\backslash$.
674 Similarly, \# is replaced by previous file. For Viper, this is the
675 first file in the {\sl :args} listing for that buffer. This defaults
676 to the previous file in the VI sense if you have one window.
677 Ex commands can be made to have history. See the manual for details.
679 \subsection{Ex Text Commands}
681 \endindentedkeys
683 \key{mark lines matching {\sl pat} and execute {\sl cmds} on these lines}{:g /{\sl pat}/ {\sl cmds}}
685 \key{mark lines {\it not\/} matching {\sl pat} and execute {\sl cmds} on these lines}{:v /{\sl pat}/ {\sl cmds}}
688 \key{{\bf move} specified lines after {\sl addr}}{:m {\sl addr}}
689 \key{{\bf copy} specified lines after {\sl addr}}{:co\rm\ (or \kbd{:t})\ \sl addr}
690 \key{{\bf delete} specified lines [into register {\it x\/}]}{:d {\rm [{\it x\/}]}}
691 \key{{\bf yank} specified lines [into register {\it x\/}]}{:y {\rm [{\it x\/}]}}
692 \key{{\bf put} back text [from register {\it x\/}]}{:pu {\rm [{\it x\/}]}}
694 \key{{\bf substitute} {\sl repl} for first string on line matching {\sl pat}}{:s /{\sl pat}/{\sl repl}/}
696 \key{repeat last substitution}{:\&}
697 \key{repeat previous substitute with previous search pattern as {\sl pat}}{:\~{}}
699 \subsection{Ex File and Shell Commands}
701 \key{{\bf edit} file}{:e {\sl file}}
702 \key{reedit messed up current file}{:e!}
703 \key{edit previous file}{:e\#}
704 \key{{\bf read} in a file}{:r {\sl file}}
705 \key{{\bf read} in the output of a shell command}{:r {\sl !command}}
706 \key{write out specified lines into {\sl file}}{:w {\sl file}}
707 \key{save all modified buffers, ask confirmation}{:W {\sl file}}
708 \key{save all modified buffers, no confirmation}{:WW {\sl file}}
709 \key{write out specified lines at the end of {\sl file}}{:w>> {\sl file}}
710 \key{{\bf write} to the input of a shell command}{:w {\sl !command}}
711 \key{write out and then quit}{:wq {\sl file}}
713 \key{run a sub{\bf shell} in a window}{:sh}
714 \key{execute shell command {\sl command}}{:!\ {\sl command}}
715 \key{execute previous shell command with {\it args} appended}{:!! {\sl args}}
717 \subsection{Ex Miscellaneous Commands}
719 \key{define a macro {\it x} that expands to {\sl cmd}}{:map {\it x} {\sl cmd}}
720 \key{remove macro expansion associated with {\it x}}{:unma {\it x}}
721 \key{define a macro {\it x} that expands to {\sl cmd} in insert state}{:map!\ {\it x} {\sl cmd}}
722 \key{remove macro expansion associated with {\it x} in insert state}{:unma!\ {\it x}}
724 \key{print line number}{:.=}
725 \key{print last line number}{:=}
726 \key{print {\bf version} number of Viper}{:ve}
728 \key{shift specified lines to the right}{:>}
729 \key{shift specified lines to the left}{:<}
731 \key{{\bf join} lines}{:j}
732 \key{mark specified line to register {\it x}}{:k {\it x}}
733 \key{{\bf set} a variable's value}{:se}
734 \key{find first definition of {\bf tag} {\sl tag}}{:ta {\sl tag}}
736 \key{Current directory}{:pwd}
739 \copyrightnotice
741 \bye
743 % Local variables:
744 % compile-command: "pdftex viperCard"
745 % End: