Compare commits

...

2 Commits

Author SHA1 Message Date
be797826ec Add additional embark actions 2021-10-14 11:57:44 -04:00
12f97985a9 Fix org config 2021-10-14 11:57:31 -04:00
3 changed files with 72 additions and 8 deletions

View File

@ -24,19 +24,71 @@
(advice-add #'marginalia-cycle :after (advice-add #'marginalia-cycle :after
(lambda () (lambda ()
(when (bound-and-true-p selectrum-mode) (selectrum-exhibit)))) (when (bound-and-true-p selectrum-mode) (selectrum-exhibit))))
(add-to-list 'marginalia-prompt-categories '("Find file:" . project-file))
(add-to-list 'marginalia-prompt-categories '("Find dir:" . project-file))
(add-to-list 'marginalia-prompt-categories '("Switch to project" . file))
(add-to-list 'marginalia-prompt-categories '("recipe\\|package" . straight))
(add-to-list 'marginalia-prompt-categories '("Password entry" . password-store))
:general :general
(minibuffer-local-map "M-A" #'marginalia-cycle) (minibuffer-local-map "M-A" #'marginalia-cycle)
:custom :custom
(marginalia-annotators '(marginalia-annotators-heavy marginalia-annotators-light nil))) (marginalia-annotators '(marginalia-annotators-heavy marginalia-annotators-light nil)))
;; Embark adds context actions to completion candidates ;; Embark adds context actions to completion candidates (and other things!)
(use-package embark (use-package embark
:config :config
(defun embark-which-key-indicator (map _target) (defun embark-which-key-indicator ()
(which-key--show-keymap "Embark" map nil nil 'no-paging) "An embark indicator that displays keymaps using which-key.
#'which-key--hide-popup-ignore-command) The which-key help message will show the type and value of the
current target followed by an ellipsis if there are further
targets."
(lambda (&optional keymap targets prefix)
(if (null keymap)
(which-key--hide-popup-ignore-command)
(which-key--show-keymap
(if (eq (caar targets) 'embark-become)
"Become"
(format "Act on %s '%s'%s"
(plist-get (car targets) :type)
(embark--truncate-target (plist-get (car targets) :target))
(if (cdr targets) "" "")))
(if prefix
(pcase (lookup-key keymap prefix 'accept-default)
((and (pred keymapp) km) km)
(_ (key-binding prefix 'accept-default)))
keymap)
nil nil t))))
(embark-define-keymap embark-straight-map
"Keymap for actions for straight.el"
("u" straight-visit-package-website)
("r" straight-get-recipe)
("i" straight-use-package)
("c" straight-check-package)
("F" straight-pull-package)
("f" straight-fetch-package)
("p" straight-push-package)
("n" straight-normalize-package)
("m" straight-merge-package))
(add-to-list 'embark-keymap-alist '(straight . embark-straight-map))
(embark-define-keymap embark-password-store-actions
"Keymap for actions for password-store."
("c" password-store-copy)
("f" password-store-copy-field)
("i" password-store-insert)
("I" password-store-generate)
("r" password-store-rename)
("e" password-store-edit)
("k" password-store-remove)
("U" password-store-url))
(add-to-list 'embark-keymap-alist '(password-store . embark-password-store-actions))
:general :general
("M-o" #'embark-act) ("C-." #'embark-act)
("M-." #'embark-dwim)
('normal "C-." #'embark-act)
('normal "M-." #'embark-dwim)
(embark-file-map "s" #'sudo-edit-find-file
"l" #'vlf
"g" #'magit-file-dispatch)
('normal embark-collect-mode-map ('normal embark-collect-mode-map
"TAB" #'forward-button "TAB" #'forward-button
"?" #'describe-mode "?" #'describe-mode
@ -58,7 +110,9 @@
"<backtab>" #'backward-button) "<backtab>" #'backward-button)
:custom :custom
(embark-prompter 'embark-keymap-prompter) (embark-prompter 'embark-keymap-prompter)
(embark-indicator 'embark-which-key-indicator)) (embark-indicators '(embark-which-key-indicator
embark-highlight-indicator
embark-isearch-highlight-indicator)))
;; Consult adds a bunch of completing-read based utilities ;; Consult adds a bunch of completing-read based utilities
(use-package consult (use-package consult

View File

@ -23,6 +23,14 @@
(set-visited-file-name new-name) (set-visited-file-name new-name)
(set-buffer-modified-p nil)) (set-buffer-modified-p nil))
(use-package sudo-edit
:commands (sudo-edit
sudo-edit-find-file))
;; Optimized editing of very large files
(use-package vlf
:commands (vlf))
(leader-def-key (leader-def-key
"f" '(nil :which-key "file") "f" '(nil :which-key "file")
"ff" #'find-file "ff" #'find-file

View File

@ -1,7 +1,8 @@
;; The all-powerful Org mode ;; The all-powerful Org mode
(use-package org (use-package org
:straight org-plus-contrib :straight '(org-plus-contrib :type git
:repo "https://git.sr.ht/~bzg/org-contrib")
:mode (("\\.org\\'" . org-mode)) :mode (("\\.org\\'" . org-mode))
:init :init
(leader-def-key "o" '(nil :which-key "org")) (leader-def-key "o" '(nil :which-key "org"))
@ -131,7 +132,8 @@
"I" #'org-roam-node-insert-immediate) "I" #'org-roam-node-insert-immediate)
(with-eval-after-load 'org (with-eval-after-load 'org
(general-def org-mode-map "C-c n" org-roam-commands-map) (general-def org-mode-map "C-c n" org-roam-commands-map)
(which-key-declare-prefixes-for-mode 'org-mode "C-c n" "org-roam")) ;; (which-key-declare-prefixes-for-mode 'org-mode "C-c n" "org-roam")
)
:general :general
(leader-map "of" #'org-roam-node-find) (leader-map "of" #'org-roam-node-find)
:config :config