Emacs - shivamvats/notes GitHub Wiki
- Switching between different distributions: Chemacs
-
No such file sqlite
: delete~/.config/.local/straight/*/sqlite
directory.
- 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.
-
(setq var t)
sets the valuet
to the variablevar
. -
(fun t)
calls the functionfoo
with the parametert
.
-
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.
-
Major Mode: Determines the behavior of shortcuts, highlighting, etc. It is often determined by the filetype. Can also be changed, e.g.
-
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 argumentn
-
-
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
orC-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
-
<leader>.
: Search for file -
<leader>/
: Search for reference in project -
C-p
: Search for file in project
-
,p
: prefix for projectile-
,pp
: switch to known project -
,pa
: add new project
-
-
,/
: search for text in all project files
-
treemacs
: file explorer on the side
-
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. -
-
C-c |
: Insert new table -
<W>
: Add in a row to specify width of each column -
TAB
orRET
orC-c C-c
: Realign table -
C-c TAB
: Shrink/expand column
-
-
C-c C-f
andC-c C-b
: Go to next/previous heading at the same level -
C-c C-u
: Go to higher heading level
-
\,
:org-switchb
switches to another org buffer.
-
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
andzO
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 -
-
C-c C-x C-c
: Open column view -
S-<left>
orS-<right>
: To cycle through allowed values of an entry
-
-
M-x org-id-get-create
: Add an id to a header that can be referenced.
- To add a TODO to your schedule, you need to
org-schedule <,ds>
ororg-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.
-
C-c M-w
: refile a sub-tree -
C-c c
: Select capture template
- Preferences
-
SPC a o j
: Base command
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