Emacs - shivamvats/notes GitHub Wiki

  1. Customization
  2. Org-mode
  3. Org-mode examples
  4. Spacemacs Lyers
  5. Pretty Org Agena'
  6. Evil Mode Guide

Installation

  • Switching between different distributions: Chemacs

Debugging

  • No such file sqlite: delete ~/.config/.local/straight/*/sqlite directory.

Elisp

  • Switch to lisp-interaction-mode to be able to run lisp code.
  • Go to the ending paran and run C-x C-e to evaluate the code and show the result in the bottom buffer.
  • Run ielm to enter elisp interactively.

Syntax

  • (setq var t) sets the value t to the variable var.
  • (fun t) calls the function foo with the parameter t.

General

  • Modes

    • Major Mode: Determines the behavior of shortcuts, highlighting, etc. It is often determined by the filetype. Can also be changed, e.g. M-x org-mode.
    • Minor Mode: Controls smaller features like linting and auto-complete. You can enable multiple of these at a time.
  • Hook: A hook is a Lisp variable that contains a list of functions that are run on well defined occasions, like, when exiting Emacs or initializing a major mode. The add-hook command adds a function to a hook: (add-hook 'text-mode-hook 'auto-fill-mode)

  • Shortcut Prefixes:

    • M-x call a command by name
    • C-x call a globally useful command
    • C-c call major-mode specific command
    • C-u n M-x foo call a command foo with the argument n
  • Buffers:

    • C-b N create new empty buffer
    • C-x b show all buffers
    • C-x 1 close all buffers except the current one
    • C-x 2 or C-x 3 horizontal (or vertical) split
  • M-x describe-bindings describe all keybindings

  • C-y: paste stuff (works for pasting a link from the clipboard in org mode)

  • M-$: fix spelling of word under cursor

Doom

  • <leader>.: Search for file
  • <leader>/: Search for reference in project
  • C-p: Search for file in project

Project Management

  • ,p: prefix for projectile
    • ,pp: switch to known project
    • ,pa: add new project
  • ,/: search for text in all project files

Plugins

  • treemacs: file explorer on the side

Org Mode

Editing

  • S-M-RET: Insert a todo below the current line.
  • C-c C-t : Change the done status of a todo.
  • M-RET : Insert a new heading, item or row.
  • M-RIGHT: Demote one level.
  • C-c .: Insert date and add to agenda
  • C-c !: Insert date but don't add to agenda
  • org-tree-to-indirect-buffer or ,bs: View only the current subtree in a new buffer.
  • C-c ,: Add priority to TODO.
  • C-c C-x C-t: Switch date format
  • org-store-link: Copy the location of a subheading
  • org-insert-link: Insert the copied link
  • C-c C-a: org-attach can attach files to tasks.
  • Table

    • C-c |: Insert new table
    • <W>: Add in a row to specify width of each column
    • TAB or RET or C-c C-c: Realign table
    • C-c TAB: Shrink/expand column

Motion

  • C-c C-f and C-c C-b: Go to next/previous heading at the same level
  • C-c C-u: Go to higher heading level

Files

  • \,: org-switchb switches to another org buffer.

Viewing

  • C-c a: Select agenda view
  • C-c / t: View a sparse todo tree of the current file
  • S-TAB to toggle the level of file outline
  • zc and zO to fold or expand a subtree
  • C-C C-x a: archive a sub-tree
  • C-c C-x C-v: inline mode for images
  • Column view

    • C-c C-x C-c: Open column view
    • S-<left> or S-<right> : To cycle through allowed values of an entry

Org Roam

  • M-x org-id-get-create: Add an id to a header that can be referenced.

Org Agenda

  • To add a TODO to your schedule, you need to org-schedule <,ds> or org-deadline <,dd> it.
  • C-c C-x C-i: Start the clock for a task.
  • C-c C-x C-o: Stop the clock for a task.

Org Capture

  • C-c M-w: refile a sub-tree
  • C-c c: Select capture template

Org Journal

Org Biblio

Using doom's org-biblio package along with zotero's better bibtex plugin for reference management. See tutorial for details.

  • org-cite-insert or \@ to insert a citation.
  • citar-open-entry to open reference in zotero
  • citar-open to open reference
  • citar-open-notes or ,nb to open or create paper org-roam note
⚠️ **GitHub.com Fallback** ⚠️