-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathemacs-cheatsheet.tex
168 lines (91 loc) · 3.22 KB
/
emacs-cheatsheet.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
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}