(beacon-mode 1)
(setq centaur-tabs-set-bar 'over
centaur-tabs-set-icons t
centaur-tabs-gray-out-icons 'buffer
centaur-tabs-height 24
centaur-tabs-set-modified-marker t
centaur-tabs-style "bar"
centaur-tabs-modified-marker "•")
(map! :leader
:desc "Toggle tabs globally" "t c" #'centaur-tabs-mode
:desc "Toggle tabs local display" "t C" #'centaur-tabs-local-mode)
(evil-define-key 'normal centaur-tabs-mode-map (kbd "g <right>") 'centaur-tabs-forward ; default Doom binding is 'g t'
(kbd "g <left>") 'centaur-tabs-backward ; default Doom binding is 'g T'
(kbd "g <down>") 'centaur-tabs-forward-group
(kbd "g <up>") 'centaur-tabs-backward-group)
(use-package! citar
:no-require
:custom
(org-cite-insert-processor 'citar)
(org-cite-follow-processor 'citar)
(org-cite-activate-processor 'citar)
(citar-bibliography org-cite-global-bibliography))
COMMAND | DESCRIPTION | KEYBINDING |
---|---|---|
dired | Open dired file manager | SPC d d |
dired-jump | Jump to current directory in dired | SPC d j |
COMMAND | DESCRIPTION | KEYBINDING |
---|---|---|
dired-view-file | View file in dired | SPC d v |
dired-up-directory | Go up in directory tree | h |
dired-find-file | Go down in directory tree (or open if file) | l |
dired-next-line | Move down to next line | j |
dired-previous-line | Move up to previous line | k |
dired-mark | Mark file at point | m |
dired-unmark | Unmark file at point | u |
dired-do-copy | Copy current file or marked files | C |
dired-do-rename | Rename current file or marked files | R |
dired-hide-details | Toggle detailed listings on/off | ( |
dired-git-info-mode | Toggle git information on/off | ) |
dired-create-directory | Create new empty directory | + |
dired-diff | Compare file at point with another | = |
dired-subtree-toggle | Toggle viewing subtree at point | TAB |
COMMAND | DESCRIPTION | KEYBINDING |
---|---|---|
dired-mark-files-regexp | Mark files using regex | % m |
dired-do-copy-regexp | Copy files using regex | % C |
dired-do-rename-regexp | Rename files using regex | % R |
dired-mark-files-regexp | Mark all files using regex | * % |
COMMAND | DESCRIPTION | KEYBINDING |
---|---|---|
dired-do-chgrp | Change the group of marked files | g G |
dired-do-chmod | Change the mode of marked files | M |
dired-do-chown | Change the owner of marked files | O |
dired-do-rename | Rename file or all marked files | R |
(map! :leader
(:prefix ("d" . "dired")
:desc "Open dired" "d" #'dired
:desc "Dired jump to current" "j" #'dired-jump)
(:after dired
(:map dired-mode-map
:desc "Peep-dired image previews" "d p" #'peep-dired
:desc "Dired view file" "d v" #'dired-view-file)))
(evil-define-key 'normal dired-mode-map
(kbd "M-RET") 'dired-display-file
(kbd "h") 'dired-up-directory
(kbd "l") 'dired-open-file ; use dired-find-file instead of dired-open.
(kbd "m") 'dired-mark
(kbd "t") 'dired-toggle-marks
(kbd "u") 'dired-unmark
(kbd "C") 'dired-do-copy
(kbd "D") 'dired-do-delete
(kbd "J") 'dired-goto-file
(kbd "M") 'dired-do-chmod
(kbd "O") 'dired-do-chown
(kbd "P") 'dired-do-print
(kbd "R") 'dired-do-rename
(kbd "T") 'dired-do-touch
(kbd "Y") 'dired-copy-filenamecopy-filename-as-kill ; copies filename to kill ring.
(kbd "Z") 'dired-do-compress
(kbd "+") 'dired-create-directory
(kbd "-") 'dired-do-kill-lines
(kbd "% l") 'dired-downcase
(kbd "% m") 'dired-mark-files-regexp
(kbd "% u") 'dired-upcase
(kbd "* %") 'dired-mark-files-regexp
(kbd "* .") 'dired-mark-extension
(kbd "* /") 'dired-mark-directories
(kbd "; d") 'epa-dired-do-decrypt
(kbd "; e") 'epa-dired-do-encrypt)
;; Get file icons in dired
(add-hook 'dired-mode-hook 'all-the-icons-dired-mode)
;; With dired-open plugin, you can launch external programs for certain extensions
;; For example, I set all .png files to open in 'sxiv' and all .mp4 files to open in 'mpv'
(setq dired-open-extensions '(("gif" . "sxiv")
("jpg" . "sxiv")
("png" . "sxiv")
("mkv" . "mpv")
("mp4" . "mpv")))
If peep-dired is enabled, you will get image previews as you go up/down with ‘j’ and ‘k’
COMMAND | DESCRIPTION | KEYBINDING |
---|---|---|
peep-dired | Toggle previews within dired | SPC d p |
peep-dired-next-file | Move to next file in peep-dired-mode | j |
peep-dired-prev-file | Move to previous file in peep-dired-mode | k |
(evil-define-key 'normal peep-dired-mode-map
(kbd "j") 'peep-dired-next-file
(kbd "k") 'peep-dired-prev-file)
(add-hook 'peep-dired-hook 'evil-normalize-keymaps)
(setq delete-by-moving-to-trash t
trash-directory "~/.local/share/Trash/files/")
NOTE
: For convenience, you may want to create a symlink to ‘local/share/Trash’ in your home directory:
cd ~/ ln -s ~/.local/share/Trash .
;; Whenever you reconfigure a package, make sure to wrap your config in an
;; `after!' block, otherwise Doom's defaults may override your settings. E.g.
;;
;; (after! PACKAGE
;; (setq x y))
;;
;; The exceptions to this rule:
;;
;; - Setting file/directory variables (like `org-directory')
;; - Setting variables which explicitly tell you to set them before their
;; package is loaded (see 'C-h v VARIABLE' to look up their documentation).
;; - Setting doom variables (which start with 'doom-' or '+').
;;
;; Here are some additional functions/macros that will help you configure Doom.
;;
;; - `load!' for loading external *.el files relative to this one
;; - `use-package!' for configuring packages
;; - `after!' for running code after a package has loaded
;; - `add-load-path!' for adding directories to the `load-path', relative to
;; this file. Emacs searches the `load-path' when you load packages with
;; `require' or `use-package'.
;; - `map!' for binding new keys
;;
;; To get information about any of these functions/macros, move the cursor over
;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k').
;; This will open documentation for it, including demos of how they are used.
;; Alternatively, use `C-h o' to look up a symbol (functions, variables, faces,
;; etc).
;;
;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how
;; they are implemented.
I make a lot of splits, and it finally got annoying having to swap to them all the time. So, let’s change that
(setq evil-split-window-below t
evil-vsplit-window-right t)
I don’t need this because I, like all programmers, make 0 mistaeks.
(setq evil-want-fine-undo t)
More often than not, I’d argue always, I want s/
on my ex commands, so let’s
sort that out.
(setq evil-ex-substitute-global t)
When we overwrite text in visual mode, say vip
, don’t add to the kill ring.
(setq evil-kill-on-visual-paste nil)
Some of them are quite useful, and I normally use them in the DE.
(setq evil-disable-insert-state-bindings t)
(setq doom-theme 'catppuccin)
(map! :leader
:desc "Load new theme" "h t" #'counsel-load-theme)
(setq doom-font (font-spec :family "JetBrains Mono" :size 36)
doom-variable-pitch-font (font-spec :family "Ubuntu" :size 36)
doom-big-font (font-spec :family "JetBrains Mono" :size 40))
(after! doom-themes
(setq doom-themes-enable-bold t
doom-themes-enable-italic t))
(custom-set-faces!
'(font-lock-comment-face :slant italic)
'(font-lock-keyword-face :slant italic))
(remove-hook! '(org-mode-hook text-mode-hook conf-mode-hook)
#'display-line-numbers-mode)
(require 'ob-async)
(setq org-babel-default-header-args:jupyter-python
'((:results . "both")
;; This seems to lead to buffer specific sessions!
(:session . (lambda () (buffer-file-name)))
(:kernel . "python3")
(:pandoc . "t")
(:exports . "both")
(:cache . "no")
(:noweb . "no")
(:hlines . "no")
(:tangle . "no")
(:eval . "never-export")))
(with-eval-after-load 'ob-jupyter
(org-babel-jupyter-aliases-from-kernelspecs))
(use-package! doom-modeline
:config
(setq doom-modeline-persp-name t
doom-modeline-height 35
display-time-mode t))
(use-package! org
:mode ("\\.org\\'" . org-mode)
:init
(add-hook 'org-src-mode-hook #'(lambda () (flycheck-mode 0)))
(add-hook 'org-mode-hook #'(lambda () (flycheck-mode 0)))
(map! :map org-mode-map
"M-n" #'outline-next-visible-heading
"M-p" #'outline-previous-visible-heading
"C-c ;" nil)
(setq org-src-window-setup 'current-window
org-return-follows-link t
org-confirm-elisp-link-function nil
org-confirm-shell-link-function nil
org-use-speed-commands t
org-catch-invisible-edits 'show
;; Use with consel-org-goto (gh .)
org-goto-interface 'outline-path-completion)
(setq org-file-apps '((auto-mode . emacs)
(directory . emacs)
("\\.mm\\'" . default)
("\\.x?html?\\'" . default)
("\\.pdf\\'" . (lambda (file link) (org-pdftools-open link))))))
(after! org
;; FIXME: Don't know why this isn't loaded automatically...
(require 'ob-async)
(require 'jupyter)
;; Clear Doom's default templates
(setq org-capture-templates '())
(add-to-list 'org-capture-templates `("l" "Listen" entry (file ,(concat org-directory "org-roam2/orgzly/listen.org"))
"* TODO %?\n%i"))
(add-to-list 'org-capture-templates `("i" "Incoming" entry (file ,(concat org-directory "org-roam2/orgzly/incoming.org"))
"* %?\n%i"))
;; (add-to-list 'org-latex-packages-alist "\\usepackage{braket}")
;; http://kitchingroup.cheme.cmu.edu/blog/2015/01/04/Redirecting-stderr-in-org-mode-shell-blocks/
;; NOTE: This will affect (break) tangled output. Use directly on top of code blocks when needed instead.
;; TODO: Figure out how to keep this without adding it to tangled output.
;; (setq org-babel-default-header-args:sh
;; '((:prologue . "exec 2>&1") (:epilogue . ":")))
(setq org-babel-default-header-args:jupyter-julia '((:kernel . "julia-1.6")
(:display . "text/plain")
(:async . "yes")))
(setq org-confirm-babel-evaluate nil
org-use-property-inheritance t
org-export-use-babel nil
org-pretty-entities nil
org-use-speed-commands t
org-return-follows-link t
org-outline-path-complete-in-steps nil
org-ellipsis ""
org-fontify-whole-heading-line t
org-fontify-done-headline t
org-fontify-quote-and-verse-blocks t
org-image-actual-width nil
org-src-fontify-natively t
org-src-tab-acts-natively t
org-startup-indented t
org-src-preserve-indentation t
org-edit-src-content-indentation 0
org-adapt-indentation nil
org-hide-emphasis-markers t
org-special-ctrl-a/e t
org-special-ctrl-k t
org-yank-adjusted-subtrees t
org-src-window-setup 'reorganize-frame
org-src-ask-before-returning-to-edit-buffer nil
org-insert-heading-respect-content nil)
;; (add-hook 'org-babel-after-execute-hook 'org-display-inline-images 'append)
;; (add-hook 'org-babel-after-execute-hook 'org-toggle-latex-fragment 'append)
(setq org-refile-use-outline-path 'file
org-outline-path-complete-in-steps nil
org-refile-allow-creating-parent-nodes 'confirm)
;; (setq org-format-latex-options
;; (quote (:foreground default
;; :background default
;; :scale 2.0
;; :matchers ("begin" "$1" "$" "$$" "\\(" "\\["))))
;; Colorize org babel output. Without this color codes are left in the output.
(defun my/display-ansi-colors ()
(interactive)
(let ((inhibit-read-only t))
(ansi-color-apply-on-region (point-min) (point-max))))
(add-hook 'org-babel-after-execute-hook #'my/display-ansi-colors)
(advice-add 'org-meta-return :override #'my/org-meta-return)
(setq org-tags-match-list-sublevels 'indented)
(setq org-image-actual-width nil)
(setq org-agenda-files '())
(setq org-todo-keywords
'((sequence
"TODO(t)"
"WAIT(w)"
"HOLD(h)"
"IDEA(i)"
"DELEGATED(e)"
"|"
"DONE(d)"
"KILL(k)")
)
org-todo-keyword-faces
'(("WAIT" . +org-todo-onhold)
("HOLD" . +org-todo-onhold)
("DELEGATED" . +org-todo-onhold)
("KILL" . +org-todo-cancel)))
;; Update parent TODO state when all children TODOs are done
;; NOTE: Only works if the parent has a "[/]" or "[%]" in the heading!!
;; https://orgmode.org/manual/Breaking-Down-Tasks.html#Breaking-Down-Tasks
(defun org-summary-todo (n-done n-not-done)
"Switch entry to DONE when all subentries are done, to TODO otherwise."
(let (org-log-done org-log-states) ; turn off logging
(org-todo (if (= n-not-done 0) "DONE" "TODO"))))
(add-hook 'org-after-todo-statistics-hook 'org-summary-todo)
;; (add-to-list 'org-agenda-files "~/Sync/org-roam/orgzly/boox-incoming.org")
(add-to-list 'org-agenda-files "~/Sync/org-roam2/orgzly/pixel-incoming.org")
(add-to-list 'org-agenda-files "~/Sync/org-roam2/orgzly/incoming.org")
(add-to-list 'org-latex-default-packages-alist "\\PassOptionsToPackage{hyphens}{url}")
(require 'ox-latex))
;; Setup syntax highlighting for code block pdf exports
;; (after! ox-latex
;; (setq org-latex-pdf-process
;; '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f")
;; org-latex-listings 'minted
;; org-latex-packages-alist '(("" "minted"))))#+end_src
** Disable org-pretty-entities at current line
(defvar my/current-line '(0 . 0)
"(start . end) of current line in current buffer")
(make-variable-buffer-local 'my/current-line)
(defun my/unhide-current-line (limit)
"Font-lock function"
(let ((start (max (point) (car my/current-line)))
(end (min limit (cdr my/current-line))))
(when (< start end)
(remove-text-properties start end '(invisible t display "" composition ""))
(goto-char limit)
t)))
(defun my/refontify-on-linemove ()
"Post-command-hook"
(let* ((start (line-beginning-position))
(end (line-beginning-position 2))
(needs-update (not (equal start (car my/current-line)))))
(setq my/current-line (cons start end))
(when needs-update
(font-lock-fontify-block 2))))
(defun my/markdown-unhighlight ()
"Install"
(font-lock-add-keywords nil '((my/unhide-current-line)) t)
(add-hook 'post-command-hook #'my/refontify-on-linemove nil t))
(require 'markdown-mode)
(add-hook 'markdown-mode-hook #'my/markdown-unhighlight)
(add-hook 'markdown-mode-hook (lambda () (markdown-toggle-markup-hiding 1)))
(add-hook 'org-mode-hook #'my/markdown-unhighlight)
(after! org
(require 'org-tempo)
(pushnew! org-structure-template-alist
'("el" . "src emacs-lisp")
'("sh" . "src shell")
'("py" . "src python")))
(after! org
(setq org-capture-templates
'(("t" "Todo" entry (file+headline "Todo.org" "00 INBOX")
"* TODO %? \n %i ")
("n" "Novel Note" entry (file+headline "~/org/outline.org" "Novel Inbox")
"* %? \n %i\n %a "))))
(after! org
(setq org-todo-keywords
'((sequence
"TODO(t)" ; A task that needs doing & is ready to do
"PROJ(p)" ; A project, which usually contains other tasks
"NEXT(n)" ; A task that is in progress
"WAIT(t)" ; Something external is holding up this task
"HOLD(h)" ; This task is paused/on hold because of me
"OPEN(o)" ; An open or ongoing loop
"|"
"DONE(d)" ; Task successfully completed
"KILL(K)") ; Task was cancelled, aborted or is no longer applicable
(sequence
"[ ](T)" ; A task that needs doing
"[-](S)" ; Task is in progress
"[?](W)" ; Task is being held up or paused
"|"
"[X](D)") ; Task was completed
(sequence ; adapted from Tony Ballantyne's writing methodology
"IDEA(i!)"
"WRITE(w!)"
"EDIT(e!)"
"WORKING(k!)"
"|"
"USED(u!/@)"))))
(defun zz/adjust-org-company-backends ()
(remove-hook 'after-change-major-mode-hook '+company-init-backends-h)
(setq-local company-backends nil))
(add-hook! org-mode (zz/adjust-org-company-backends))
(setq doom-modeline-enable-word-count t)
(defun my-split-and-indirect-orgtree ()
"Splits window to the right and opens an org tree section in it"
(interactive)
(split-window-right)
(windmove-right)
(org-tree-to-indirect-buffer))
(defun my-kill-and-unsplit-orgtree ()
"Kills the cloned buffer and deletes the window."
(interactive)
(kill-this-buffer)
(delete-window))
(define-globalized-minor-mode global-rainbow-mode rainbow-mode
(lambda ()
(when (not (memq major-mode
(list 'org-agenda-mode)))
(rainbow-mode 1))))
(global-rainbow-mode 1 )
(setq vterm-always-compile-module t)
(setq vterm-kill-buffer-on-exit t)
(after! vterm
(define-key vterm-mode-map (kbd "<C-backspace>") (lambda () (interactive) (vterm-send-key (kbd "C-w")))))
(after! vterm
(setf (alist-get "woman" vterm-eval-cmds nil nil #'equal)
'((lambda (topic)
(woman topic))))
(setf (alist-get "magit-status" vterm-eval-cmds nil nil #'equal)
'((lambda (path)
(magit-status path))))
(setf (alist-get "dired" vterm-eval-cmds nil nil #'equal)
'((lambda (dir)
(dired dir)))))
(use-package! multi-vterm
:after vterm)
(setq vterm-shell "/usr/bin/zsh")
(map! :leader
:desc "Zap to char" "z" #'zap-to-char
:desc "Zap up to char" "Z" #'zap-up-to-char)