diff options
Diffstat (limited to 'init.el')
-rw-r--r-- | init.el | 264 |
1 files changed, 100 insertions, 164 deletions
@@ -60,15 +60,17 @@ :init (setq modus-themes-fringes 'subtle) :config - (add-to-list 'modus-themes-org-agenda '(header-block . (no-scale))) - + (defun km/modus-themes-set-custom-faces () + (modus-themes-with-colors + (when (featurep 'git-annex) + (set-face-attribute 'git-annex-dired-annexed-available nil + :foreground green) + (set-face-attribute 'git-annex-dired-annexed-unavailable nil + :foreground red)))) (add-hook 'modus-themes-after-load-theme-hook - (lambda () - (set-face-attribute 'git-annex-dired-annexed-available nil - :foreground (modus-themes-color 'green)) - (set-face-attribute 'git-annex-dired-annexed-unavailable nil - :foreground (modus-themes-color 'red)))) - (load-theme 'modus-operandi t)) + #'km/modus-themes-set-custom-faces) + + (modus-themes-load-theme 'modus-operandi)) ;;; Custom prefix maps @@ -91,6 +93,7 @@ (define-prefix-command 'km/dired-prefix-map) (define-prefix-command 'km/dired-subtree-prefix-map) (define-prefix-command 'km/gnus-summary-prefix-map) +(define-prefix-command 'km/ledger-prefix-map) (define-prefix-command 'km/magit-map) (define-prefix-command 'km/magit-wip-map) (define-prefix-command 'km/org-prefix-map) @@ -103,14 +106,8 @@ ;;; Org (use-package org - :load-path "~/src/emacs/org-mode/lisp/" :mode ("\\.org.txt\\'" . org-mode) :init - (require 'org-loaddefs) - (add-to-list 'load-path "~/src/emacs/org-contrib/lisp/" t) - (with-eval-after-load 'info - (info-initialize) - (add-to-list 'Info-directory-list "~/src/emacs/org-mode/doc/")) (bind-keys :map km/global-org-map ("b" . org-switchb) ("cg" . org-clock-goto) @@ -140,7 +137,7 @@ (put 'org-log-done 'safe-local-variable #'booleanp) (put 'org-archive-location 'safe-local-variable #'stringp) - (setq org-catch-invisible-edits 'error + (setq org-fold-catch-invisible-edits 'error org-special-ctrl-k t org-insert-heading-respect-content nil org-M-RET-may-split-line nil @@ -153,9 +150,9 @@ org-goto-max-level 3) (setq org-startup-folded t) - (setq org-default-notes-file "~/notes/tasks.org") - (setq org-agenda-text-search-extra-files - (file-expand-wildcards "~/notes/extra/*.org")) + (setq org-directory (expand-file-name "~/tasks/")) + (setq org-default-notes-file (concat (file-name-as-directory org-directory) + "tasks.org")) (setq org-reverse-note-order t) (setq org-refile-targets '((nil :maxlevel . 2)) @@ -179,7 +176,7 @@ (add-hook 'next-error-hook (lambda () (when (eq major-mode 'org-mode) - (org-show-context)))) + (org-fold-show-context)))) (advice-add 'org-eval-in-calendar :around @@ -195,7 +192,7 @@ '((name . "org-save-after-capture-refile"))) (bind-keys :map org-mode-map - ("C-c l" . org-goto) + ("C-c l" . consult-org-heading) ("C-c m" . km/org-prefix-map) ;; Don't let `org-cycle-agenda-files' binding override ;; custom `backward-kill-word' binding @@ -338,6 +335,8 @@ ("o" . km/org-open-file) ("p" . km/org-open-file-at-point) ("r" . km/org-open-recent-file)) + (bind-keys :map km/global-org-map + ("f" . km/org-copy-plain-file-link)) (define-key ctl-x-4-map "o" #'km/org-switch-to-buffer-other-window) @@ -381,8 +380,8 @@ #'km/org-agenda-set-restriction-lock)) :config - (setq org-directory "~/notes/") - (setq org-agenda-files "~/notes/agenda-files") + (setq org-agenda-files (concat (file-name-as-directory org-directory) + "agenda-files")) (add-hook 'org-agenda-finalize-hook #'km/org-agenda-cd-and-read-dir-locals) (add-hook 'org-agenda-finalize-hook #'km/org-agenda-store-current-span) @@ -394,14 +393,8 @@ ("D" . km/org-agenda-delete-subtree) ("w" . km/org-agenda-refile-dwim))) -(use-package org-link-edit - :load-path "~/src/emacs/org-link-edit/" - :init (require 'org-link-edit-autoloads nil t)) - (use-package bog - :load-path "~/src/emacs/bog/" :init - (require 'bog-autoloads nil t) (setq bog-keymap-prefix (kbd "C-c b")) (global-set-key bog-keymap-prefix bog-command-map) :config @@ -584,32 +577,39 @@ (with-eval-after-load 'avy (add-to-list 'avy-dispatch-alist (cons ?w #'km/avy-action-copy-line)))) -(use-package ivy - :diminish ivy-mode - :config - (setq ivy-count-format "(%d/%d) ") - (setq ivy-use-virtual-buffers t) - (setq ivy-virtual-abbreviate 'abbreviate) - (setq ivy-wrap t) - - (define-key ivy-minibuffer-map (kbd "C-'") nil) - (define-key ivy-minibuffer-map (kbd "C-.") 'ivy-avy) +(use-package vertico + :init + (vertico-mode 1)) - (ivy-mode 1)) +(use-package orderless + :init + (setq completion-styles '(orderless basic)) + (setq completion-category-overrides + '((file (styles basic partial-completion))))) -(use-package swiper - :bind (("M-s k" . swiper))) +(use-package consult + :chords (("jt" . consult-buffer)) + :bind (("C-x b" . consult-buffer) + ("C-x 4 b" . consult-buffer-other-window) + ("C-c z m" . consult-man) + ("M-g g" . consult-goto-line) + ("M-s k" . consult-line) + ("M-y" . consult-yank-pop) + :map minibuffer-local-map + ("M-s" . consult-history) + ("M-r" . consult-history)) + :config + (setq consult-narrow-key "<") + (setq consult-preview-key nil)) -(use-package counsel - :chords (("jt" . counsel-buffer-or-recentf) - ("kx" . counsel-M-x)) - :bind (("C-c l" . counsel-imenu) - ("M-y" . counsel-yank-pop))) +(use-package consult-imenu + :bind (("C-c l" . consult-imenu))) ;;; Buffers and files (setq require-final-newline t) +(setq write-region-inhibit-fsync t) ;; Disable `suspend-frame' binding. (global-set-key (kbd "C-x C-z") nil) @@ -645,6 +645,8 @@ (setq tramp-default-method "sshx")) (use-package recentf + :init + (recentf-mode 1) :config (setq recentf-max-saved-items 100 recentf-save-file "~/.emacs.d/cache/recentf") @@ -658,19 +660,6 @@ "/itsalltext/") recentf-exclude))) -(use-package nlines - :load-path "~/src/emacs/nlines/" - :init - (require 'nlines-autoloads nil t) - (define-key km/file-map "l" #'nlines-run-command)) - -(use-package cpinfo - :load-path "~/src/emacs/cpinfo/" - :init - (require 'cpinfo-autoloads nil t) - (with-eval-after-load 'dired - (define-key km/dired-prefix-map "f" #'cpinfo-copy))) - (use-package view :diminish (view-mode . "Vw") :chords ("hq" . view-mode) @@ -754,7 +743,7 @@ :config (setq projectile-find-dir-includes-top-level t projectile-use-git-grep t) - (setq projectile-completion-system 'ivy) + (setq projectile-git-submodule-command nil) (defun km/projectile-ignore-directory-p (name) (or (file-remote-p name) @@ -886,21 +875,14 @@ (use-package git-annex :config - (setq git-annex-commit nil)) - -(use-package compat - :load-path "~/src/emacs/compat/") - -(use-package with-editor - :load-path "~/src/emacs/with-editor/") + (setq git-annex-commit nil) + (run-hooks 'modus-themes-after-load-theme-hook)) (use-package transient - :load-path "~/src/emacs/transient/lisp" :config (setq transient-default-level 7)) (use-package magit-popup - :load-path "~/src/emacs/magit-popup/" :config (setq magit-popup-show-help-echo nil magit-popup-show-common-commands nil @@ -911,7 +893,6 @@ ("SPC SPC <t>" . magit-invoke-popup-option))) (use-package magit - :load-path "~/src/emacs/magit/lisp/" :bind ("C-x g" . km/magit-status) :chords ("jg" . km/magit-status) :init @@ -980,9 +961,9 @@ (transient-append-suffix 'magit-diff "t" '("e" "Edit options" magit-diff-refresh)) (transient-append-suffix 'magit-diff "-w" - '("-d" "Diff filter" "--diff-filter=" read-from-minibuffer)) + '("-d" "Diff filter" "--diff-filter=")) (transient-append-suffix 'magit-diff-refresh "-w" - '("-d" "Diff filter" "--diff-filter=" read-from-minibuffer)) + '("-d" "Diff filter" "--diff-filter=")) (transient-suffix-put 'magit-stash "Z" :key "s") @@ -1078,9 +1059,6 @@ (put 'magit-edit-line-commit 'disabled nil) (put 'magit-diff-edit-hunk-commit 'disabled nil)) -(use-package orgit - :load-path "~/src/emacs/orgit/") - (use-package km-magit :init (bind-keys :map km/git-map @@ -1158,7 +1136,7 @@ (transient-append-suffix 'magit-log "l" '("d" "Log dwim" km/magit-log-dwim)) - (transient-append-suffix 'magit-log "d" + (transient-append-suffix 'magit-log "s" '("y" "Cherry dwim" km/magit-cherry-dwim)) (transient-append-suffix 'magit-merge "m" @@ -1191,21 +1169,10 @@ '("s" "series" km/magit-patch-create-series)))) (use-package magit-annex - :load-path "~/src/emacs/magit-annex/" - :init (require 'magit-annex-autoloads nil t) :config (setq magit-annex-unused-open-function #'org-open-file)) -(use-package magit-tbdiff - :load-path "~/src/emacs/magit-tbdiff/" - :init (require 'magit-tbdiff-autoloads nil t)) - -(use-package magit-imerge - :load-path "~/src/emacs/magit-imerge/" - :init (require 'magit-imerge-autoloads nil t)) - (use-package git-commit - ;; :load-path "~/src/emacs/magit/lisp/" :config (setq git-commit-finish-query-functions nil) @@ -1222,50 +1189,16 @@ '((name . "go-to-bob")))) (use-package orgit - :disabled t - :load-path "~/src/emacs/orgit/" - :init (require 'orgit-autoloads nil t)) + :disabled t) ;;; Command interfaces +(key-chord-define-global "kx" #'execute-extended-command) + (use-package setkey :bind ("C-c v" . setkey-call)) -(use-package god-mode - :bind (("C-c d" . god-local-mode) - ("C-x C-1" . delete-other-windows) - ("C-x C-2" . split-window-below) - ("C-x C-3" . split-window-right)) - :config - (add-hook 'view-mode-hook - (lambda () - (if view-mode (god-local-mode-pause) (god-local-mode-resume)))) - (add-hook 'org-capture-mode-hook - (lambda () (god-local-mode -1))) - - (add-hook 'god-mode-enabled-hook - (lambda () - (when view-mode - (view-mode -1)) - (when (derived-mode-p 'emacs-lisp-mode) - (lispy-mode -1)))) - (add-hook 'god-mode-disabled-hook - (lambda () - (when (derived-mode-p 'emacs-lisp-mode) - (lispy-mode 1)))) - (bind-keys :map god-local-mode-map - ("." . repeat) - ("i" . god-local-mode)) - - (require 'km-god)) - -(use-package km-god - :config - (add-to-list 'god-exempt-predicates #'km/god-gnus-p) - (add-hook 'god-mode-enabled-hook #'km/god-update-cursor) - (add-hook 'god-mode-disabled-hook #'km/god-update-cursor)) - (use-package km-hydra :bind (("C-c n" . km/hydra-outline-mode) ("C-c w" . hydra-window-map/body)) @@ -1328,7 +1261,6 @@ (global-set-key (kbd "C-c i") #'km/yas-dummy) :config (global-set-key (kbd "C-c i") nil) - (setq yas-fallback-behavior nil) (defun km/yas-with-comment (str) (concat comment-start @@ -1509,6 +1441,10 @@ ("a" . km/zsh-ansi-term) ("t" . km/open-external-terminal))) +(use-package vterm + :init + (bind-keys :map km/external-map ("v" . vterm))) + ;;; Other external programs @@ -1554,8 +1490,6 @@ select-enable-primary t)) (use-package man - :init - (define-key km/external-map "m" #'man) :config (setq Man-notify-method 'aggressive)) @@ -1762,21 +1696,42 @@ (use-package ledger-mode :init - (and (boundp 'font-lock-global-modes) - (pcase font-lock-global-modes - ('t - (setq font-lock-global-modes '(not ledger-mode))) - (`(not . ,_) - (add-to-list 'font-lock-global-modes 'ledger-mode t)) - (`(,_ . ,_) - (setq font-lock-global-modes - (delq 'ledger-mode font-lock-global-modes)))))) + (bind-keys :map km/ledger-prefix-map + ("a" . km/ledger-insert-account) + ("p" . km/ledger-insert-payee)) + + (setq ledger-highlight-xact-under-point nil) + :config + (defun km/ledger-insert-account () + (interactive) + (insert (completing-read "Account: " (ledger-accounts-list)))) + + (defun km/ledger-insert-payee () + (interactive) + (insert (completing-read "Payee: " (ledger-payees-in-buffer)))) + + (bind-keys :map ledger-mode-map + ("C-c m" . km/ledger-prefix-map))) (use-package rst - :defer t :config (add-hook 'rst-mode-hook #'flyspell-mode)) +(use-package denote + :bind (("C-c d d" . denote) + ("C-c d D" . denote-date) + ("C-c d t" . denote-type) + ("C-c d f" . km/find-file-with-denote-naming) + ("C-c d ." . km/denote-find-file-at-point) + ("C-c d i" . km/denote-insert-id)) + :config + (setq denote-directory (expand-file-name "~/notes")) + (setq denote-dired-directories (list denote-directory)) + (setq denote-file-type 'text) + + (with-eval-after-load 'dired + (add-hook 'dired-mode-hook #'denote-dired-mode-in-directories))) + ;;; Language modes @@ -1792,7 +1747,7 @@ (use-package haskell-mode :config (setq haskell-process-show-debug-tips nil) - (add-hook 'haskell-mode-hook #'turn-on-haskell-indentation) + (add-hook 'haskell-mode-hook #'haskell-indentation-mode) (add-hook 'haskell-mode-hook #'interactive-haskell-mode) (add-hook 'haskell-mode-hook #'turn-on-haskell-doc) (bind-keys :map haskell-mode-map @@ -1825,15 +1780,12 @@ '("Packages" "^\\s-*(\\(use-package\\)\\s-+\\(\\(\\sw\\|\\s_\\)+\\)" 2)))) (add-hook 'emacs-lisp-mode-hook #'km/imenu-add-use-package)) -(use-package find-function +(use-package find-func :bind (("C-h ;" . find-function) ("C-h 4 ;" . find-function-other-window)) :init (define-key km/file-map "e" #'find-library)) -(use-package paredit - :diminish (paredit-mode . "Pe")) - (use-package lispy :init (add-hook 'emacs-lisp-mode-hook #'lispy-mode) @@ -1882,7 +1834,6 @@ (add-to-list 'interpreter-mode-alist '("python2" . python-mode)) (add-to-list 'interpreter-mode-alist '("python3" . python-mode)) - (pyvenv-tracking-mode 1) :config (setq python-fill-docstring-style 'pep-257-nn python-indent-guess-indent-offset nil) @@ -1919,15 +1870,7 @@ (require 'km-python)) -(use-package pydoc - :load-path "~/src/emacs/pydoc/" - :config - (setq pydoc-make-method-buttons nil) - ;; Don't shadow my `ace-link' binding. - (define-key pydoc-mode-map "o" #'ace-link-help)) - (use-package km-python - :bind ("C-h y" . km/pydoc) :init (bind-keys :map km/python-prefix-map ("c" . km/python-copy-last-shell-line-as-comment) @@ -1943,19 +1886,13 @@ (lambda () (add-hook 'post-self-insert-hook - #'km/python-indent-post-self-insert-function 'append 'local))) - - (add-hook 'pydoc-after-finish-hook #'km/pydoc-store-name) - (when (file-exists-p km/pydoc-names-file) - (km/pydoc-read-names-file km/pydoc-names-file))) + #'km/python-indent-post-self-insert-function 'append 'local)))) (use-package snakemake-mode - :load-path "~/src/emacs/snakemake-mode/" :init - (require 'snakemake-autoloads nil t) - (define-key km/compile-map "s" #'snakemake-popup) + (define-key km/compile-map "s" #'snakemake) (with-eval-after-load 'dired - (define-key dired-mode-map "b" #'snakemake-popup)) + (define-key dired-mode-map "b" #'snakemake)) :config (setq snakemake-root-dir-function #'projectile-project-root) @@ -2025,7 +1962,6 @@ (use-package notmuch :init - (autoload 'notmuch "notmuch" "Notmuch mail" t) (define-key km/mail-map "n" #'notmuch) :config (setq mail-user-agent 'notmuch-user-agent) @@ -2048,6 +1984,8 @@ (add-to-list 'notmuch-show-stash-mlarchive-link-alist '("yhetil-orgmode" . "https://yhetil.org/orgmode/")) + (add-to-list 'notmuch-show-stash-mlarchive-link-alist + '("orgmode-list" . "https://list.orgmode.org/")) (advice-add 'notmuch-show-forward-message :around @@ -2275,7 +2213,7 @@ (use-package bookmark :config (setq bookmark-save-flag nil) - (setq bookmark-set-fringe-mark nil)) + (setq bookmark-fringe-mark nil)) (use-package eww :config @@ -2318,8 +2256,6 @@ ;; Remove all mail map bindings except notmuch-related ones. (global-set-key (kbd "C-x m n") #'notmuch) (global-set-key (kbd "C-x m .") #'km/notmuch-show-at-point) - (with-eval-after-load 'km-python - (add-hook 'kill-emacs-hook #'km/pydoc-save-names-file)) (savehist-mode 1) (setq save-abbrevs 'silently bookmark-save-flag 1) |