Skip to content

Instantly share code, notes, and snippets.

@ivan-loh
Created October 4, 2015 13:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivan-loh/77a30de071e1aab17eca to your computer and use it in GitHub Desktop.
Save ivan-loh/77a30de071e1aab17eca to your computer and use it in GitHub Desktop.
Prelude Shortcuts

Getting to know Prelude

Certainly the best way to understand how Prelude enhances the default Emacs experience is to peruse Prelude's source code (which is obviously written in Emacs Lisp). Understanding the code is not necessary of course. Prelude includes a prelude-mode minor Emacs mode which collects some of the additional functionality added by Prelude. It also adds an additional keymap that binds many of those extensions to keybindings.

Keymap

Global

Keybinding Description
C-x \ align-regexp
C-+ Increase font size(text-scale-increase).
C-- Decrease font size(text-scale-decrease).
C-x O Go back to previous window (the inverse of other-window (C-x o)).
C-^ Join two lines into one(prelude-top-join-line).
C-x p Start proced (manage processes from Emacs; works only in Linux).
C-x m Start eshell.
C-x M-m Start your default shell.
C-x C-m Alias for M-x.
M-X Like M-x but limited to commands that are relevant to the active major mode.
C-h A Run apropos (search in all Emacs symbols).
C-h C-m Display key bindings of current major mode and descriptions of every binding.
M-/ Run hippie-expand (a replacement for the default dabbrev-expand).
C-x C-b Open ibuffer (a replacement for the default buffer-list).
F11 Make the window full screen.
F12 Toggle the Emacs menu bar.
C-x g Open Magit's status buffer.
C-x M-g Open Magit's popup of popups.
M-Z Zap up to char.
C-= Run expand-region (incremental text selection).
C-a Run prelude-move-beginning-of-line. Read this for details.

Prelude Mode

Keybinding Description
C-c o Open the currently visited file with an external program.
C-c i Search for a symbol, only for buffers that contain code
C-c g Search in Google for the thing under point (or an interactive query).
C-c G Search in GitHub for the thing under point (or an interactive query).
C-c y Search in YouTube for the thing under point (or an interactive query).
C-c U Search in Duckduckgo for the thing under point (or an interactive query).
C-S-RET or Super-o Insert an empty line above the current line and indent it properly.
S-RET or M-o Insert an empty line and indent it properly (as in most IDEs).
C-S-up or M-S-up Move the current line or region up.
C-S-down or M-S-down Move the current line or region down.
C-c n Fix indentation in buffer and strip whitespace.
C-c f Open recently visited file.
C-M-\ Indent region (if selected) or the entire buffer.
C-c u Open a new buffer containing the contents of URL.
C-c e Eval a bit of Emacs Lisp code and replace it with its result.
C-c s Swap two active windows.
C-c D Delete current file and buffer.
C-c d Duplicate the current line (or region).
C-c M-d Duplicate and comment the current line (or region).
C-c r Rename the current buffer and its visiting file if any.
C-c t Open a terminal emulator (ansi-term).
C-c k Kill all open buffers except the one you're currently in.
C-c TAB Indent and copy region to clipboard
C-c I Open user's init file.
C-c S Open shell's init file.
C-c . + Increment integer at point. Default is +1.
C-c . - Decrement integer at point. Default is -1.
C-c . * Multiply integer at point. Default is *2.
C-c . / Divide integer at point. Default is /2.
C-c . \ Modulo integer at point. Default is modulo 2.
C-c . ^ Power to the integer at point. Default is ^2.
C-c . < Left-shift integer at point. Default is 1 position to the left.
C-c . > Right-shift integer at point. Default is 1 position to the right.
C-c . # Convert integer at point to specified base. Default is 10.
C-c . % Replace integer at point with another specified integer.
C-c . ' Perform arithmetic operations on integer at point. User specifies the operator.
Super-g Toggle between God mode and non-God mode
Super-r Recent files
Super-j Join lines
Super-k Kill whole line
Super-m m Magit status
Super-m l Magit log
Super-m f Magit file log
Super-m b Magit blame mode

Note: For various arithmetic operations, the prefix C-c . only needs to be pressed once for the first operation. For subsequent operations, only the appropriate operations (i.e. +, -, *, /... needs to be pressed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment