Emacs

Many of these commands are specific to my Emacs configuration.

Global Commands

Note that C- and M- mean Control- and Meta- respectively. To quit a partially entered command, type C-g. To open the emacs tutorial, type C-g t.

Navigation

Command Description
C-b/C-f Cursor backward/forward
C-a/C-e Line beginning/end
C-p/C-n Line previous/next
C-v/M-v Next/previous screen
C-l Center on cursor
C-s/C-r Search forward/backward
M-b/M-f Word backward/forward
M-a/M-e Sentence beginning/end
M-</M-> Document beginning/end
M-g M-g Go to line
C-u C-<space> Pop the mark (go back to previous location)

Editing

Command Description
C-j New line and indent
C-d Delete next character
C-<delete> Delete previous word
C-k Kill to end of line
C-y Yank (paste)
C-/ Undo
C-<space> Set mark at cursor
C-g Deactivate mark
C-w Kill region
M-w Copy region
C-x h Mark whole buffer
C-x C-=/- Increase/decrease buffer text size
M-^ Join lines
M-l Convert following word to lower case
M-u Convert following word to upper case
M-c Capitalize the following word
C-x C-l Convert region to lower case
C-x C-u Convert region to upper case
M-; Comment out region
M-x whitespace-cleanup Automatically remove trailing whitespace

Buffers/Files/Windows

Command Description
C-x C-f Open file
C-x C-s Save file
C-x C-c Close Emacs
C-x C-b Buffer list
C-x b Buffer switch to
C-x k Kill buffer
C-x o Move to other window
C-x 0 Delete selected window
C-x 1 Delete other windows
C-x 2 Split horizontally
C-x 3 Split vertically
C-M-v Scroll other window

Keyboard Macros

Command Description
C-x ( Start defining keyboard macro
C-x ) Stop defining keyboard macro
C-x e Execute keyboard macro

Extensions

Command Description
M-x list-packages Show available packages

Packages

Avy

Command Description
C-' <char> Input a character and jump to it
C-: <char> Input two characters and jump to them

dumb-jump

Command Description
C-M-g Jump to the definition for the thing under point.
C-M-p Jump back to where you were when you jumped.

Elpy

Elpy is a Python development environment for Emacs.

Elpy Navigation

Command Description
M-. Go to definition
C-c C-f Find a file in the current project
C-c C-o Display classes and functions in the current buffer
C-c C-d Find documentation for object at point

Elpy Interpreter

Command Description
C-c C-z Switch to (and start) Python interpreter
C-c C-k Kill the Python interpreter
C-<return> Send statement to the Python interpreter
C-c C-c Send region or entire buffer to the Python interpreter
M-x pyvenv-activate Activate a virtual environment
M-X pyvenv-deactivate Deactivate a virtual environment
M-X pyvenv-restart Restart Python (useful if venv was activated late)

Elpy Testing

Command Description
C-c C-t Start a test run
M-x elpy-set-test-runner Change the current test runner

Helm

Helm is an incremental completion and selection narrowing framework for Emacs. I've C-x C-f, M-x, C-x b, and M-y to Helm commands. helm-mode allows a series of commands.

Command Description
C-n/C-p Next/previous item
C-l Go up a directory
C-<space> Mark candidates
M-a Select all

Indium

Indium is a JavaScript development environment for Emacs.

Command Description
C-c C-z Launch Indium.
C-x C-e Evaluate expression preceding the point.
C-M-x Evaluate function enclosing the point.
C-c C-c Evaluate region.

Configuration File

Indium requires a .indium.json file in the root folder of your JavaScript project. See the Indium documentation for more information.

{
  "configurations": [
    {
      "name": "Project",
      "type": "node",
      "command": "node"
    }
  ]
}

The type attribute may be "node" or "chrome".

Org mode

Headings: * for h1, * for h2, etc. Formatting: *bold, italics

Command Description
<tab> (on heading) Expand/collapse section
C-<enter> New heading of same level
C-c C-n/p Next/previous heading
C-c <bar> Create a new table
<tab> (in table) Move to next cell in table
"<s" <tab> New code snippet
C-c ' Edit snippet in native mode
C-c C-e Dispatch for export
M-<enter> New list item at current level

Clocking

Command Description
C-c C-x C-i Start clock on current item
C-c C-x C-o Stop clock on current item
C-c C-c Recompute the time interval (afer changing one of the time stamps)
C-c C-x C-q Cancel current clock
C-c C-x C-r Generate dynamic block containing a clock report
C-C C-c Update dynamic block at point

Paredit

Command Description
M-( Wrap parens around an sexp
M-" Wrap quotes around an sexp
C-) "Slurp" forward. Pull in sexp on right
C-( "Slurp" backward. Pull in sexp on left
C-} "Barf" forward. Push out last sexp
C-{ "Barf" backward. Push out first sexp

Projectile

Command Description
C-c p f Find file in current project
C-c p p Switch project
C-c p s g Grep in project

Restclient

Explore and test REST services with Emacs. Run queries from a plain-text file and display output.

Restclient Commands

Command Description
C-c C-c Run query under cursor.
C-c C-p Jump to previous query.
C-c C-n Jump to next query.
C-c C-u Copy as cURL command.

Restclient Example

# -*- Restclient -*-

#
# GET request. Note that comments act as separators.
#
GET https://api.github.com
User-Agent: Emacs Restclient

#
# POST request. Entity goes after an empty line. Same for PUT.
#
POST https://fake.api.com/rest/api/1/search
Content-Type: application/json

{
        "user": "John",
        "text": "Test query"
}

#
# Declare and use variables.
#
:word = anthropomorphic
:number = (+ 1 2)

GET http://www.dictionary.com/api/:word/:number

Slime

Run slime with M-x slime. See Peter Christensen's cheat sheet for more commands.

Compilation/Evaluation

Command Description
C-c C-k Compile and load entire file
C-c C-c Compile the toplevel form
C-x C-e Evaluate last expression
C-c M-c Remove all compilation notes

REPL

Command Description
C-c M-p Set current REPL package
M-p/M-n REPL: Go to previous/next input
C-c C-c REPL: Interrupt
TAB REPL: Complete symbol at point

Editing

Command Description
C-c C-d h Hyperspec lookup
C-c C-w c Show function callers
C-c < List callers of a function
C-c > List callees of a function
M-. Go to definition
M-, Return from definition to examined symbol
M-TAB Complete symbol
C-c M-i Fuzzy complete
C-c C-s Insert arglist

YASnippet

Templating system for Emacs. Type a trigger key then hit TAB to expand a snippet. By default, snippets are stored in .emacs.d/snippets

Command Description
M-x yas-new-snippet Create a new snippet

See the documentation for instructions on creating snippets.

Configuration

My Emacs configuration can be found on GitHub.