Skip to content

Instantly share code, notes, and snippets.

@adamrenklint
Forked from dherman/emacs-cheat-sheet.md
Created October 13, 2016 14:14
Show Gist options
  • Save adamrenklint/f0c02cf1acb45004d3c33c42c9a80fca to your computer and use it in GitHub Desktop.
Save adamrenklint/f0c02cf1acb45004d3c33c42c9a80fca to your computer and use it in GitHub Desktop.

Revisions

  1. adamrenklint revised this gist Oct 13, 2016. 1 changed file with 1 addition and 5 deletions.
    6 changes: 1 addition & 5 deletions emacs-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,4 @@
    In penance for cracking [stupid jokes on Twitter](https://twitter.com/littlecalculist/status/231011706380374016), here's my Emacs cheat sheet. Emacs has a steep learning curve, so I've tried to order them by importance so you could learn them in stages.

    One overall rule of thumb: pay attention to the minibuffer (the line at the bottom of the editor). It will often guide you through a process, and also gives you hints about what state you're in, such as the middle of a multi-chord sequence.

    The other rule of thumb: when in doubt, **C-g** it out.
    Rule of thumb: when in doubt, **C-g** it out.

    # Basics (mandatory)

  2. Dave Herman revised this gist Aug 2, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion emacs-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -21,7 +21,7 @@ You simply can't get by without having these at your fingertips.

    # Getting around (really useful, worth learning)

    ## Navigation:
    ## Navigation

    * **C-a** - beginning of line
    * **C-e** - end of line
  3. Dave Herman revised this gist Aug 2, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion emacs-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -33,7 +33,7 @@ You simply can't get by without having these at your fingertips.
    * **M-f** - forward word
    * **M-b** - backward word

    * **S-_any of the above_** - navigate and select
    * **S-**_any of the above_ - navigate and select
    * **C-space** - start selection

    ## Cutting and pasting
  4. Dave Herman revised this gist Aug 2, 2012. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions emacs-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    In penance for cracking [stupid jokes on Twitter](https://twitter.com/littlecalculist/status/231011706380374016), here's my Emacs cheat sheet. Emacs has a steep learning curve, so I've tried to order them by importance so you could learn them in stages.

    One overall rule of thumb: pay attention to the minibuffer (the line at the bottom of the editor)! It will often guide you and give you hints whether you're in the middle of some multi-chord operation.
    One overall rule of thumb: pay attention to the minibuffer (the line at the bottom of the editor). It will often guide you through a process, and also gives you hints about what state you're in, such as the middle of a multi-chord sequence.

    The other rule of thumb: when in doubt, **C-g** it out.

    @@ -33,7 +33,7 @@ You simply can't get by without having these at your fingertips.
    * **M-f** - forward word
    * **M-b** - backward word

    * **S-[]*any of the above*[]** - navigate and select
    * **S-_any of the above_** - navigate and select
    * **C-space** - start selection

    ## Cutting and pasting
  5. Dave Herman revised this gist Aug 2, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion emacs-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -33,7 +33,7 @@ You simply can't get by without having these at your fingertips.
    * **M-f** - forward word
    * **M-b** - backward word

    * **S- *any of the above* ** - navigate and select
    * **S-[]*any of the above*[]** - navigate and select
    * **C-space** - start selection

    ## Cutting and pasting
  6. Dave Herman revised this gist Aug 2, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion emacs-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -33,7 +33,7 @@ You simply can't get by without having these at your fingertips.
    * **M-f** - forward word
    * **M-b** - backward word

    * **S-*any of the above* ** - navigate and select
    * **S- *any of the above* ** - navigate and select
    * **C-space** - start selection

    ## Cutting and pasting
  7. Dave Herman created this gist Aug 2, 2012.
    81 changes: 81 additions & 0 deletions emacs-cheat-sheet.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,81 @@
    In penance for cracking [stupid jokes on Twitter](https://twitter.com/littlecalculist/status/231011706380374016), here's my Emacs cheat sheet. Emacs has a steep learning curve, so I've tried to order them by importance so you could learn them in stages.

    One overall rule of thumb: pay attention to the minibuffer (the line at the bottom of the editor)! It will often guide you and give you hints whether you're in the middle of some multi-chord operation.

    The other rule of thumb: when in doubt, **C-g** it out.

    # Basics (mandatory)

    You simply can't get by without having these at your fingertips.

    * **C-x C-c** - quit
    * **C-x C-s** - save buffer
    * **C-x C-f** - open file
    * **C-x b** *buffer name* - switch to open buffer
    * **C-g** - cancel
    * **C-x k** - close current buffer
    * **C-h a** *command name* - look up docs for command
    * **M-x** *command name* - execute command
    * **C-x u** - undo
    * **C-/** - undo

    # Getting around (really useful, worth learning)

    ## Navigation:

    * **C-a** - beginning of line
    * **C-e** - end of line
    * **C-f** - forward character
    * **C-b** - backward character
    * **C-p** - down a line
    * **C-n** - up a line

    * **M-f** - forward word
    * **M-b** - backward word

    * **S-*any of the above* ** - navigate and select
    * **C-space** - start selection

    ## Cutting and pasting

    * **C-w** - cut
    * **C-y** - paste

    ## Search and replace

    * **C-s** - search
    * **M-%** - search and replace

    # More advanced editing

    ## Deletion and cutting

    * **C-d** - delete character ahead
    * **M-d** - delete word ahead
    * **backspace** - delete character behind
    * **M-backspace** - delete word behind
    * **C-k** - cut from cursor to end of line

    ## Insertion

    * **C-o** - insert newline after cursor

    ## Frames

    * **C-x 2** - split window horizontally
    * **C-x 3** - split window vertically
    * **C-x 1** - unsplit window
    * **C-x o** - switch to other pane in split window

    ## Tricks

    * **M-q** - auto-hard-wrap current paragraph
    * **C-t** - swap the two characters at the cursor
    * **M-u** - uppercase the word at the cursor
    * **M-l** - lowercase the word at the cursor
    * **C-u** *n* *char* - insert *n* copies of *char*

    # Power tools

    * **M-x** replace-regexp - search and replace by regexp (the quoting/escaping is so weird that this always takes me several tries)
    * **C-r t** - "string-rectangle" (this one's really weird but super useful sometimes; look up the docs)