aboutsummaryrefslogtreecommitdiffstats
path: root/oni-core.el
diff options
context:
space:
mode:
Diffstat (limited to 'oni-core.el')
-rw-r--r--oni-core.el24
1 files changed, 23 insertions, 1 deletions
diff --git a/oni-core.el b/oni-core.el
index 0f55ee9..9ba6943 100644
--- a/oni-core.el
+++ b/oni-core.el
@@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; 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)
;; 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 [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
(global-set-key (kbd "C-.") 'embark-act)