[oni-core] Add related-files[1] to consult-buffer[2]
[1]: https://github.com/DamienCassou/related-files [2]: https://github.com/minad/consult
This commit is contained in:
parent
5f7a6b8ddd
commit
d0420ae5e3
1 changed files with 23 additions and 1 deletions
24
oni-core.el
24
oni-core.el
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
;; Author: Tom Willemse <tom@ryuslash.org>
|
;; Author: Tom Willemse <tom@ryuslash.org>
|
||||||
;; Keywords: local
|
;; Keywords: local
|
||||||
;; Version: 2022.1213.071035
|
;; Version: 2022.1213.071336
|
||||||
;; Package-Requires: (oni-data-dir oni-embrace oni-hydra expand-region multiple-cursors gcmh diminish ws-butler which-key insert-char-preview mixed-pitch ace-window vertico marginalia orderless consult embark docstr)
|
;; Package-Requires: (oni-data-dir oni-embrace oni-hydra expand-region multiple-cursors gcmh diminish ws-butler which-key insert-char-preview mixed-pitch ace-window vertico marginalia orderless consult embark docstr)
|
||||||
|
|
||||||
;; This program is free software; you can redistribute it and/or modify
|
;; This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -407,6 +407,28 @@ _s_: String list"
|
||||||
(global-set-key (kbd "M-g M") '("Jump to a mark anywhere" . consult-global-mark))
|
(global-set-key (kbd "M-g M") '("Jump to a mark anywhere" . consult-global-mark))
|
||||||
(global-set-key [remap imenu] 'consult-imenu)
|
(global-set-key [remap imenu] 'consult-imenu)
|
||||||
|
|
||||||
|
(defun oni-core-related-files ()
|
||||||
|
"Return a list of files related to the current buffer."
|
||||||
|
(let* ((jumpers related-files-jumpers)
|
||||||
|
(current-place (buffer-file-name)))
|
||||||
|
(cond ((not jumpers)
|
||||||
|
(user-error "No jumpers. Consider configuring `related-files-jumpers'"))
|
||||||
|
((not current-place)
|
||||||
|
(user-error "Related-Files only works from file-based buffers"))
|
||||||
|
(t
|
||||||
|
(related-files--collect-existing-places jumpers current-place)))))
|
||||||
|
|
||||||
|
(defvar oni-core-related-places-source
|
||||||
|
'(:name "Related File"
|
||||||
|
:category file
|
||||||
|
:items oni-related-files
|
||||||
|
:enabled buffer-file-name
|
||||||
|
:action find-file))
|
||||||
|
|
||||||
|
(with-eval-after-load 'consult
|
||||||
|
(with-eval-after-load 'related-files
|
||||||
|
(add-to-list 'consult-buffer-sources 'oni-related-places-source)))
|
||||||
|
|
||||||
;;; Embark
|
;;; Embark
|
||||||
|
|
||||||
(global-set-key (kbd "C-.") 'embark-act)
|
(global-set-key (kbd "C-.") 'embark-act)
|
||||||
|
|
Loading…
Reference in a new issue