nix/docs/emacs.md

366 lines
7.8 KiB
Markdown

# Emacs Configuration
## General
| Key | Action |
|-----|--------|
| `ESC` | Keyboard escape quit |
| `C-x c` | Compile |
| `C-=` | Zoom in |
| `C--` | Zoom out |
## Window Management
| Key | Action |
|-----|--------|
| `C-x 0` | Delete window (balanced) |
| `C-x 2` | Split vertical (balanced) |
| `C-x 3` | Split horizontal (balanced) |
| `C-x C-o` | Ace window (jump to window) |
| `C-c <left>` | Move to left window |
| `C-c <right>` | Move to right window |
| `C-c <up>` | Move to upper window |
| `C-c <down>` | Move to lower window |
## Buffers & Files
| Key | Action |
|-----|--------|
| `C-x b` | Switch buffer (consult) |
| `C-x 4 b` | Switch buffer other window |
| `C-x 5 b` | Switch buffer other frame |
| `C-x t b` | Switch buffer other tab |
| `C-x r b` | Consult bookmark |
| `C-x p b` | Consult project buffer |
| `C-x -` | Dired jump |
| `C-x e` | Dired jump |
## Search & Navigation
| Key | Action |
|-----|--------|
| `M-s d` | Find file (consult-find) |
| `M-s c` | Locate file |
| `M-s g` | Grep |
| `M-s G` | Git grep |
| `M-s r` | Ripgrep |
| `M-s l` | Search line |
| `M-s L` | Search line multi-buffer |
| `M-s k` | Keep lines matching |
| `M-s u` | Focus lines matching |
| `M-s e` | Isearch history |
| `M-g g` | Go to line |
| `M-g M-g` | Go to line |
| `M-g o` | Outline |
| `M-g m` | Mark |
| `M-g k` | Global mark |
| `M-g i` | Imenu |
| `M-g I` | Imenu multi-buffer |
| `M-g e` | Compile error |
| `M-g f` | Flymake diagnostics |
## Embark
| Key | Action |
|-----|--------|
| `C-.` | Embark act |
| `C-;` | Embark dwim |
| `C-h B` | Embark bindings |
## Editing
### Undo
| Key | Action |
|-----|--------|
| `C-M-u` | Undo tree visualize |
| `M-_` | Undo tree redo |
| `M--` | Go back to last edit |
### Multiple Cursors
| Key | Action |
|-----|--------|
| `C-S-c C-S-c` | Edit lines |
| `C-M-SPC` | Set rectangular region |
| `C->` | Mark next like this |
| `C-<` | Mark previous like this |
| `C-c C-<` | Mark all like this |
| `C-"` | Skip to next like this |
| `C-:` | Skip to previous like this |
### Move Text
| Key | Action |
|-----|--------|
| `M-p` | Move line/region up |
| `M-n` | Move line/region down |
### Registers & Yank
| Key | Action |
|-----|--------|
| `M-y` | Yank pop (consult) |
| `M-#` | Register load |
| `M-'` | Register store |
| `C-M-#` | Register |
## Consult
| Key | Action |
|-----|--------|
| `C-c M-x` | Mode command |
| `C-c h` | History |
| `C-c k` | Kmacro |
| `C-c m` | Man page |
| `C-c i` | Info |
| `C-x M-:` | Complex command |
## Dired
| Key | Action |
|-----|--------|
| `C-x -` | Dired jump |
| `C-x e` | Dired jump |
### In Dired Mode
| Key | Action |
|-----|--------|
| `-` | Up directory |
| `W` | Copy path at point |
## Git (Magit)
| Key | Action |
|-----|--------|
| `C-x g` | Magit status |
---
## Notes & Org
### Directory Structure
- `~/NPersonal/agenda.org` - All tasks (Inbox, Tasks, Meetings)
- `~/NPersonal/archive.org` - Completed/archived items
- `~/NPersonal/*.md` - Denote markdown notes
- `~/NPersonal/journal/` - Journal entries
### agenda.org Structure
```org
* Inbox <- quick captures
* Tasks <- organized tasks
* Meetings <- meetings
```
### Org Agenda
| Key | Action |
|-----|--------|
| `C-c a` | Open agenda dispatcher |
| `C-c c` | Capture (quick note/todo) |
| `C-c l s` | Store link |
| `C-c l i` | Insert link |
#### Agenda Views (`C-c a` then...)
| Key | View |
|-----|------|
| `n` | Dashboard |
| `w` | Week view |
| `i` | Inbox |
| `p` | Projects |
#### In Agenda View
| Key | Action |
|-----|--------|
| `n` / `p` | Next / previous item |
| `t` | Cycle TODO state |
| `RET` | Go to item |
| `q` | Quit agenda |
### Org Mode
| Key | Action |
|-----|--------|
| `C-c C-t` | Cycle TODO state |
| `C-c C-s` | Schedule |
| `C-c C-d` | Set deadline |
| `C-c C-w` | Refile to another file/heading |
| `C-c C-x C-a` | Archive subtree |
### Capture Templates (`C-c c`)
| Key | Action |
|-----|--------|
| `c` | Quick capture to Inbox |
| `r` | Capture with reference |
| `t` | Task |
| `m` | Meeting |
| `e i` | Email to Inbox |
| `e t` | Email to Tasks |
| `e f` | Email follow-up with deadline |
### Denote (Markdown Notes)
Notes are saved as: `20241226T123456--title__keyword1_keyword2.md`
| Key | Action |
|-----|--------|
| `C-c n n` | Create new note |
| `C-c n f` | Find or create note |
| `C-c n d` | Sort dired |
| `C-c n i` | Insert link to note |
| `C-c n l` | Show backlinks |
| `C-c n r` | Rename file |
| `C-c n R` | Rename using front matter |
| `C-c n k` | Add keyword |
| `C-c n K` | Remove keyword |
| `C-c n b` | Backlinks for org heading |
| `C-c n h` | Link to org heading |
### Denote Journal
| Key | Action |
|-----|--------|
| `C-c n j` | New journal entry |
| `C-c n J` | New or existing journal entry |
### Denote Sequence
| Key | Action |
|-----|--------|
| `C-c n s s` | New sequence note |
| `C-c n s c` | New child of current |
| `C-c n s S` | New sibling of current |
| `C-c n s f` | Find sequence |
| `C-c n s l` | Link sequence |
| `C-c n s d` | Sequence dired |
### Denote Explore
| Key | Action |
|-----|--------|
| `C-c n e c` | Count notes |
| `C-c n e C` | Count keywords |
| `C-c n e b` | Barchart keywords |
| `C-c n e e` | Barchart filetypes |
| `C-c n e r` | Random note |
| `C-c n e l` | Random link |
| `C-c n e k` | Random keyword |
| `C-c n e x` | Random regex |
| `C-c n e d` | Identify duplicates |
| `C-c n e z` | Zero keywords |
| `C-c n e s` | Single keywords |
| `C-c n e o` | Sort keywords |
| `C-c n e w` | Rename keyword |
| `C-c n e n` | Network visualization |
| `C-c n e v` | Regenerate network |
| `C-c n e D` | Barchart degree |
### Archive
Completed tasks go to `archive.org` under `* Archived` heading.
- `C-c C-x C-a` - Archive current subtree
- `C-c C-w` then select `archive.org` - Refile to archive
---
## Email (mu4e)
### Launch
| Key | Action |
|-----|--------|
| `C-c e` | Open mu4e |
### Main View
| Key | Action |
|-----|--------|
| `U` | Update mail (run mbsync) |
| `j` | Jump to maildir |
| `s` | Search |
| `b` | Bookmarks |
| `C` | Compose new message |
| `;` | Switch context (account) |
| `q` | Quit mu4e |
### Headers View (Message List)
| Key | Action |
|-----|--------|
| `n` / `p` | Next / previous message |
| `RET` | View message |
| `d` | Mark for trash |
| `D` | Mark for delete |
| `t` | Mark for action (prompts) |
| `T` | Mark all for action |
| `u` | Unmark |
| `m` | Move to folder |
| `e` | Refile (archive) |
| `+` / `-` | Mark / unmark flag |
| `!` | Mark as read |
| `?` | Mark as unread |
| `r` | Reply |
| `R` | Reply all |
| `F` | Forward |
| `x` | Execute marked actions |
| `U` | Unmark all |
| `%` | Mark by pattern |
| `g` | Rerun search |
| `q` | Quit to main view |
### Message View
| Key | Action |
|-----|--------|
| `n` / `p` | Next / previous message |
| `SPC` / `DEL` | Scroll down / up |
| `r` | Reply |
| `R` | Reply all |
| `F` | Forward |
| `o` | Open attachment |
| `e` | Refile (archive) |
| `a` | View action (open in browser, etc.) |
| `#` | Toggle citation folding |
| `.` | Raw view |
| `h` | Toggle headers |
| `q` | Return to headers |
### Compose
| Key | Action |
|-----|--------|
| `C-c C-c` | Send message |
| `C-c C-k` | Kill (discard) message |
| `C-c C-d` | Save as draft |
| `C-c C-a` | Attach file |
| `C-c C-s` | GPG sign message |
| `C-c C-e` | GPG encrypt message |
### Bookmarks (from main view, press `b`)
| Key | Action |
|-----|--------|
| `u` | Unread messages |
| `t` | Today's messages |
| `w` | Last 7 days |
| `i` | UChicago Inbox |
| `p` | Personal Inbox |
### Search Tips
- `from:john` - messages from john
- `to:jane` - messages to jane
- `subject:meeting` - subject contains meeting
- `flag:unread` - unread messages
- `flag:attach` - messages with attachments
- `date:today..now` - today's messages
- `date:7d..now` - last 7 days
- `maildir:/uchicago/Inbox` - specific maildir
- `AND`, `OR`, `NOT` - boolean operators