Replace completion backend in shortcut function with consult
This is more consistent with other completion functions.
This commit is contained in:
parent
2159114cba
commit
7a906344bb
47
init.el
47
init.el
@ -2463,6 +2463,7 @@ Note that this workaround is incomplete, as explained in this comment."
|
|||||||
consult-mark
|
consult-mark
|
||||||
consult-yank-pop
|
consult-yank-pop
|
||||||
consult-outline)
|
consult-outline)
|
||||||
|
:autoload (consult--multi)
|
||||||
:init (progn
|
:init (progn
|
||||||
;; Settings taken from https://protesilaos.com/emacs/dotemacs#h:22e97b4c-d88d-4deb-9ab3-f80631f9ff1d
|
;; Settings taken from https://protesilaos.com/emacs/dotemacs#h:22e97b4c-d88d-4deb-9ab3-f80631f9ff1d
|
||||||
(setq consult-line-numbers-widen t
|
(setq consult-line-numbers-widen t
|
||||||
@ -2487,39 +2488,37 @@ Note that this workaround is incomplete, as explained in this comment."
|
|||||||
|
|
||||||
;; * Navigation
|
;; * Navigation
|
||||||
|
|
||||||
(defun db/helm-shortcuts (arg)
|
(defun db/shortcuts ()
|
||||||
"Open helm completion on common locations.
|
"Open helm completion on common locations."
|
||||||
|
(interactive)
|
||||||
With universal argument ARG, inhibit display of files in
|
(let (sources)
|
||||||
`db/important-document-path’. This might be helpful when loading
|
(push (list :name "Frequently Used"
|
||||||
is too slow (in this case, `db/important-document-path' should
|
:items (mapcar #'(lambda (entry)
|
||||||
eventuelly be set to nil, however)."
|
|
||||||
(interactive "P")
|
|
||||||
(helm :sources (list
|
|
||||||
(helm-make-source "Frequently Used" 'helm-source-sync
|
|
||||||
:candidates (mapcar #'(lambda (entry)
|
|
||||||
(cons (car entry)
|
(cons (car entry)
|
||||||
(caddr entry)))
|
(caddr entry)))
|
||||||
db/frequently-used-features)
|
db/frequently-used-features)
|
||||||
:action '(("Open" . call-interactively)))
|
:annotate #'(lambda (_) "")
|
||||||
|
:action #'call-interactively)
|
||||||
helm-source-bookmarks
|
sources)
|
||||||
|
(push 'consult--source-bookmark
|
||||||
;; If no prefix arg is given, extract files from
|
sources)
|
||||||
;; `db/important-documents-path’ and list them as well
|
(when (file-directory-p db/important-documents-path)
|
||||||
(when (and (not arg)
|
|
||||||
(file-directory-p db/important-documents-path))
|
|
||||||
(let ((search-path (expand-file-name db/important-documents-path)))
|
(let ((search-path (expand-file-name db/important-documents-path)))
|
||||||
(helm-make-source "Important files" 'helm-source-sync
|
(push (list :name "Important Files"
|
||||||
:candidates (mapcar #'(lambda (file)
|
:narrow ?f
|
||||||
|
:items (mapcar #'(lambda (file)
|
||||||
;; Display only relative path,
|
;; Display only relative path,
|
||||||
;; but keep absolute path for
|
;; but keep absolute path for
|
||||||
;; actions
|
;; actions
|
||||||
(cons (string-remove-prefix search-path file)
|
(cons (string-remove-prefix search-path file)
|
||||||
file))
|
file))
|
||||||
(directory-files-recursively search-path ""))
|
(directory-files-recursively search-path ""))
|
||||||
:action '(("Open externally" . db/system-open)
|
:annotate #'(lambda (_) "")
|
||||||
("Find file" . find-file))))))))
|
:action #'db/system-open)
|
||||||
|
sources)))
|
||||||
|
(consult--multi (nreverse sources)
|
||||||
|
:require-match t
|
||||||
|
:sort nil)))
|
||||||
|
|
||||||
(use-package ace-window
|
(use-package ace-window
|
||||||
:ensure t
|
:ensure t
|
||||||
@ -3174,7 +3173,7 @@ eventuelly be set to nil, however)."
|
|||||||
(bind-key "C-x C-j" #'dired-jump)
|
(bind-key "C-x C-j" #'dired-jump)
|
||||||
(bind-key "C-x C-r" #'revert-buffer)
|
(bind-key "C-x C-r" #'revert-buffer)
|
||||||
(bind-key "C-x SPC" #'hydra-rectangle/body)
|
(bind-key "C-x SPC" #'hydra-rectangle/body)
|
||||||
(bind-key "C-x g" #'db/helm-shortcuts)
|
(bind-key "C-x g" #'db/shortcuts)
|
||||||
(bind-key "C-x r E" #'db/bookmark-add-external)
|
(bind-key "C-x r E" #'db/bookmark-add-external)
|
||||||
(bind-key "C-x r M" #'db/bookmark-add-url)
|
(bind-key "C-x r M" #'db/bookmark-add-url)
|
||||||
(bind-key "C-x r v" #'list-registers)
|
(bind-key "C-x r v" #'list-registers)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user