mirror of
https://codeberg.org/scip/dot-emacs.git
synced 2026-08-24 05:34:18 +02:00
re-enable embark, tune a little
This commit is contained in:
@@ -37,7 +37,7 @@ via [[http://whattheemacsd.com/setup-ido.el-02.html][whattheemacs.d]]"
|
|||||||
(insert "~/"))
|
(insert "~/"))
|
||||||
(call-interactively 'self-insert-command)))
|
(call-interactively 'self-insert-command)))
|
||||||
|
|
||||||
(defun tvd-vertico-jump-root()
|
(defun tvd-vertico-jump-root()
|
||||||
"quickly go to root dir with / in minibuffer find-file, if we are in a local fs"
|
"quickly go to root dir with / in minibuffer find-file, if we are in a local fs"
|
||||||
(interactive)
|
(interactive)
|
||||||
(if (file-directory-p (file-name-directory (minibuffer-contents-no-properties)))
|
(if (file-directory-p (file-name-directory (minibuffer-contents-no-properties)))
|
||||||
@@ -65,8 +65,8 @@ a remote file anytime and from everywhere I am by just entering :"
|
|||||||
(delete-char -1))
|
(delete-char -1))
|
||||||
(if (search-backward "/" nil t)
|
(if (search-backward "/" nil t)
|
||||||
(let ((beg (+ (point) 1)))
|
(let ((beg (+ (point) 1)))
|
||||||
(end-of-buffer)
|
(end-of-buffer)
|
||||||
(delete-region beg (point)))
|
(delete-region beg (point)))
|
||||||
(delete-char -1)))
|
(delete-char -1)))
|
||||||
(delete-char -1)))
|
(delete-char -1)))
|
||||||
|
|
||||||
@@ -104,8 +104,6 @@ a remote file anytime and from everywhere I am by just entering :"
|
|||||||
("TAB" . #'minibuffer-complete)))
|
("TAB" . #'minibuffer-complete)))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(use-package orderless
|
(use-package orderless
|
||||||
:init
|
:init
|
||||||
;; I am using the actual orderless completion style as a last
|
;; I am using the actual orderless completion style as a last
|
||||||
@@ -128,38 +126,72 @@ a remote file anytime and from everywhere I am by just entering :"
|
|||||||
completion-category-overrides '((file (styles basic partial-completion))))
|
completion-category-overrides '((file (styles basic partial-completion))))
|
||||||
|
|
||||||
(setq read-file-name-completion-ignore-case t
|
(setq read-file-name-completion-ignore-case t
|
||||||
read-buffer-completion-ignore-case t
|
read-buffer-completion-ignore-case t
|
||||||
completion-ignore-case t))
|
completion-ignore-case t))
|
||||||
|
|
||||||
|
|
||||||
|
(use-package embark
|
||||||
|
:ensure t
|
||||||
|
|
||||||
(when nil
|
:bind
|
||||||
(use-package embark
|
(("C-." . embark-act) ;; pick some comfortable binding
|
||||||
:ensure t
|
("C-," . embark-dwim)) ;; good alternative: M-.
|
||||||
|
|
||||||
:bind
|
|
||||||
(("C-." . embark-act) ;; pick some comfortable binding
|
|
||||||
("C-," . embark-dwim)) ;; good alternative: M-.
|
|
||||||
|
|
||||||
|
|
||||||
:init
|
:init
|
||||||
|
;; Optionally replace the key help with a completing-read interface
|
||||||
|
(setq prefix-help-command #'embark-prefix-help-command)
|
||||||
|
|
||||||
;; Optionally replace the key help with a completing-read interface
|
;; Show the Embark target at point via Eldoc. You may adjust the Eldoc
|
||||||
(setq prefix-help-command #'embark-prefix-help-command)
|
;; strategy, if you want to see the documentation from multiple providers.
|
||||||
|
(add-hook 'eldoc-documentation-functions #'embark-eldoc-first-target)
|
||||||
|
;; (setq eldoc-documentation-strategy #'eldoc-documentation-compose-eagerly)
|
||||||
|
|
||||||
;; Show the Embark target at point via Eldoc. You may adjust the Eldoc
|
:config
|
||||||
;; strategy, if you want to see the documentation from multiple providers.
|
;; Hide the mode line of the Embark live/completions buffers
|
||||||
(add-hook 'eldoc-documentation-functions #'embark-eldoc-first-target)
|
(add-to-list 'display-buffer-alist
|
||||||
;; (setq eldoc-documentation-strategy #'eldoc-documentation-compose-eagerly)
|
'("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
|
||||||
|
nil
|
||||||
|
(window-parameters (mode-line-format . none))))
|
||||||
|
|
||||||
:config
|
|
||||||
|
|
||||||
;; Hide the mode line of the Embark live/completions buffers
|
(defun embark-which-key-indicator ()
|
||||||
(add-to-list 'display-buffer-alist
|
"An embark indicator that displays keymaps using which-key.
|
||||||
'("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
|
The which-key help message will show the type and value of the
|
||||||
nil
|
current target followed by an ellipsis if there are further
|
||||||
(window-parameters (mode-line-format . none))))))
|
targets."
|
||||||
|
(lambda (&optional keymap targets prefix)
|
||||||
|
(if (null keymap)
|
||||||
|
(which-key--hide-popup-ignore-command)
|
||||||
|
(which-key--show-keymap
|
||||||
|
(if (eq (plist-get (car targets) :type) '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 (lambda (binding)
|
||||||
|
(not (string-suffix-p "-argument" (cdr binding))))))))
|
||||||
|
|
||||||
|
(setq embark-indicators
|
||||||
|
'(embark-which-key-indicator
|
||||||
|
embark-highlight-indicator
|
||||||
|
embark-isearch-highlight-indicator))
|
||||||
|
|
||||||
|
(defun embark-hide-which-key-indicator (fn &rest args)
|
||||||
|
"Hide the which-key indicator immediately when using the completing-read prompter."
|
||||||
|
(which-key--hide-popup-ignore-command)
|
||||||
|
(let ((embark-indicators
|
||||||
|
(remq #'embark-which-key-indicator embark-indicators)))
|
||||||
|
(apply fn args)))
|
||||||
|
|
||||||
|
(advice-add #'embark-completing-read-prompter
|
||||||
|
:around #'embark-hide-which-key-indicator))
|
||||||
|
|
||||||
(use-package consult
|
(use-package consult
|
||||||
;; Replace bindings. Lazily loaded due by `use-package'.
|
;; Replace bindings. Lazily loaded due by `use-package'.
|
||||||
@@ -210,12 +242,9 @@ a remote file anytime and from everywhere I am by just entering :"
|
|||||||
("C-x C-d" . consult-dir)))
|
("C-x C-d" . consult-dir)))
|
||||||
|
|
||||||
|
|
||||||
|
(use-package
|
||||||
(when nil
|
embark-consult
|
||||||
(use-package
|
:after (embark consult))
|
||||||
embark-consult
|
|
||||||
:after (embark consult)))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;; Persist history over Emacs restarts. Vertico sorts by history position.
|
;; Persist history over Emacs restarts. Vertico sorts by history position.
|
||||||
@@ -236,7 +265,7 @@ a remote file anytime and from everywhere I am by just entering :"
|
|||||||
(corfu-cycle t)
|
(corfu-cycle t)
|
||||||
(corfu-preselect 'prompt)
|
(corfu-preselect 'prompt)
|
||||||
|
|
||||||
:bind
|
:bind
|
||||||
(:map corfu-map
|
(:map corfu-map
|
||||||
("TAB" . corfu-next)
|
("TAB" . corfu-next)
|
||||||
([tab] . corfu-next)
|
([tab] . corfu-next)
|
||||||
@@ -248,10 +277,9 @@ a remote file anytime and from everywhere I am by just entering :"
|
|||||||
;; do the job as well and looks similar, but I'm used to swiper, so
|
;; do the job as well and looks similar, but I'm used to swiper, so
|
||||||
;; stick with it.
|
;; stick with it.
|
||||||
(use-package swiper
|
(use-package swiper
|
||||||
:config
|
:config
|
||||||
(setq ivy-wrap t)
|
(setq ivy-wrap t)
|
||||||
(global-set-key "\C-s" 'swiper))
|
(global-set-key "\C-s" 'swiper))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(provide 'init-smarter-than-emacs)
|
(provide 'init-smarter-than-emacs)
|
||||||
|
|||||||
Reference in New Issue
Block a user