Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
00-matt committed Dec 17, 2019
0 parents commit a296098
Show file tree
Hide file tree
Showing 4 changed files with 217 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.aux
*.log
*.pdf
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# emacs-cheatsheet

Mini guide to Emacs keyboard shortcuts.

### Building

1. Install dependencies:

sudo apt install git texlive

2. Grab the source:

git clone https://github.com/00-matt/emacs-cheatsheet.git

3. Build the PDF:

pdflatex emacs-cheatsheet.tex

### License

Released under the terms of the [Unlicense](https://unlicense.org).
Do whatever you want.
24 changes: 24 additions & 0 deletions UNLICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to <http://unlicense.org/>
168 changes: 168 additions & 0 deletions emacs-cheatsheet.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
\documentclass[12pt,a4paper]{article}

\usepackage[margin=1cm,landscape]{geometry}
\usepackage{flowfram}
\usepackage{lipsum}

\Ncolumn{3}
\ffvadjustfalse
\setlength{\columnsep}{1cm}
\setlength{\parindent}{0cm}

\newcommand{\keyboardshortcut}[2]{#1 \hfill \texttt{#2}}

\begin{document}

\begin{center}{\Huge Emacs Cheatsheet}\end{center}

\section*{General}

\keyboardshortcut{Exit Emacs}{C-x C-c}

\keyboardshortcut{Open a file}{C-x C-f}

\keyboardshortcut{Kill a buffer}{C-x k}

\keyboardshortcut{Switch buffer}{C-x b}


\section*{Movement}

\keyboardshortcut{Go to start of line}{C-a}

\keyboardshortcut{Go to end of line}{C-e}

\keyboardshortcut{Move forwards one character}{C-f}

\keyboardshortcut{Move backwards one character}{C-b}

\keyboardshortcut{Move forwards one word}{M-f}

\keyboardshortcut{Move backwards one word}{M-b}

\keyboardshortcut{Move up one line}{C-p}

\keyboardshortcut{Move down one line}{C-n}

\keyboardshortcut{Go to start of file}{M-<}

\keyboardshortcut{Go to end of file}{M->}

\keyboardshortcut{Go to line}{M-g g}


\section*{Scrolling}

\keyboardshortcut{Scroll down one screenful}{C-v}

\keyboardshortcut{Scroll up one screenful}{M-v}

\keyboardshortcut{Adjust to current line}{C-l}


\section*{Searching}

\keyboardshortcut{Search forwards}{C-s}

\keyboardshortcut{Search backwards}{C-r}


\section*{Killing and Yanking}

\keyboardshortcut{\textbf{Delete} next character}{C-d}

\keyboardshortcut{Kill next word}{M-d}

\keyboardshortcut{Kill previous word}{M-DEL}

\keyboardshortcut{Kill to end of line}{C-k}

\keyboardshortcut{Kill to beginning of line}{M-0 C-k}

\keyboardshortcut{Kill selection}{C-w}

\keyboardshortcut{Yank previous kill}{C-y}


\section*{Marking}

\keyboardshortcut{Start marking at cursor}{C-SPC}

\keyboardshortcut{Swap cursor and mark start}{C-x C-x}

\keyboardshortcut{Mark function}{C-M-h}

\keyboardshortcut{Mark buffer}{C-x h}

\keyboardshortcut{Mark next 5 words}{M-5 M-@}

\section*{Registers}

\keyboardshortcut{Save cursor position}{C-x r SPC}

\keyboardshortcut{Retrieve cursor position}{C-x r j}

\keyboardshortcut{Save selection}{C-x r s}

\keyboardshortcut{Insert from register}{C-x r i}

\section*{Macros}

\keyboardshortcut{Start recording a macro}{C-x (}

\keyboardshortcut{Stop recording a macro}{C-x )}

\keyboardshortcut{Replay last macro}{C-x e}


\vfill\null
\section*{Rectangles}

Create a rectangle by marking one corner and placing the cursor at the other.

\medskip
\keyboardshortcut{Kill rectangle}{C-x r k}

\keyboardshortcut{Yank rectangle}{C-x r y}

\keyboardshortcut{Clear rectangle}{C-x r c}

\keyboardshortcut{Prefix rectangle}{C-x r t}


\section*{Elisp}

\keyboardshortcut{Eval expression before cursor}{C-x C-e}

\keyboardshortcut{Evaluate buffer}{M-x eval-buffer}

\medskip
\textbf{Example:} Adding a keybind to save and load cursor position
from register.

\begin{verbatim}
;;; ~/.emacs.d/init.el
(global-set-key
(kbd "C-c s")
(lambda ()
(interactive)
(point-to-register 'a)))
(global-set-key
(kbd "C-c f")
(lambda ()
(interactive)
(jump-to-register 'a)))
\end{verbatim}


\section*{Getting Help}

\keyboardshortcut{Open tutorial}{C-h t}

\keyboardshortcut{Show keybind}{C-h k}

\keyboardshortcut{Show Elisp function}{C-h f}

\keyboardshortcut{Show mode help}{C-h m}

\end{document}

0 comments on commit a296098

Please sign in to comment.