1 % Reference Card for Dired
2 % Copyright (C) 2000 Free Software Foundation, Inc.
4 % This file is part of GNU Emacs.
6 % GNU Emacs is free software; you can redistribute it and/or modify
7 % it under the terms of the GNU General Public License as published by
8 % the Free Software Foundation; either version 2, or (at your option)
11 % GNU Emacs is distributed in the hope that it will be useful,
12 % but WITHOUT ANY WARRANTY; without even the implied warranty of
13 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 % GNU General Public License for more details.
16 % You should have received a copy of the GNU General Public License
17 % along with GNU Emacs; see the file COPYING. If not, write to
18 % the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 % Boston, MA 02111-1307, USA.
21 % This file can be printed with 1, 2, or 3 columns per page (see below).
22 % Specify how many you want here. Nothing else needs to be changed.
25 \newcount\columnsperpage
29 % This file is intended to be processed by plain TeX (TeX82).
30 % The reference card looks OK with 2 columns per page, portrait mode.
31 % I haven't tried it with 3 columns per page.
33 % This is a bit of a dirty hack on the GNU Emacs reference card
34 % to produce a Dired reference card instead.
36 % I (Evgeny Roubinchtein, eroubinc@u.washington.edu) put this together
37 % because I wanted a Dired reference card,
38 % but couldn't find anything on the 'net.
39 % Based mostly off Dired's describe-mode.
42 \def\versionnumber{0.1}
44 \def\version{May
\year\ v
\versionnumber}
46 \def\shortcopyrightnotice{\vskip 1ex plus
2 fill
47 \centerline{\small \copyright\
\year\ Free Software Foundation, Inc.
48 Permissions on back. v
\versionnumber}}
51 \vskip 1ex plus
2 fill
\begingroup\small
52 \centerline{Copyright
\copyright\
\year\ Free Software Foundation, Inc.
}
53 \centerline{designed by Stephen Gildea,
\version}
54 \centerline{for GNU Emacs version
19 on Unix systems
}
55 \centerline{Updated for Dired in May
200 by Evgeny Roubinchtein
}
57 Permission is granted to make and distribute copies of
58 this card provided the copyright notice and this permission notice
59 are preserved on all copies.
61 For copies of the GNU Emacs manual, write to the Free Software
62 Foundation, Inc.,
675 Massachusetts Ave, Cambridge MA
02139.
66 % make \bye not \outer so that the \def\bye in the \else clause below
67 % can be scanned without complaint.
68 \def\bye{\par\vfill\supereject\end}
70 \newdimen\intercolumnskip %horizontal space between columns
71 \newbox\columna %boxes to hold columns already built
74 \def\ncolumns{\the\columnsperpage}
76 \message{[\ncolumns\space
77 column
\if 1\ncolumns\else s
\fi\space per page
]}
79 \def\scaledmag#1{ scaled
\magstep #1}
81 % This multi-way format was designed by Stephen Gildea October 1986.
82 % Note that the 1-column format is fontfamily-independent.
83 \if 1\ncolumns %one-column format uses normal size
87 \font\titlefont=
\fontname\tenbf \scaledmag3
88 \font\headingfont=
\fontname\tenbf \scaledmag2
89 \font\smallfont=
\fontname\sevenrm
90 \font\smallsy=
\fontname\sevensy
93 \def\makefootline{\baselineskip10pt\hsize6.5in
\line{\the\footline}}
94 \else %2 or 3 columns uses prereduced size
99 \font\titlefont=cmbx10
\scaledmag2
100 \font\headingfont=cmbx10
\scaledmag1
116 \normalbaselineskip=
.8\normalbaselineskip
117 \normallineskip=
.8\normallineskip
118 \normallineskiplimit=
.8\normallineskiplimit
119 \normalbaselines\rm %make definitions take effect
123 \footline{\hss\rm\folio\hss}
124 \def\makefootline{\vskip 2in
\hsize=
6.86in
\line{\the\footline}}
129 \errhelp{You must set
\columnsperpage equal to
1,
2, or
3.
}
130 \errmessage{Illegal number of columns per page
}
133 \intercolumnskip=
.46in
135 \output=
{% %see The TeXbook page 257
136 % This next line is useful when designing the layout.
137 %\immediate\write16{Column \folio\abc\space starts with \firstmark}
138 \if \maxcolumn\abc \multicolumnformat \global\def\abc{a
}
140 \global\setbox\columna\columnbox \global\def\abc{b
}
141 %% in case we never use \columnb (two-column mode)
142 \global\setbox\columnb\hbox to -
\intercolumnskip{}
144 \global\setbox\columnb\columnbox \global\def\abc{c
}\fi\fi}
145 \def\multicolumnformat{\shipout\vbox{\makeheadline
146 \hbox{\box\columna\hskip\intercolumnskip
147 \box\columnb\hskip\intercolumnskip\columnbox}
148 \makefootline}\advancepageno}
149 \def\columnbox{\leftline{\pagebody}}
151 \def\bye{\par\vfill\supereject
152 \if a
\abc \else\null\vfill\eject\fi
153 \if a
\abc \else\null\vfill\eject\fi
157 % we won't be using math mode much, so redefine some of the characters
158 % we might want to talk about
166 \hyphenation{mini-buf-fer
}
167 \hyphenation{de-le-tion
}
170 \parskip 1ex plus
.5ex minus
.5ex
172 \def\small{\smallfont\textfont2=
\smallsy\baselineskip=
.8\baselineskip}
174 % newcolumn - force a new column. Use sparingly, probably only for
175 % the first column of a page, which should have a title anyway.
176 \outer\def\newcolumn{\vfill\eject}
178 % title - page title. Argument is title text.
179 \outer\def\title#1{{\titlefont\centerline{#1}}\vskip 1ex plus
.5ex
}
181 % section - new major section. Argument is section name.
182 \outer\def\section#1{\par\filbreak
183 \vskip 3ex plus
2ex minus
2ex
{\headingfont #1}\mark{#1}%
184 \vskip 2ex plus
1ex minus
1.5ex
}
188 % beginindentedkeys...endindentedkeys - key definitions will be
189 % indented, but running text, typically used as headings to group
190 % definitions, will not.
191 \def\beginindentedkeys{\keyindent=
1em
}
192 \def\endindentedkeys{\keyindent=
0em
}
195 % paralign - begin paragraph containing an alignment.
196 % If an \halign is entered while in vertical mode, a parskip is never
197 % inserted. Using \paralign instead of \halign solves this problem.
198 \def\paralign{\vskip\parskip\halign}
200 % \<...> - surrounds a variable name in a code example
201 \def\<
#1>
{{\it #1\/
}}
203 % kbd - argument is characters typed literally. Like the Texinfo command.
204 \def\kbd#1{{\tt#1}\null} %\null so not an abbrev even if period follows
206 % beginexample...endexample - surrounds literal text, such a code example.
207 % typeset in a typewriter font with line breaks preserved
208 \def\beginexample{\par\leavevmode\begingroup
209 \obeylines\obeyspaces\parskip0pt\tt}
210 {\obeyspaces\global\let =\
}
211 \def\endexample{\endgroup}
213 % key - definition of a key.
214 % \key{description of key}{key-name}
215 % prints the description left-justified, and the key-name in a \kbd
216 % form near the right margin.
217 \def\key#1#2{\leavevmode\hbox to
\hsize{\vtop
218 {\hsize=
.75\hsize\rightskip=
1em
219 \hskip\keyindent\relax#1}\kbd{#2}\hfil}}
222 \setbox\metaxbox\hbox{\kbd{M-x
}}
224 \metaxwidth=
\wd\metaxbox
226 % metax - definition of a M-x command.
227 % \metax{description of command}{M-x command-name}
228 % Tries to justify the beginning of the command name at the same place
229 % as \key starts the key name. (The "M-x " sticks out to the left.)
230 \def\metax#1#2{\leavevmode\hbox to
\hsize{\hbox to
.75\hsize
231 {\hskip\keyindent\relax#1\hfil}%
232 \hskip -
\metaxwidth minus
1fil
235 % threecol - like "key" but with two key names.
236 % for example, one for doing the action backward, and one for forward.
237 \def\threecol#1#2#3{\hskip\keyindent\relax#1\hfil&
\kbd{#2}\hfil\quad
238 &
\kbd{#3}\hfil\quad\cr}
240 % I cannot figure out how to make all dired-x
241 % commands fit on a page in two-column format
247 \title{Dired Reference Card
}
249 \centerline{(based on Dired in GNU Emacs
20.x)
}
250 \centerline{Commands marked with
\dx{} require dired-x
}
252 % trim this down to fit everything on one page
254 % In dired, you can edit a list of the files in a directory (and optionally
255 % its subdirectories in the `ls -lR' format).
257 % Editing a directory means that you can visit, rename, copy, compress,
258 % load, byte-compile files. You can change files' attributes, run shell
259 % commands on files, or insert subdirectories into the edit buffer. You can
260 % "flag" files for deletion or "mark" files for later commands, either one
261 % file at a time or by all files matching certain criteria (e.g., files that
262 % match a certain regexp).
264 % You move throughout the buffer using the usual cursor motion commands.
265 % Letters no longer insert themselves, but execute commands instead. The
266 % digits (0-9) are prefix arguments.
268 % Most commands operate either on all marked files or on the current file if
269 % no files are marked. Use a numeric prefix argument to operate on the next
270 % ARG files (or previous ARG if ARG $<$ 0). Use the prefix argument `1' to
271 % operate on the current file only. Prefix arguments override marks. Commands
272 % which run a sub-process on a group of files will display a list of files
273 % for which the sub-process failed. Typing y will try to tell
274 % you what went wrong.
276 % When editing several directories in one buffer, each directory acts as a
277 % page, so C-x [ and C-x ] can be used to move between directories.
279 \section{Entering and Exiting Dired
}
281 \key{run dired
}{C-x d
}
282 \key{dired the directory of the file you are editing
}{C-x C-j
\dx}
285 \section{Motion Commands
}
287 \key{move up to previous line
}{p
}
288 \key{move down to next line
}{n
}
289 \key{move up to previous directory line
}{<
}
290 \key{move down to next directory line
}{>
}
291 \key{move to next marked file
}{M-\
}}
292 \key{move to previous marked file
}{M-\
{}
293 \key{move up to previous subdirectory
}{M-C-p
}
294 \key{move down to next subdirectory
}{M-C-n
}
295 \key{move to parent directory
}{^
}
296 \key{move to first child subdirectory
}{M-C-d
}
298 \section{Mouse Commands
}
299 \metax{visit file
}{Mouse_Button_2
}
300 \metax{popup menu
}{Control-Mouse_Button_3
}
302 \section{Immediate Actions on Files
}
304 \key{visit current file
}{f
}
305 \key{view current file
}{v
}
306 \key{visit current file in other window
}{o
}
307 \key{visit current file in other frame
}{w
}
308 \key{display current file
}{C-u o
}
309 \key{create a new subdirectory
}{+
}
310 \key{compare file at point with the one at mark
}{=
}
312 \section{Marking and Unmarking Files
}
314 \key{mark a file or subdirectory for later commands
}{m
}
315 \key{unmark a file or all files of a subdirectory
}{u
}
316 \key{unmark all marked files in a buffer
}{M-delete
}
317 \key{mark files with a given extension
}{* .
}
318 \key{mark all directories
}{* /
}
319 \key{mark all symlinks
}{* @
}
320 \key{mark all executables
}{* *
}
321 \key{invert marking
}{* t
}
322 \key{mark all files in the current subdir
}{* s
}
323 \key{mark file names matching a regular expression
}{* \%
}
324 \key{change the marks to a different character
}{* c
}
325 \key{mark files for which Elisp expression returns t
}{* (
\dx}
327 \section{Getting Help
}
330 \key{dired summary (short help) and error log
}{?
}
332 \section{Commands on Files Marked or Specified by the Prefix
}
334 \key{copy file(s)
}{C
}
335 \key{rename a file or move files to another directory
}{R
}
336 \key{change ownership of file(s)
}{O
}
337 \key{change the group of the file(s)
}{G
}
338 \key{change mode of file(s)
}{M
}
339 \key{print file(s)
}{P
}
340 \key{convert filename(s) to lower case
}{\% l
}
341 \key{convert filename(s) to upper case
}{\% u
}
342 \key{delete marked (as opposed to flagged) files
}{X
}
343 \key{uuencode or uudecode file(s)
}{U
}
344 \key{compress or uncompress file(s)
}{Z
}
345 \key{run info on file
}{I
\dx}
346 \key{make symbolic link(s)
}{S
}
347 \key{make relative symbolic links
}{Y
}
348 \key{make hard link(s)
}{H
}
349 \key{search files for a regular expression
}{A
}
350 \key{query replace regular expression
}{Q
}
351 \key{byte-compile files
}{B
}
353 \key{shell command on file(s)
}{!
}
355 \section{Flagging Files for Deletion
}
356 \leftline{\bf Unmark commands remove delete flags
}
357 \key{flag file for deletion
}{d
}
358 \key{backup and remove deletion flag
}{delete
}
359 \key{flag all backup files (file names ending in \~
{})
}{\~
{}}
360 \key{flag all auto-save files
}{\#
}
361 \key{flag various intermediate files
}{\&
}
362 \key{flag numeric backups (ending in .\~
{}1\~
{}, .\~
{}2\~
{}, etc.)
}{.
}
363 \key{execute the deletions requested (flagged files)
}{x
}
364 \key{flag files matching a regular expression
}{\% d
}
366 \section{Modifying the Dired Buffer
}
368 \key{insert a subdirectory into this buffer
}{i
}
369 \key{remove marked files from the listing
}{k
}
370 \key{remove a subdir listing
}{C-u k
}
371 \key{re-read all directories (retains all marks)
}{g
}
372 \key{toggle sorting of current subdir by name/date
}{s
}
373 \key{edit ls switches
}{C-u s
}
374 \key{recover marks, hidden lines, and such
}{C-_
}
375 \key{hide all subdirectories
}{M-\$
}
376 \key{hide or unhide subdirectory
}{\$
}
378 \section{Regular Expression Commands
}
380 \key{mark filenames matching a regular expression
}{\% m
}
381 \key{copy marked files by regexp
}{\% C
}
382 \key{rename marked files by regexp
}{\% R
}
385 \key{symlink, with relative paths
}{\% Y
}
386 \key{mark for deletion
}{\% d
}
388 \section{Dired and Find
}
389 \metax{dired file(s) whose name matches a pattern
}{M-x find-names-dired
}
390 \metax{dired file(s) that contain pattern
}{M-x find-grep-dired
}
391 \metax{dired file(s) based on
\kbd{find
} output
}{M-x find-dired
}