| 1 | % Reference Card for Dired |
| 2 | % Copyright (C) 2000. 2001 Free Software Foundation, Inc. |
| 3 | |
| 4 | % This file is part of GNU Emacs. |
| 5 | |
| 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) |
| 9 | % any later version. |
| 10 | |
| 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. |
| 15 | |
| 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. |
| 20 | |
| 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. |
| 23 | %**start of header |
| 24 | |
| 25 | \newcount\columnsperpage |
| 26 | |
| 27 | \columnsperpage=2 |
| 28 | |
| 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. |
| 32 | |
| 33 | % This is a bit of a dirty hack on the GNU Emacs reference card |
| 34 | % to produce a Dired reference card instead. |
| 35 | |
| 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. |
| 40 | |
| 41 | |
| 42 | \def\versionnumber{0.1} |
| 43 | \def\year{2000} |
| 44 | \def\version{May \year\ v\versionnumber} |
| 45 | |
| 46 | \def\shortcopyrightnotice{\vskip 1ex plus 2 fill |
| 47 | \centerline{\small \copyright\ \year\ Free Software Foundation, Inc. |
| 48 | Permissions on back. v\versionnumber}} |
| 49 | |
| 50 | \def\copyrightnotice{ |
| 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 2000 by Evgeny Roubinchtein} |
| 56 | |
| 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. |
| 60 | |
| 61 | For copies of the GNU Emacs manual, write to the Free Software |
| 62 | Foundation, Inc., 675 Massachusetts Ave, Cambridge MA 02139. |
| 63 | |
| 64 | \endgroup} |
| 65 | |
| 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} |
| 69 | |
| 70 | \newdimen\intercolumnskip %horizontal space between columns |
| 71 | \newbox\columna %boxes to hold columns already built |
| 72 | \newbox\columnb |
| 73 | |
| 74 | \def\ncolumns{\the\columnsperpage} |
| 75 | |
| 76 | \message{[\ncolumns\space |
| 77 | column\if 1\ncolumns\else s\fi\space per page]} |
| 78 | |
| 79 | \def\scaledmag#1{ scaled \magstep #1} |
| 80 | |
| 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 |
| 84 | \hsize 4in |
| 85 | \vsize 10in |
| 86 | \voffset -.7in |
| 87 | \font\titlefont=\fontname\tenbf \scaledmag3 |
| 88 | \font\headingfont=\fontname\tenbf \scaledmag2 |
| 89 | \font\smallfont=\fontname\sevenrm |
| 90 | \font\smallsy=\fontname\sevensy |
| 91 | |
| 92 | \footline{\hss\folio} |
| 93 | \def\makefootline{\baselineskip10pt\hsize6.5in\line{\the\footline}} |
| 94 | \else %2 or 3 columns uses prereduced size |
| 95 | \hsize 3.4in |
| 96 | \vsize 7.95in |
| 97 | \hoffset -.75in |
| 98 | \voffset -.745in |
| 99 | \font\titlefont=cmbx10 \scaledmag2 |
| 100 | \font\headingfont=cmbx10 \scaledmag1 |
| 101 | \font\smallfont=cmr6 |
| 102 | \font\smallsy=cmsy6 |
| 103 | \font\eightrm=cmr8 |
| 104 | \font\eightbf=cmbx8 |
| 105 | \font\eightit=cmti8 |
| 106 | \font\eighttt=cmtt8 |
| 107 | \font\eightmi=cmmi8 |
| 108 | \font\eightsy=cmsy8 |
| 109 | \textfont0=\eightrm |
| 110 | \textfont1=\eightmi |
| 111 | \textfont2=\eightsy |
| 112 | \def\rm{\eightrm} |
| 113 | \def\bf{\eightbf} |
| 114 | \def\it{\eightit} |
| 115 | \def\tt{\eighttt} |
| 116 | \normalbaselineskip=.8\normalbaselineskip |
| 117 | \normallineskip=.8\normallineskip |
| 118 | \normallineskiplimit=.8\normallineskiplimit |
| 119 | \normalbaselines\rm %make definitions take effect |
| 120 | |
| 121 | \if 2\ncolumns |
| 122 | \let\maxcolumn=b |
| 123 | \footline{\hss\rm\folio\hss} |
| 124 | \def\makefootline{\vskip 2in \hsize=6.86in\line{\the\footline}} |
| 125 | \else \if 3\ncolumns |
| 126 | \let\maxcolumn=c |
| 127 | \nopagenumbers |
| 128 | \else |
| 129 | \errhelp{You must set \columnsperpage equal to 1, 2, or 3.} |
| 130 | \errmessage{Illegal number of columns per page} |
| 131 | \fi\fi |
| 132 | |
| 133 | \intercolumnskip=.46in |
| 134 | \def\abc{a} |
| 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} |
| 139 | \else\if a\abc |
| 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{} |
| 143 | \else |
| 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}} |
| 150 | |
| 151 | \def\bye{\par\vfill\supereject |
| 152 | \if a\abc \else\null\vfill\eject\fi |
| 153 | \if a\abc \else\null\vfill\eject\fi |
| 154 | \end} |
| 155 | \fi |
| 156 | |
| 157 | % we won't be using math mode much, so redefine some of the characters |
| 158 | % we might want to talk about |
| 159 | \catcode`\^=12 |
| 160 | \catcode`\_=12 |
| 161 | |
| 162 | \chardef\\=`\\ |
| 163 | \chardef\{=`\{ |
| 164 | \chardef\}=`\} |
| 165 | |
| 166 | \hyphenation{mini-buf-fer} |
| 167 | \hyphenation{de-le-tion} |
| 168 | |
| 169 | \parindent 0pt |
| 170 | \parskip 1ex plus .5ex minus .5ex |
| 171 | |
| 172 | \def\small{\smallfont\textfont2=\smallsy\baselineskip=.8\baselineskip} |
| 173 | |
| 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} |
| 177 | |
| 178 | % title - page title. Argument is title text. |
| 179 | \outer\def\title#1{{\titlefont\centerline{#1}}\vskip 1ex plus .5ex} |
| 180 | |
| 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} |
| 185 | |
| 186 | \newdimen\keyindent |
| 187 | |
| 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} |
| 193 | \endindentedkeys |
| 194 | |
| 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} |
| 199 | |
| 200 | % \<...> - surrounds a variable name in a code example |
| 201 | \def\<#1>{{\it #1\/}} |
| 202 | |
| 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 |
| 205 | |
| 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} |
| 212 | |
| 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}} |
| 220 | |
| 221 | \newbox\metaxbox |
| 222 | \setbox\metaxbox\hbox{\kbd{M-x }} |
| 223 | \newdimen\metaxwidth |
| 224 | \metaxwidth=\wd\metaxbox |
| 225 | |
| 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 |
| 233 | \kbd{#2}\hfil}} |
| 234 | |
| 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} |
| 239 | |
| 240 | % I cannot figure out how to make all dired-x |
| 241 | % commands fit on a page in two-column format |
| 242 | \def\dx{{\bf (DX)}} |
| 243 | |
| 244 | %**end of header |
| 245 | \f |
| 246 | |
| 247 | \title{Dired Reference Card} |
| 248 | |
| 249 | \centerline{(based on Dired in GNU Emacs 21.x)} |
| 250 | \centerline{Commands marked with \dx{} require dired-x} |
| 251 | |
| 252 | % trim this down to fit everything on one page |
| 253 | % \section{General} |
| 254 | % In dired, you can edit a list of the files in a directory (and optionally |
| 255 | % its subdirectories in the `ls -lR' format). |
| 256 | |
| 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). |
| 263 | |
| 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. |
| 267 | |
| 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. |
| 275 | |
| 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. |
| 278 | |
| 279 | \section{Entering and Exiting Dired} |
| 280 | |
| 281 | \key{run dired}{C-x d} |
| 282 | \key{dired the directory of the file you are editing}{C-x C-j \dx} |
| 283 | \key{quit dired}{q} |
| 284 | |
| 285 | \section{Motion Commands} |
| 286 | |
| 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} |
| 297 | |
| 298 | \section{Mouse Commands} |
| 299 | \metax{visit file}{Mouse_Button_2} |
| 300 | \metax{popup menu}{Control-Mouse_Button_3} |
| 301 | |
| 302 | \section{Immediate Actions on Files} |
| 303 | |
| 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}{=} |
| 311 | |
| 312 | \section{Marking and Unmarking Files} |
| 313 | |
| 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} |
| 326 | |
| 327 | \section{Getting Help} |
| 328 | |
| 329 | \key{dired help}{h} |
| 330 | \key{dired summary (short help) and error log}{?} |
| 331 | |
| 332 | \section{Commands on Files Marked or Specified by the Prefix} |
| 333 | |
| 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} |
| 352 | \key{load files}{L} |
| 353 | \key{shell command on file(s)}{!} |
| 354 | |
| 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} |
| 365 | |
| 366 | \section{Modifying the Dired Buffer} |
| 367 | |
| 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}{\$} |
| 377 | |
| 378 | \section{Regular Expression Commands} |
| 379 | |
| 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} |
| 383 | \key{hardlink}{\% H} |
| 384 | \key{symlink}{\% S} |
| 385 | \key{symlink, with relative paths}{\% Y} |
| 386 | \key{mark for deletion}{\% d} |
| 387 | |
| 388 | \section{Dired and Find} |
| 389 | \metax{dired file(s) whose name matches a pattern}{M-x find-name-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} |
| 392 | |
| 393 | %\copyrightnotice |
| 394 | |
| 395 | \bye |
| 396 | |
| 397 | % arch-tag: 483e7bb4-4576-4733-9fca-0eae1c861484 |