Skip to content

Instantly share code, notes, and snippets.

@tanyuan
Created March 10, 2016 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tanyuan/04845abdbe1b492ef900 to your computer and use it in GitHub Desktop.
Save tanyuan/04845abdbe1b492ef900 to your computer and use it in GitHub Desktop.
Emacs key bindings and troubleshooting

Emacs

Basic Key Bindings

  • Shortcut starts with C-x.

  • Command name starts with M-x.

  • Custom shortcut starts with C-c.

  • C-x C-c: Exit Emacs.

  • C-x C-f: Find file.

  • C-x C-s: Save file.

  • C-v: Page down.

  • M-v: Page up.

  • M-<: Go to the beginning of the file.

  • M->: Go to the end of the file.

  • C-/: Undo.

  • C-x u: show undo tree (if undo-tree installed)

  • C-g: Cancel any command. If you don't know what's happening, press this.

  • C-x 1: Make only one window visible.

  • C-x 2: Horizontal split.

  • C-x 3: Vertical split.

  • C-x 0: Kill this window.

  • C-Space: start selection.

  • C-x C-j: Go to dired (dired-x).

  • <XF86Forward>: C-x Left: Switch to previous buffer.

  • <XF86Back>: C-x Right: Switch to next buffer.

Get help

  • C-h f: help for function under cursor.
  • C-h k: help for given key binding.
  • C-h m: help for current major and minor mode key bindings.

Read Program Info

C-h i

M-x commands

  • linum-mode: show line numbers.

Org Mode

  • C-x C-j jump back to dired mode

Tasks

  • C-c C-t to toggle TODO

  • M-S-RET to insert TODO

  • C-c C-c to toggle check

  • M-S-RET to add

  • [ ] check box

  • C-c C-s schedule

  • C-c C-d deadline

Header

  • M-RET same level
  • C-RET same? level
  • M-LEFT/RIGHT move level
  • M-UP/DOWN move up and down
  • M-S-UP/DOWN move subtree line up and down
  • C-c C-c on header to tag
  • C-c C-q in text to tag
  • C-c / find todo or a tag
  • C-c C-j remember this place and C-c & to jump back

Org Mode Manual: Structure Editing

Fold

  • TAB fold
  • S-TAB fold all
  • C-x n s zoom in subtree
  • C-x n w zoom out subtree
  • C-c C-x b show subtree in another window
  • C-c C-k show children headers only

Org Mode Manual: Structure Editing

Image

[[./org-mode-unicorn-logo.png]]
  • Show image: org-toggle-inline-images

Link

[[http://orgmode.org/worg/org-tutorials/orgtutorial_dto.html][org tutorial]]

Table

  • C-c C-c update table

Comment

  • # Comment
  • C-c ; comment out

Code

  • <s TAB insert source
  • C-c ' edit code
  • C-c C-c back
#+BEGIN_SRC python

def func(arg):
    pass

#+END_SRC

Troubleshooting

Fix fcitx Chinese input method not working in GUI

cp /usr/share/applications/emacs.desktop ~/.local/share/applications/emacs.desktop

Edit the line to:

Exec=env LC_CTYPE=zh_TW.UTF-8 emacs %F
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment