This commit is contained in:
Zelong Kuang
2026-02-21 03:41:32 +11:00
parent d58b32ac4f
commit 69eaf50f5e
4 changed files with 41 additions and 12 deletions

View File

@@ -187,7 +187,40 @@
("M-." . my-embark-preview))
:init
;; Optionally replace the key help with a completing-read interface
(setq prefix-help-command #'embark-prefix-help-command))
(setq prefix-help-command #'embark-prefix-help-command)
:config
(eval-when-compile
(defmacro my/embark-ace-action (fn)
`(defun ,(intern (concat "my/embark-ace-" (symbol-name fn))) ()
(interactive)
(with-demoted-errors "%s"
(require 'ace-window)
(let ((aw-dispatch-always t))
(aw-switch-to-window (aw-select nil))
(call-interactively (symbol-function ',fn)))))))
(define-key embark-file-map (kbd "o") (my/embark-ace-action find-file))
(define-key embark-buffer-map (kbd "o") (my/embark-ace-action switch-to-buffer))
(define-key embark-bookmark-map (kbd "o") (my/embark-ace-action bookmark-jump))
(eval-when-compile
(defmacro my/embark-split-action (fn split-type)
`(defun ,(intern (concat "my/embark-"
(symbol-name fn)
"-"
(car (last (split-string
(symbol-name split-type) "-"))))) ()
(interactive)
(funcall #',split-type)
(call-interactively #',fn))))
(define-key embark-file-map (kbd "2") (my/embark-split-action find-file split-window-below))
(define-key embark-buffer-map (kbd "2") (my/embark-split-action switch-to-buffer split-window-below))
(define-key embark-bookmark-map (kbd "2") (my/embark-split-action bookmark-jump split-window-below))
(define-key embark-file-map (kbd "3") (my/embark-split-action find-file split-window-right))
(define-key embark-buffer-map (kbd "3") (my/embark-split-action switch-to-buffer split-window-right))
(define-key embark-bookmark-map (kbd "3") (my/embark-split-action bookmark-jump split-window-right)))
(use-package embark-consult
:bind (:map minibuffer-mode-map
("C-c C-o" . embark-export))