1 % Reference Card for Dired
3 % Copyright (C) 2000-2016 Free Software Foundation, Inc.
5 % Author: Evgeny Roubinchtein <eroubinc@u.washington.edu>
7 % This document is free software: you can redistribute it and/or modify
8 % it under the terms of the GNU General Public License as published by
9 % the Free Software Foundation, either version 3 of the License, or
10 % (at your option) any later version.
12 % As a special additional permission, you may distribute reference cards
13 % printed, or formatted for printing, with the notice "Released under
14 % the terms of the GNU General Public License version 3 or later"
15 % instead of the usual distributed-under-the-GNU-GPL notice, and without
16 % a copy of the GPL itself.
18 % This document is distributed in the hope that it will be useful,
19 % but WITHOUT ANY WARRANTY; without even the implied warranty of
20 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 % GNU General Public License for more details.
23 % You should have received a copy of the GNU General Public License
24 % along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
27 % This file is intended to be processed by plain TeX (TeX82).
29 % This is a bit of a dirty hack on the GNU Emacs reference card
30 % to produce a Dired reference card instead.
32 % I put this together because I wanted a Dired reference card, but
33 % couldn't find anything on the 'net. Based mostly off Dired's
37 \newcount\columnsperpage
39 % This file can be printed with 1, 2, or 3 columns per page.
40 % Specify how many you want here.
41 % The reference card looks OK with 2 columns per page, portrait mode.
42 % I haven't tried it with 3 columns per page.
45 % PDF output layout. 0 for A4, 1 for letter (US), a `l' is added for
52 % Nothing else needs to be changed.
54 \def\shortcopyrightnotice{\vskip 1ex plus
2 fill
55 \centerline{\small \copyright\
\year\ Free Software Foundation, Inc.
56 Permissions on back.
}}
59 \vskip 1ex plus
2 fill
\begingroup\small
60 \centerline{Copyright
\copyright\
\year\ Free Software Foundation, Inc.
}
61 \centerline{For GNU Emacs version
\versionemacs}
62 \centerline{Originally written May
2000 by Evgeny Roubinchtein,
}
63 \centerline{using refcard layout designed by Stephen Gildea.
}
65 Released under the terms of the GNU General Public License version
3 or later.
67 \TeX{} source for this card is distributed with Emacs in
{\tt etc/refcards/
}
69 For copies of the GNU Emacs manual, see:
71 {\tt http://www.gnu.org/software/emacs/\#Manuals
}
74 % make \bye not \outer so that the \def\bye in the \else clause below
75 % can be scanned without complaint.
76 \def\bye{\par\vfill\supereject\end}
78 \newdimen\intercolumnskip %horizontal space between columns
79 \newbox\columna %boxes to hold columns already built
82 \def\ncolumns{\the\columnsperpage}
84 \message{[\ncolumns\space
85 column
\if 1\ncolumns\else s
\fi\space per page
]}
87 \def\scaledmag#1{ scaled
\magstep #1}
89 % This multi-way format was designed by Stephen Gildea October 1986.
90 % Note that the 1-column format is fontfamily-independent.
91 \if 1\ncolumns %one-column format uses normal size
95 \font\titlefont=
\fontname\tenbf \scaledmag3
96 \font\headingfont=
\fontname\tenbf \scaledmag2
97 \font\smallfont=
\fontname\sevenrm
98 \font\smallsy=
\fontname\sevensy
100 \footline{\hss\folio}
101 \def\makefootline{\baselineskip10pt\hsize6.5in
\line{\the\footline}}
102 \else %2 or 3 columns uses prereduced size
107 \font\titlefont=cmbx10
\scaledmag2
108 \font\headingfont=cmbx10
\scaledmag1
124 \normalbaselineskip=
.8\normalbaselineskip
125 \normallineskip=
.8\normallineskip
126 \normallineskiplimit=
.8\normallineskiplimit
127 \normalbaselines\rm %make definitions take effect
131 \footline{\hss\rm\folio\hss}
132 \def\makefootline{\vskip 2in
\hsize=
6.86in
\line{\the\footline}}
137 \errhelp{You must set
\columnsperpage equal to
1,
2, or
3.
}
138 \errmessage{Illegal number of columns per page
}
141 \intercolumnskip=
.46in
143 \output=
{% %see The TeXbook page 257
144 % This next line is useful when designing the layout.
145 %\immediate\write16{Column \folio\abc\space starts with \firstmark}
146 \if \maxcolumn\abc \multicolumnformat \global\def\abc{a
}
148 \global\setbox\columna\columnbox \global\def\abc{b
}
149 %% in case we never use \columnb (two-column mode)
150 \global\setbox\columnb\hbox to -
\intercolumnskip{}
152 \global\setbox\columnb\columnbox \global\def\abc{c
}\fi\fi}
153 \def\multicolumnformat{\shipout\vbox{\makeheadline
154 \hbox{\box\columna\hskip\intercolumnskip
155 \box\columnb\hskip\intercolumnskip\columnbox}
156 \makefootline}\advancepageno}
157 \def\columnbox{\leftline{\pagebody}}
159 \def\bye{\par\vfill\supereject
160 \if a
\abc \else\null\vfill\eject\fi
161 \if a
\abc \else\null\vfill\eject\fi
165 % we won't be using math mode much, so redefine some of the characters
166 % we might want to talk about
174 \hyphenation{mini-buf-fer
}
175 \hyphenation{de-le-tion
}
178 \parskip 1ex plus
.5ex minus
.5ex
180 \def\small{\smallfont\textfont2=
\smallsy\baselineskip=
.8\baselineskip}
182 % newcolumn - force a new column. Use sparingly, probably only for
183 % the first column of a page, which should have a title anyway.
184 \outer\def\newcolumn{\vfill\eject}
186 % title - page title. Argument is title text.
187 \outer\def\title#1{{\titlefont\centerline{#1}}\vskip 1ex plus
.5ex
}
189 % section - new major section. Argument is section name.
190 \outer\def\section#1{\par\filbreak
191 \vskip 3ex plus
2ex minus
2ex
{\headingfont #1}\mark{#1}%
192 \vskip 2ex plus
1ex minus
1.5ex
}
196 % beginindentedkeys...endindentedkeys - key definitions will be
197 % indented, but running text, typically used as headings to group
198 % definitions, will not.
199 \def\beginindentedkeys{\keyindent=
1em
}
200 \def\endindentedkeys{\keyindent=
0em
}
203 % paralign - begin paragraph containing an alignment.
204 % If an \halign is entered while in vertical mode, a parskip is never
205 % inserted. Using \paralign instead of \halign solves this problem.
206 \def\paralign{\vskip\parskip\halign}
208 % \<...> - surrounds a variable name in a code example
209 \def\<
#1>
{{\it #1\/
}}
211 % kbd - argument is characters typed literally. Like the Texinfo command.
212 \def\kbd#1{{\tt#1}\null} %\null so not an abbrev even if period follows
214 % beginexample...endexample - surrounds literal text, such a code example.
215 % typeset in a typewriter font with line breaks preserved
216 \def\beginexample{\par\leavevmode\begingroup
217 \obeylines\obeyspaces\parskip0pt\tt}
218 {\obeyspaces\global\let =\
}
219 \def\endexample{\endgroup}
221 % key - definition of a key.
222 % \key{description of key}{key-name}
223 % prints the description left-justified, and the key-name in a \kbd
224 % form near the right margin.
225 \def\key#1#2{\leavevmode\hbox to
\hsize{\vtop
226 {\hsize=
.75\hsize\rightskip=
1em
227 \hskip\keyindent\relax#1}\kbd{#2}\hfil}}
230 \setbox\metaxbox\hbox{\kbd{M-x
}}
232 \metaxwidth=
\wd\metaxbox
234 % metax - definition of a M-x command.
235 % \metax{description of command}{M-x command-name}
236 % Tries to justify the beginning of the command name at the same place
237 % as \key starts the key name. (The "M-x " sticks out to the left.)
238 \def\metax#1#2{\leavevmode\hbox to
\hsize{\hbox to
.75\hsize
239 {\hskip\keyindent\relax#1\hfil}%
240 \hskip -
\metaxwidth minus
1fil
243 % threecol - like "key" but with two key names.
244 % for example, one for doing the action backward, and one for forward.
245 \def\threecol#1#2#3{\hskip\keyindent\relax#1\hfil&
\kbd{#2}\hfil\quad
246 &
\kbd{#3}\hfil\quad\cr}
248 % I cannot figure out how to make all dired-x
249 % commands fit on a page in two-column format
257 \title{Dired Reference Card
}
259 \centerline{(based on Dired in GNU Emacs
\versionemacs)
}
260 \centerline{Commands marked with
\dx{} require dired-x
}
262 % trim this down to fit everything on one page
264 % In dired, you can edit a list of the files in a directory (and optionally
265 % its subdirectories in the `ls -lR' format).
267 % Editing a directory means that you can visit, rename, copy, compress,
268 % load, byte-compile files. You can change files' attributes, run shell
269 % commands on files, or insert subdirectories into the edit buffer. You can
270 % "flag" files for deletion or "mark" files for later commands, either one
271 % file at a time or by all files matching certain criteria (e.g., files that
272 % match a certain regexp).
274 % You move throughout the buffer using the usual cursor motion commands.
275 % Letters no longer insert themselves, but execute commands instead. The
276 % digits (0-9) are prefix arguments.
278 % Most commands operate either on all marked files or on the current file if
279 % no files are marked. Use a numeric prefix argument to operate on the next
280 % ARG files (or previous ARG if ARG $<$ 0). Use the prefix argument `1' to
281 % operate on the current file only. Prefix arguments override marks. Commands
282 % which run a sub-process on a group of files will display a list of files
283 % for which the sub-process failed. Typing y will try to tell
284 % you what went wrong.
286 % When editing several directories in one buffer, each directory acts as a
287 % page, so C-x [ and C-x ] can be used to move between directories.
289 \section{Entering and Exiting Dired
}
291 \key{run dired
}{C-x d
}
292 \key{dired the directory of the file you are editing
}{C-x C-j
\dx}
295 \section{Motion Commands
}
297 \key{move up to previous line
}{p
}
298 \key{move down to next line
}{n
}
299 \key{move up to previous directory line
}{<
}
300 \key{move down to next directory line
}{>
}
301 \key{move to next marked file
}{M-\
}}
302 \key{move to previous marked file
}{M-\
{}
303 \key{move up to previous subdirectory
}{M-C-p
}
304 \key{move down to next subdirectory
}{M-C-n
}
305 \key{move to parent directory
}{^
}
306 \key{move to first child subdirectory
}{M-C-d
}
308 \section{Mouse Commands
}
309 \metax{visit file or directory
}{Mouse_Button_2
}
311 \section{Immediate Actions on Files
}
313 \key{visit current file
}{f
}
314 \key{view current file
}{v
}
315 \key{visit current file in other window
}{o
}
317 %% \key{visit current file in other frame}{w}
319 %%\key{display current file}{C-u o}
320 \key{create a new subdirectory
}{+
}
321 \key{compare file at point with the one at mark
}{=
}
323 \section{Marking and Unmarking Files
}
325 \key{mark a file or subdirectory for later commands
}{m
}
326 \key{unmark a file or all files of a subdirectory
}{u
}
327 \key{unmark all marked files in a buffer
}{M-delete
}
328 \key{mark files with a given extension
}{* .
}
329 \key{mark all directories
}{* /
}
330 \key{mark all symlinks
}{* @
}
331 \key{mark all executables
}{* *
}
332 \key{invert marking
}{t
}
333 \key{mark all files in the current subdir
}{* s
}
334 \key{mark file names matching a regular expression
}{* \%
}
335 \key{change the marks to a different character
}{* c
}
336 \key{mark files for which Elisp expression returns t
}{* (
\dx}
338 \section{Modifying the Dired Buffer
}
340 \key{insert a subdirectory into this buffer
}{i
}
341 \key{remove marked files from the listing
}{k
}
342 \key{remove a subdir listing
}{C-u k
}
343 \key{re-read all directories (retains all marks)
}{g
}
344 \key{toggle sorting of current subdir by name/date
}{s
}
345 \key{edit ls switches
}{C-u s
}
346 \key{recover marks, hidden lines, and such (undo)
}{C-_
}
347 \key{hide all subdirectories
}{M-\$
}
348 \key{hide or unhide subdirectory
}{\$
}
350 \section{Commands on Files Marked or Specified by the Prefix
}
352 \key{copy file(s)
}{C
}
353 \key{rename a file or move files to another directory
}{R
}
354 \key{change ownership of file(s)
}{O
}
355 \key{change the group of the file(s)
}{G
}
356 \key{change mode of file(s)
}{M
}
357 \key{print file(s)
}{P
}
358 \key{convert filename(s) to lower case
}{\% l
}
359 \key{convert filename(s) to upper case
}{\% u
}
360 \key{delete marked (as opposed to flagged) file(s)
}{D
}
362 %%\key{uuencode or uudecode file(s)}{U}
363 \key{compress or uncompress file(s)
}{Z
}
364 %% Only uses the current file.
365 \key{run info on file
}{I
\dx}
366 \key{make symbolic link(s)
}{S
}
367 \key{make relative symbolic link(s)
}{Y
}
368 \key{make hard link(s)
}{H
}
369 \key{search files for a regular expression
}{A
}
370 \key{regexp query replace on marked files
}{Q
}
371 \key{byte-compile file(s)
}{B
}
372 \key{load file(s)
}{L
}
373 \key{shell command on file(s)
}{!
}
374 \key{asynchronous shell command on file(s)
}{\&
}
376 \section{Flagging Files for Deletion
}
377 \leftline{\bf Unmark commands remove delete flags
}
378 \key{flag file for deletion
}{d
}
380 %%\key{backup and remove deletion flag}{delete}
381 \key{flag all backup files (file names ending in \~
{})
}{\~
{}}
382 \key{flag all auto-save files
}{\#
}
383 \key{flag various intermediate files
}{\% \&
}
384 \key{flag numeric backups (ending in .\~
{}1\~
{}, .\~
{}2\~
{}, etc.)
}{.
}
385 \key{execute the deletions requested (flagged files)
}{x
}
386 \key{flag files matching a regular expression
}{\% d
}
388 \section{Regular Expression Commands
}
390 \key{mark filenames matching a regular expression
}{\% m
}
391 \key{copy marked files by regexp
}{\% C
}
392 \key{rename marked files by regexp
}{\% R
}
395 \key{symlink, with relative paths
}{\% Y
}
396 \key{mark for deletion
}{\% d
}
398 \section{Dired and Find
}
399 \metax{dired file(s) whose name matches a pattern
}{M-x find-name-dired
}
400 \metax{dired file(s) that contain pattern
}{M-x find-grep-dired
}
401 \metax{dired file(s) based on
\kbd{find
} output
}{M-x find-dired
}
403 \section{Getting Help
}
406 \key{dired summary (short help) and error log
}{?
}