Dired

  • C-x d dired

  • C-x 4 d dired-other-window

  • C-x 5 d dired-other-frame

  • C-x C-d list-directory

  • C-x C-f find-file

  • C-x 4 C-f find-file-other-window

  • C-x 5 C-f find-file-other-frame

wildcard

1
C-x d ~/**/*/*.el RET

Deleteing files with Dired

  • d Flag this file for deletion (dired-flag-file-deletion).

  • u Remove the deletion flag (dired-unmark).

  • DEL Move point to previous line and remove the deletion flag on that line (dired-unmark-backward).

  • x Delete files flagged for deletion (dired-do-flagged-delete).

1
2
3
4
5
6
7
C-x d # open dired
d # flag files for deletion
u # remove the deletion flag
x # delete flagged files
yes # confirm
no # cacel
C-g # quit

Visiting Files in Dired

  • RET Visit the file described on the current line, like typing C-x C-f and supplying that file name (dired-find-file)

  • SHIFT+RET uses another window to display the file’s buffer (dired-find-file-other-window)

  • g o View the file described on the current line, with View mode (dired-view-file)

  • g O dired-find-file-other-window

  • ^ Visit the parent directory of the current directory (dired-up-directory). This is equivalent to moving to the line for .. and typing f there.

Mark

  • m dired-mark

  • u Remove any mark on this line (dired-unmark)

  • U Remove all marks from all the files in this Dired buffer (dired-unmark-all-marks).

Operating on marked Files

  • C Copy the specified files (dired-do-copy)

  • D Delete the specified files (dired-do-delete). This is like the shell command rm.

  • R Rename the specified files (dired-do-rename)

  • H Make hard links to the specified files (dired-do-hardlink).This is like the shell command ln.

  • S Make symbolic links to the specified files (dired-do-symlink). This is like ‘ln -s’

  • M Change the mode (also called permission bits) of the specified files (dired-do-chmod).

  • G Change the group of the specified files to newgroup (dired-do-chgrp).

  • O Change the mode (also called permission bits) of the specified files (dired-do-chmod).

read more: https://www.gnu.org/software/emacs/manual/html_node/emacs/Operating-on-Files.html

Subdirectories in Dired

  • I Insert the contents of a subdirectory later in the buffer. (dired-maybe-insert-subdir)

  • r update the subdirectory’s contents (dired-do-redisplay)

  • g $ Hide or show the subdirectory that point is in, and move point to the next subdirectory (dired-hide-subdir).

  • M-$ Hide all subdirectories in this Dired buffer, leaving only their header lines (dired-hide-all).

  • (dired-hide-details-mode)

Bindings

  • help

    • C-h b describe-bindings

    • C-h C-h, view a list of all help features

  • C-x 0 delete-window

  • C-x 1 delete-other-windows

  • C-n completion-at-point

  • C-g evil-normal-state

  • C-; embark-ack

    • E embark-export

  • Vertico (Vertical completion UI)

    • C-j vertico-next

    • C-k vertico-previous

    • C-f vertico-exit

    • C-<return> vertico-exit-input

    • TAB vertico-insert

  • corfu (completion-in-region)

    • C-j corfu-next

    • C-n corfu-next

    • C-k corfu-previous

    • C-p corfu-previous

  • consult

    • C-s consult-line

    • C-M-s consult-repgrep

    • C-x b consult-buffer

    • C-M-l consult-imenu

    • C-r consult-history

    • C-r consult-history (minibuffer-local-map)

  • org

    • C-c C-v t org-babel-tangle

    • C-c o l org-toggle-link-display

    • C-k outline-backward-same-level

    • C-j outline-forward-same-level

  • org-roam

    • C-c n l org-roam-buffer-toggle

    • C-c n f org-roam-node-find

    • C-c n i org-roam-node-insert

  • projectil

    • C-c p projectile-command-map

      • C-c p p projectile-switch-project

      • C-c p f projectile-find-file

    • C-S-s projectile-ripgrep

  • eglot

    • C-t xref-pop-marker-stack

    • C-h . eldoc-doc-buffer

    • K eldoc-doc-buffer

    • g Prefix Command

      • g d xref-find-definitions

      • g r xref-find-references

LaTex

Install texlive-most

1
sudo pamman -S texlive-most

Bindings

  • C-c C-s C-l org-latex-preview

Examples

Display inline $E=mc^2$: $E=mc^2$

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#+BEGIN_LaTeX latex
\begin{aligned}
T_{1}(n) & = 2T_{1}(\frac{n}{2}) + c_{1}n \\
& = 2[2T_{1}(\frac{n}{2^{2}}) + c_{1}\frac{n}{2}] + c_{1}n \\
& = 2^{2}T_{1}(\frac{n}{2^{2}}) + 2c_{1}n \\
& ...\\
& = 2^{L}T_{1}(\frac{n}{2^{L}}) + Lc_{1}n \\
n & = 2^{L} \\
L & = log_{2}n \\
=> T_{1}(n) & = nT_{1}(1) + c_{1}.n.log_{2}{n} \\
T_{1}(n) & = \Omega(nlog_{2}{n}) \\
\end{aligned}
#+END_LaTex

\begin{aligned} T_{1}(n) & = 2T_{1}(\frac{n}{2}) + c_{1}n \\ & = 2[2T_{1}(\frac{n}{2^{2}}) + c_{1}\frac{n}{2}] + c_{1}n \\ & = 2^{2}T_{1}(\frac{n}{2^{2}}) + 2c_{1}n \\ & ...\\ & = 2^{L}T_{1}(\frac{n}{2^{L}}) + Lc_{1}n \\ n & = 2^{L} \\ L & = log_{2}n \\ => T_{1}(n) & = nT_{1}(1) + c_{1}.n.log_{2}{n} \\ T_{1}(n) & = \Omega(nlog_{2}{n}) \\ \end{aligned}

greek

$\alpha$ \alpha $\beta$ \beta $\gamma$ \gamma $\delta$ \delta
$\theta$ \theta $\Theta$ \Theta $\omega$ \omega $\Omega$ \Omega

ref

Table

  • C-c | convert selected region to table

ref

How-to

How to create a directory?

https://stackoverflow.com/questions/155507/how-do-i-create-a-directory-from-within-emacs

M-x make-directory

1
M-x make-directory RET dir/to/create RET

M-! mkdir call shell command mkdir

1
M-! mkdir -p dir/parent{1,2}/node RET

Dired mode, press +

1
+

C-x C-f - find-file

1
2
C-x C-f dir/to/create/with-file
M-x make-directory RET RET # Create directory 'dir/to/create' if not exists

How to quickly copy/move files

How to open files externally in Emacs dired mode?

https://stackoverflow.com/questions/6845005/how-can-i-open-files-externally-in-emacs-dired-mode Yes. Use ! while in dired to run a shell command on a file.

1
:!

BookMarks

https://www.emacswiki.org/emacs/BookMarks

  • ‘C-x r m’ – set a bookmark at the current location (e.g. in a file)

  • ‘C-x r b’ – jump to a bookmark

  • ‘C-x r l’ – list your bookmarks

  • ‘M-x bookmark-delete’ – delete a bookmark by name

Ref