Skip to content

Instantly share code, notes, and snippets.

@yogidevbear
Last active November 14, 2023 15:35
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save yogidevbear/30b045e019b771a7555e6601e33838d2 to your computer and use it in GitHub Desktop.
Save yogidevbear/30b045e019b771a7555e6601e33838d2 to your computer and use it in GitHub Desktop.
Emacs keybinding cheatsheet
Keys Description
C Ctrl
M Alt
Helper functions:
C-h k key-binding Describe the function bound to the key binding. To get this to work, you actually perform the key sequence after typing C-h k.
C-h f Describe function.
Cider/REPL bindings:
M-x cider-jack-in Jack into the REPL
Window key bindings:
C-x o Switch cursor to another window. Try this now to switch between your Clojure file and the REPL.
C-x 1 Delete all other windows, leaving only the current window in the frame. This doesn’t close your buffers, and it won’t cause you to lose any work.
C-x 2 Split frame above and below.
C-x 3 Split frame side by side.
C-x 0 Delete current window. In Emacs, editing takes place in buffers.
Buffer key bindings
C-x b To switch to a buffer, use C-x b and enter the buffer name in the minibuffer.
... To create a new buffer, use C-x b and enter a new buffer name.
C-x C-f To open a file, use C-x C-f and navigate to the file.
... To create a new file, use C-x C-f and enter the new file’s path. When you save the buffer, Emacs will create the file on the filesystem.
C-x C-s To save a buffer to a file.
Navigation:
C-a Move to beginning of line.
M-m Move to first non-whitespace character on the line.
C-e Move to end of line.
C-f Move forward one character.
C-b Move backward one character.
M-f Move forward one word (I use this a lot).
M-b Move backward one word (I use this a lot, too).
C-s Regex search for text in current buffer and move to it. Press C-s again to move to next match.
C-r Same as C-s, but search in reverse.
M-< Move to beginning of buffer.
M-> Move to end of buffer.
M-g g Go to line.
Kill/yank key bindings:
C-spc Selection of regions
C-w Kill region.
M-w Copy region to kill ring.
C-y Yank.
M-y Cycle through kill ring after yanking.
M-d Kill word.
C-k Kill line.
Editing / Helping:
Tab Indent line.
C-j New line and indent, equivalent to enter followed by tab.
M-/ Hippie expand; cycles through possible expansions of the text before point.
M-\ Delete all spaces and tabs around point. (I use this one a lot.)
Clojure Buffer Key Bindings:
C-c M-n Switch to namespace of current buffer.
C-x C-e Evaluate expression immediately preceding point.
C-c C-k Compile current buffer.
C-c C-d C-d Display documentation for symbol under point.
M-. and M-, Navigate to source code for symbol under point and return to your original buffer.
C-c C-d C-a Apropros search; find arbitrary text across function names and documentation.
CIDER Buffer Key Bindings
C-↑, C-↓ Cycle through REPL history.
C-enter Close parentheses and evaluate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment