dired-ref.tex 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. % Reference Card for Dired
  2. % Copyright (C) 2000-2012 Free Software Foundation, Inc.
  3. % Author: Evgeny Roubinchtein <eroubinc@u.washington.edu>
  4. % This file is part of GNU Emacs.
  5. % GNU Emacs is free software: you can redistribute it and/or modify
  6. % it under the terms of the GNU General Public License as published by
  7. % the Free Software Foundation, either version 3 of the License, or
  8. % (at your option) any later version.
  9. % GNU Emacs is distributed in the hope that it will be useful,
  10. % but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. % GNU General Public License for more details.
  13. % You should have received a copy of the GNU General Public License
  14. % along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  15. % This file is intended to be processed by plain TeX (TeX82).
  16. % This is a bit of a dirty hack on the GNU Emacs reference card
  17. % to produce a Dired reference card instead.
  18. % I put this together because I wanted a Dired reference card, but
  19. % couldn't find anything on the 'net. Based mostly off Dired's
  20. % describe-mode.
  21. %**start of header
  22. \newcount\columnsperpage
  23. % This file can be printed with 1, 2, or 3 columns per page.
  24. % Specify how many you want here.
  25. % The reference card looks OK with 2 columns per page, portrait mode.
  26. % I haven't tried it with 3 columns per page.
  27. \columnsperpage=2
  28. % PDF output layout. 0 for A4, 1 for letter (US), a `l' is added for
  29. % a landscape layout.
  30. \input pdflayout.sty
  31. \pdflayout=(1)
  32. \def\versionemacs{24} % version of Emacs this is for
  33. \def\year{2012} % latest copyright year
  34. % Nothing else needs to be changed.
  35. \def\shortcopyrightnotice{\vskip 1ex plus 2 fill
  36. \centerline{\small \copyright\ \year\ Free Software Foundation, Inc.
  37. Permissions on back.}}
  38. \def\copyrightnotice{
  39. \vskip 1ex plus 2 fill\begingroup\small
  40. \centerline{Copyright \copyright\ \year\ Free Software Foundation, Inc.}
  41. \centerline{For GNU Emacs version \versionemacs}
  42. \centerline{Originally written May 2000 by Evgeny Roubinchtein,}
  43. \centerline{using refcard layout designed by Stephen Gildea.}
  44. Permission is granted to make and distribute copies of
  45. this card provided the copyright notice and this permission notice
  46. are preserved on all copies.
  47. For copies of the GNU Emacs manual, see:
  48. {\tt http://www.gnu.org/software/emacs/\#Manuals}
  49. \endgroup}
  50. % make \bye not \outer so that the \def\bye in the \else clause below
  51. % can be scanned without complaint.
  52. \def\bye{\par\vfill\supereject\end}
  53. \newdimen\intercolumnskip %horizontal space between columns
  54. \newbox\columna %boxes to hold columns already built
  55. \newbox\columnb
  56. \def\ncolumns{\the\columnsperpage}
  57. \message{[\ncolumns\space
  58. column\if 1\ncolumns\else s\fi\space per page]}
  59. \def\scaledmag#1{ scaled \magstep #1}
  60. % This multi-way format was designed by Stephen Gildea October 1986.
  61. % Note that the 1-column format is fontfamily-independent.
  62. \if 1\ncolumns %one-column format uses normal size
  63. \hsize 4in
  64. \vsize 10in
  65. \voffset -.7in
  66. \font\titlefont=\fontname\tenbf \scaledmag3
  67. \font\headingfont=\fontname\tenbf \scaledmag2
  68. \font\smallfont=\fontname\sevenrm
  69. \font\smallsy=\fontname\sevensy
  70. \footline{\hss\folio}
  71. \def\makefootline{\baselineskip10pt\hsize6.5in\line{\the\footline}}
  72. \else %2 or 3 columns uses prereduced size
  73. \hsize 3.4in
  74. \vsize 9.2in
  75. \hoffset -.75in
  76. \voffset -.745in
  77. \font\titlefont=cmbx10 \scaledmag2
  78. \font\headingfont=cmbx10 \scaledmag1
  79. \font\smallfont=cmr6
  80. \font\smallsy=cmsy6
  81. \font\eightrm=cmr8
  82. \font\eightbf=cmbx8
  83. \font\eightit=cmti8
  84. \font\eighttt=cmtt8
  85. \font\eightmi=cmmi8
  86. \font\eightsy=cmsy8
  87. \textfont0=\eightrm
  88. \textfont1=\eightmi
  89. \textfont2=\eightsy
  90. \def\rm{\eightrm}
  91. \def\bf{\eightbf}
  92. \def\it{\eightit}
  93. \def\tt{\eighttt}
  94. \normalbaselineskip=.8\normalbaselineskip
  95. \normallineskip=.8\normallineskip
  96. \normallineskiplimit=.8\normallineskiplimit
  97. \normalbaselines\rm %make definitions take effect
  98. \if 2\ncolumns
  99. \let\maxcolumn=b
  100. \footline{\hss\rm\folio\hss}
  101. \def\makefootline{\vskip 2in \hsize=6.86in\line{\the\footline}}
  102. \else \if 3\ncolumns
  103. \let\maxcolumn=c
  104. \nopagenumbers
  105. \else
  106. \errhelp{You must set \columnsperpage equal to 1, 2, or 3.}
  107. \errmessage{Illegal number of columns per page}
  108. \fi\fi
  109. \intercolumnskip=.46in
  110. \def\abc{a}
  111. \output={% %see The TeXbook page 257
  112. % This next line is useful when designing the layout.
  113. %\immediate\write16{Column \folio\abc\space starts with \firstmark}
  114. \if \maxcolumn\abc \multicolumnformat \global\def\abc{a}
  115. \else\if a\abc
  116. \global\setbox\columna\columnbox \global\def\abc{b}
  117. %% in case we never use \columnb (two-column mode)
  118. \global\setbox\columnb\hbox to -\intercolumnskip{}
  119. \else
  120. \global\setbox\columnb\columnbox \global\def\abc{c}\fi\fi}
  121. \def\multicolumnformat{\shipout\vbox{\makeheadline
  122. \hbox{\box\columna\hskip\intercolumnskip
  123. \box\columnb\hskip\intercolumnskip\columnbox}
  124. \makefootline}\advancepageno}
  125. \def\columnbox{\leftline{\pagebody}}
  126. \def\bye{\par\vfill\supereject
  127. \if a\abc \else\null\vfill\eject\fi
  128. \if a\abc \else\null\vfill\eject\fi
  129. \end}
  130. \fi
  131. % we won't be using math mode much, so redefine some of the characters
  132. % we might want to talk about
  133. \catcode`\^=12
  134. \catcode`\_=12
  135. \chardef\\=`\\
  136. \chardef\{=`\{
  137. \chardef\}=`\}
  138. \hyphenation{mini-buf-fer}
  139. \hyphenation{de-le-tion}
  140. \parindent 0pt
  141. \parskip 1ex plus .5ex minus .5ex
  142. \def\small{\smallfont\textfont2=\smallsy\baselineskip=.8\baselineskip}
  143. % newcolumn - force a new column. Use sparingly, probably only for
  144. % the first column of a page, which should have a title anyway.
  145. \outer\def\newcolumn{\vfill\eject}
  146. % title - page title. Argument is title text.
  147. \outer\def\title#1{{\titlefont\centerline{#1}}\vskip 1ex plus .5ex}
  148. % section - new major section. Argument is section name.
  149. \outer\def\section#1{\par\filbreak
  150. \vskip 3ex plus 2ex minus 2ex {\headingfont #1}\mark{#1}%
  151. \vskip 2ex plus 1ex minus 1.5ex}
  152. \newdimen\keyindent
  153. % beginindentedkeys...endindentedkeys - key definitions will be
  154. % indented, but running text, typically used as headings to group
  155. % definitions, will not.
  156. \def\beginindentedkeys{\keyindent=1em}
  157. \def\endindentedkeys{\keyindent=0em}
  158. \endindentedkeys
  159. % paralign - begin paragraph containing an alignment.
  160. % If an \halign is entered while in vertical mode, a parskip is never
  161. % inserted. Using \paralign instead of \halign solves this problem.
  162. \def\paralign{\vskip\parskip\halign}
  163. % \<...> - surrounds a variable name in a code example
  164. \def\<#1>{{\it #1\/}}
  165. % kbd - argument is characters typed literally. Like the Texinfo command.
  166. \def\kbd#1{{\tt#1}\null} %\null so not an abbrev even if period follows
  167. % beginexample...endexample - surrounds literal text, such a code example.
  168. % typeset in a typewriter font with line breaks preserved
  169. \def\beginexample{\par\leavevmode\begingroup
  170. \obeylines\obeyspaces\parskip0pt\tt}
  171. {\obeyspaces\global\let =\ }
  172. \def\endexample{\endgroup}
  173. % key - definition of a key.
  174. % \key{description of key}{key-name}
  175. % prints the description left-justified, and the key-name in a \kbd
  176. % form near the right margin.
  177. \def\key#1#2{\leavevmode\hbox to \hsize{\vtop
  178. {\hsize=.75\hsize\rightskip=1em
  179. \hskip\keyindent\relax#1}\kbd{#2}\hfil}}
  180. \newbox\metaxbox
  181. \setbox\metaxbox\hbox{\kbd{M-x }}
  182. \newdimen\metaxwidth
  183. \metaxwidth=\wd\metaxbox
  184. % metax - definition of a M-x command.
  185. % \metax{description of command}{M-x command-name}
  186. % Tries to justify the beginning of the command name at the same place
  187. % as \key starts the key name. (The "M-x " sticks out to the left.)
  188. \def\metax#1#2{\leavevmode\hbox to \hsize{\hbox to .75\hsize
  189. {\hskip\keyindent\relax#1\hfil}%
  190. \hskip -\metaxwidth minus 1fil
  191. \kbd{#2}\hfil}}
  192. % threecol - like "key" but with two key names.
  193. % for example, one for doing the action backward, and one for forward.
  194. \def\threecol#1#2#3{\hskip\keyindent\relax#1\hfil&\kbd{#2}\hfil\quad
  195. &\kbd{#3}\hfil\quad\cr}
  196. % I cannot figure out how to make all dired-x
  197. % commands fit on a page in two-column format
  198. \def\dx{{\bf (DX)}}
  199. \nopagenumbers
  200. %**end of header
  201. \title{Dired Reference Card}
  202. \centerline{(based on Dired in GNU Emacs \versionemacs)}
  203. \centerline{Commands marked with \dx{} require dired-x}
  204. % trim this down to fit everything on one page
  205. % \section{General}
  206. % In dired, you can edit a list of the files in a directory (and optionally
  207. % its subdirectories in the `ls -lR' format).
  208. % Editing a directory means that you can visit, rename, copy, compress,
  209. % load, byte-compile files. You can change files' attributes, run shell
  210. % commands on files, or insert subdirectories into the edit buffer. You can
  211. % "flag" files for deletion or "mark" files for later commands, either one
  212. % file at a time or by all files matching certain criteria (e.g., files that
  213. % match a certain regexp).
  214. % You move throughout the buffer using the usual cursor motion commands.
  215. % Letters no longer insert themselves, but execute commands instead. The
  216. % digits (0-9) are prefix arguments.
  217. % Most commands operate either on all marked files or on the current file if
  218. % no files are marked. Use a numeric prefix argument to operate on the next
  219. % ARG files (or previous ARG if ARG $<$ 0). Use the prefix argument `1' to
  220. % operate on the current file only. Prefix arguments override marks. Commands
  221. % which run a sub-process on a group of files will display a list of files
  222. % for which the sub-process failed. Typing y will try to tell
  223. % you what went wrong.
  224. % When editing several directories in one buffer, each directory acts as a
  225. % page, so C-x [ and C-x ] can be used to move between directories.
  226. \section{Entering and Exiting Dired}
  227. \key{run dired}{C-x d}
  228. \key{dired the directory of the file you are editing}{C-x C-j \dx}
  229. \key{quit dired}{q}
  230. \section{Motion Commands}
  231. \key{move up to previous line}{p}
  232. \key{move down to next line}{n}
  233. \key{move up to previous directory line}{<}
  234. \key{move down to next directory line}{>}
  235. \key{move to next marked file}{M-\}}
  236. \key{move to previous marked file}{M-\{}
  237. \key{move up to previous subdirectory}{M-C-p}
  238. \key{move down to next subdirectory}{M-C-n}
  239. \key{move to parent directory}{^}
  240. \key{move to first child subdirectory}{M-C-d}
  241. \section{Mouse Commands}
  242. \metax{visit file}{Mouse_Button_2}
  243. \metax{popup menu}{Control-Mouse_Button_3}
  244. \section{Immediate Actions on Files}
  245. \key{visit current file}{f}
  246. \key{view current file}{v}
  247. \key{visit current file in other window}{o}
  248. %% Huh?
  249. %% \key{visit current file in other frame}{w}
  250. %% Huh?
  251. %%\key{display current file}{C-u o}
  252. \key{create a new subdirectory}{+}
  253. \key{compare file at point with the one at mark}{=}
  254. \section{Marking and Unmarking Files}
  255. \key{mark a file or subdirectory for later commands}{m}
  256. \key{unmark a file or all files of a subdirectory}{u}
  257. \key{unmark all marked files in a buffer}{M-delete}
  258. \key{mark files with a given extension}{* .}
  259. \key{mark all directories}{* /}
  260. \key{mark all symlinks}{* @}
  261. \key{mark all executables}{* *}
  262. \key{invert marking}{* t}
  263. \key{mark all files in the current subdir}{* s}
  264. \key{mark file names matching a regular expression}{* \%}
  265. \key{change the marks to a different character}{* c}
  266. \key{mark files for which Elisp expression returns t}{* ( \dx}
  267. \section{Modifying the Dired Buffer}
  268. \key{insert a subdirectory into this buffer}{i}
  269. \key{remove marked files from the listing}{k}
  270. \key{remove a subdir listing}{C-u k}
  271. \key{re-read all directories (retains all marks)}{g}
  272. \key{toggle sorting of current subdir by name/date}{s}
  273. \key{edit ls switches}{C-u s}
  274. \key{recover marks, hidden lines, and such}{C-_}
  275. \key{hide all subdirectories}{M-\$}
  276. \key{hide or unhide subdirectory}{\$}
  277. \section{Commands on Files Marked or Specified by the Prefix}
  278. \key{copy file(s)}{C}
  279. \key{rename a file or move files to another directory}{R}
  280. \key{change ownership of file(s)}{O}
  281. \key{change the group of the file(s)}{G}
  282. \key{change mode of file(s)}{M}
  283. \key{print file(s)}{P}
  284. \key{convert filename(s) to lower case}{\% l}
  285. \key{convert filename(s) to upper case}{\% u}
  286. \key{delete marked (as opposed to flagged) files}{D}
  287. %% Huh?
  288. %%\key{uuencode or uudecode file(s)}{U}
  289. \key{compress or uncompress file(s)}{Z}
  290. %% Only uses the current file.
  291. \key{run info on file}{I \dx}
  292. \key{make symbolic link(s)}{S}
  293. \key{make relative symbolic link(s)}{Y}
  294. \key{make hard link(s)}{H}
  295. \key{search files for a regular expression}{A}
  296. \key{query replace regular expression}{Q}
  297. \key{byte-compile files}{B}
  298. \key{load files}{L}
  299. \key{shell command on file(s)}{!}
  300. \key{asynchronous shell command on file(s)}{\&}
  301. \section{Flagging Files for Deletion}
  302. \leftline{\bf Unmark commands remove delete flags}
  303. \key{flag file for deletion}{d}
  304. %% Huh?
  305. %%\key{backup and remove deletion flag}{delete}
  306. \key{flag all backup files (file names ending in \~{})}{\~{}}
  307. \key{flag all auto-save files}{\#}
  308. \key{flag various intermediate files}{\% \&}
  309. \key{flag numeric backups (ending in .\~{}1\~{}, .\~{}2\~{}, etc.)}{.}
  310. \key{execute the deletions requested (flagged files)}{x}
  311. \key{flag files matching a regular expression}{\% d}
  312. \section{Regular Expression Commands}
  313. \key{mark filenames matching a regular expression}{\% m}
  314. \key{copy marked files by regexp}{\% C}
  315. \key{rename marked files by regexp}{\% R}
  316. \key{hardlink}{\% H}
  317. \key{symlink}{\% S}
  318. \key{symlink, with relative paths}{\% Y}
  319. \key{mark for deletion}{\% d}
  320. \section{Dired and Find}
  321. \metax{dired file(s) whose name matches a pattern}{M-x find-name-dired}
  322. \metax{dired file(s) that contain pattern}{M-x find-grep-dired}
  323. \metax{dired file(s) based on \kbd{find} output}{M-x find-dired}
  324. \section{Getting Help}
  325. \key{dired help}{h}
  326. \key{dired summary (short help) and error log}{?}
  327. \copyrightnotice
  328. \bye