\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{Amaroid} \pdfinfo{ /Title (emacs.pdf) /Creator (Cheatography) /Author (Amaroid) /Subject (Emacs Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{5E5BA8} \definecolor{LightBackground}{HTML}{F4F4F9} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Emacs Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Amaroid} via \textcolor{DarkBackground}{\uline{cheatography.com/19943/cs/2835/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}Amaroid \\ \uline{cheatography.com/amaroid} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Not Yet Published.\\ Updated 9th May, 2016.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{3} \begin{tabularx}{5.377cm}{x{1.9908 cm} x{2.9862 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Handling Files}} \tn % Row 0 \SetRowColor{LightBackground} `C-x C-f` {[}`C-f`{]} & Open file {[}without IDO{]} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} `C-x C-s` & Save file \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} `C-x C-w` & Save file as... \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} `C-x s` & Save all buffers \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} `C-x C-r` & Rename file \tn % Row Count 6 (+ 1) % Row 5 \SetRowColor{white} `C-x C-d` & Delete file \tn % Row Count 7 (+ 1) % Row 6 \SetRowColor{LightBackground} `C-x C-a` & Edit as root \tn % Row Count 8 (+ 1) % Row 7 \SetRowColor{white} `C-x {\emph{RET}} c` & Encoding for next command \tn % Row Count 10 (+ 2) % Row 8 \SetRowColor{LightBackground} `C-x {\emph{RET}} f` & Encoding for saving file \tn % Row Count 11 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.23965 cm} x{2.73735 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{TRAMP}} \tn % Row 0 \SetRowColor{LightBackground} /{[}user@{]}host:path & Remote access via SSH \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} /sudo::/path & Open as root \tn % Row Count 2 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.33919 cm} x{2.63781 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{General editing}} \tn % Row 0 \SetRowColor{LightBackground} `C-y` & Yank (paste) \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \{\{fa-ellipsis-h\}\} `M-y` & Cycle in kill ring \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \{\{fa-ellipsis-h\}\} `C-c y` & Browse kill ring \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} `C-{\emph{Spc}}` {[}`C-{\emph{Spc}}`{]} & Set mark {[}and deactivate it{]} \tn % Row Count 7 (+ 2) % Row 4 \SetRowColor{LightBackground} `C-u C-{\emph{Spc}}` & Jump to mark \tn % Row Count 8 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.79632 cm} x{4.18068 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Dired (open with C-x d)}} \tn % Row 0 \SetRowColor{LightBackground} C/R/D & Copy/rename/delete \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} !/\& & Shell command/asynchronous \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} Z & Compress/uncompress \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} M/G/O & Change mode/group/owner \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} A/Q & Search/replace \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} m/u/U & Mark/unmark/unmark all \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} + & New directory \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} g & Refresh \tn % Row Count 8 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.54287 cm} x{3.43413 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Frames}} \tn % Row 0 \SetRowColor{LightBackground} `C-x 0` & Close current frame \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} `C-x 1` & Close all except current frame \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} `C-x` \{`2` / `3`\} & Split frame \{horizontally/vertically\} \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} `C-{\emph{TAB}}` & Switch to next frame \tn % Row Count 6 (+ 1) % Row 4 \SetRowColor{LightBackground} `M-S-{\emph{arrows}}` & Resize frame \tn % Row Count 8 (+ 2) % Row 5 \SetRowColor{white} `C-c s a` & Scroll all frames simultaneously \tn % Row Count 10 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.74195 cm} x{3.23505 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Screens}} \tn % Row 0 \SetRowColor{LightBackground} `{\emph{F9}}` & Create new screen \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} `S-{\emph{F9}}` & Kill current screen \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} `M-1` ... `M-0` & Go to screen number 1 ... 10 \tn % Row Count 4 (+ 2) % Row 3 \SetRowColor{white} `C-z l` & List active screens \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} `C-z C-b` & Escreen menu \tn % Row Count 6 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.59264 cm} x{3.38436 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Desktops}} \tn % Row 0 \SetRowColor{LightBackground} `C-x x {\bf{r}}` & Load session \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} `C-x x {\bf{s}}` & Save current session \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} `C-x x {\bf{d}}` & Save current session \& clear \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} `C-x x {\bf{c}}` & Change session (save \& load) \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} `C-x x {\bf{n}}` & Show current session name \tn % Row Count 10 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.69218 cm} x{3.28482 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Google}} \tn % Row 0 \SetRowColor{LightBackground} `C-c g {\emph{RET}}` & Google search \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} `C-c g g` & Google search on cursor \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} `C-c g r` & Google C++ reference \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} `C-c g m` & Google maps search \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} `C-c t` & Google translate at point \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} `C-c T` & Google translate \tn % Row Count 6 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.64241 cm} x{3.33459 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Org-mode: General}} \tn % Row 0 \SetRowColor{LightBackground} {[}`S-`{]}`{\emph{TAB}}` & Fold/unfold {[}all{]} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} `M-{\emph{arrows}}` & Move/change indentation level \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} `M-S-{\emph{arrows}}` & ... for entire subtree \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} `C-c c` & Quickly capture a note \tn % Row Count 6 (+ 1) % Row 4 \SetRowColor{LightBackground} ... `C-c C-c` & ... save the note \tn % Row Count 7 (+ 1) % Row 5 \SetRowColor{white} ... `C-c C-k` & ... abort \tn % Row Count 8 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Org-mode: Lists}} \tn % Row 0 \SetRowColor{LightBackground} {\emph{`+ - }}`* & Un-ordered list \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} {\emph{`1. 1)`}} & Ordered list \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} {\emph{`term :: def`}} & Definition list \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} {\emph{`{[} {]}`}} & Checkbox \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} `C-c C-c` & Toggle checkbox \tn % Row Count 5 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Lists are recognized as sub-tasks for to-dos.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.39356 cm} x{3.58344 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Org-mode: To-dos}} \tn % Row 0 \SetRowColor{LightBackground} `C-c C-d` & Deadline for to-do item \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} `C-c C-s` & Schedule to-do item \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} `C-c C-t` & Rotate to-do state \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} `C-c ,` & Set to-do priority \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} `C-c a a` & Calendar-like agenda \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} `C-c a t` & Global to-do overview \tn % Row Count 6 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{`{[}/{]}` or `{[}\%{]}` in a to-do heading show subtask completion.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.9908 cm} x{2.9862 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Org-mode: Misc.}} \tn % Row 0 \SetRowColor{LightBackground} {[}{[}link{]}{[}text{]}{]} & Define a link \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} `C-c l` & Save current buffer as link \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} `C-c C-l` & Insert link \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} `C-c C-o` & Open link \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} `M-S-{\emph{left/up}}` & Kill table column/row \tn % Row Count 6 (+ 1) % Row 5 \SetRowColor{white} `M-S-{\emph{right/down}}` & Insert table column/row \tn % Row Count 8 (+ 2) % Row 6 \SetRowColor{LightBackground} `C-c C-e` & Export... \tn % Row Count 9 (+ 1) % Row 7 \SetRowColor{white} `C-c C-e t` & Insert options template \tn % Row Count 10 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{0.9954 cm} x{3.9816 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Programming}} \tn % Row 0 \SetRowColor{LightBackground} `C-c C-r` & Comment in/out a line or region \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} `{\emph{F3}}` & Next occurence of symbol \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} `S-{\emph{F3}}` & Previous occurence of symbol \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} `M-{\emph{F3}}` & Replace symbol \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} `M-\textasciicircum{}` & Jump to definition... \tn % Row Count 6 (+ 1) % Row 5 \SetRowColor{white} `C-c C-c` & {\bf{{[}Python{]}}} Execute buffer \tn % Row Count 8 (+ 2) % Row 6 \SetRowColor{LightBackground} `C-c !` & {\bf{{[}Python{]}}} Switch to interpreter \tn % Row Count 10 (+ 2) % Row 7 \SetRowColor{white} `C-c C-e` & {\bf{{[}Python{]}}} Help on symbol \tn % Row Count 12 (+ 2) % Row 8 \SetRowColor{LightBackground} `C-c C-x` & {\bf{{[}sh{]}}} Execute script \tn % Row Count 14 (+ 2) % Row 9 \SetRowColor{white} `C-c C-f` & {\bf{{[}HTML{]}}} Fold/unfold block \tn % Row Count 16 (+ 2) % Row 10 \SetRowColor{LightBackground} `C-c C-f` & {\bf{{[}JS{]}}} Fold/unfold all functions \tn % Row Count 18 (+ 2) % Row 11 \SetRowColor{white} `C-c C-t` & {\bf{{[}JS{]}}} Fold/unfold block comments \tn % Row Count 20 (+ 2) % Row 12 \SetRowColor{LightBackground} `C-c C-o` & {\bf{{[}JS{]}}} Fold/unfold at point \tn % Row Count 22 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.34379 cm} x{3.63321 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Flycheck}} \tn % Row 0 \SetRowColor{LightBackground} `{\emph{F5}}` & Jump to previous error \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} `{\emph{F6}}` & Jump to next error \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} `{\emph{F7}}` & List all errors \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} `S-{\emph{F7}}` & Toggle Flycheck mode \tn % Row Count 4 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.28942 cm} x{2.68758 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Magit (Open with {\emph{F4}})}} \tn % Row 0 \SetRowColor{LightBackground} `M-S` / `M-H` & Show/hide all diffs \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} `s` / `S` & Stage / Stage all \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} `u` / `U` & Unstage / Unstage all \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} `i` & Ignore untracked file \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} `k` & Delete file permanently \tn % Row Count 6 (+ 2) % Row 5 \SetRowColor{white} `c` & Open commit buffer \tn % Row Count 7 (+ 1) % Row 6 \SetRowColor{LightBackground} \{\{fa-ellipsis-h\}\} `C-c C-c` & Perform commit \tn % Row Count 9 (+ 2) % Row 7 \SetRowColor{white} `l l` / `l L` & List of revisions / Verbose list \tn % Row Count 11 (+ 2) % Row 8 \SetRowColor{LightBackground} `a` & Apply commit ("cherry-pick") \tn % Row Count 13 (+ 2) % Row 9 \SetRowColor{white} `v` & Revert commit \tn % Row Count 14 (+ 1) % Row 10 \SetRowColor{LightBackground} `X` & Revert all uncommitted changes \tn % Row Count 16 (+ 2) % Row 11 \SetRowColor{white} `P P` & Push current branch \tn % Row Count 17 (+ 1) % Row 12 \SetRowColor{LightBackground} `F F` & Pull current branch \tn % Row Count 18 (+ 1) % Row 13 \SetRowColor{white} `b` \{\{fa-ellipsis-h\}\} & Manipulate branches \tn % Row Count 20 (+ 2) % Row 14 \SetRowColor{LightBackground} `q` & Quit current Magit buffer \tn % Row Count 22 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Many commands can be used on parts of a diff, e.g. to stage or revert partial changes.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}