2024-05-03 19:29:31 +00:00
|
|
|
;; -*- lexical-binding: t; -*-
|
|
|
|
|
|
|
|
(use-package navi
|
2024-05-23 04:53:32 +00:00
|
|
|
:straight `(:local-repo ,(expand-file-name "packages/navi" user-emacs-directory) :type nil)
|
2024-05-03 19:29:31 +00:00
|
|
|
:defer t
|
2024-05-06 14:02:59 +00:00
|
|
|
:commands (navi
|
|
|
|
navi-by-tags
|
|
|
|
navi-matching-current-directory
|
|
|
|
navi-visit-cheat-file
|
|
|
|
navi-all-cheats
|
|
|
|
navi-cheats-for-tags
|
|
|
|
navi-cheats-matching-filename
|
|
|
|
navi-cheat-summary)
|
2024-05-03 19:29:31 +00:00
|
|
|
:init
|
|
|
|
(defvar-keymap embark-navi-map
|
|
|
|
:doc "Keymap for actions on Navi cheats"
|
2024-05-04 01:40:12 +00:00
|
|
|
:parent embark-general-map
|
2024-05-03 19:29:31 +00:00
|
|
|
"f" #'navi-visit-cheat-file)
|
|
|
|
(with-eval-after-load 'embark
|
|
|
|
(add-to-list 'embark-keymap-alist '(navi . embark-navi-map)))
|
|
|
|
|
|
|
|
(defun run-command-recipe-navi ()
|
|
|
|
(let* ((dir (or (projectile-project-root) default-directory))
|
|
|
|
(cheat-files
|
|
|
|
(append
|
|
|
|
(navi-cheats-matching-filename (regexp-quote dir)))))
|
|
|
|
(-mapcat
|
|
|
|
(lambda (cheat-file)
|
|
|
|
(-map (lambda (cheat)
|
|
|
|
(list :command-name (navi-cheat-summary cheat)
|
|
|
|
:command-line (lambda () (navi-cheat-render cheat))
|
|
|
|
:working-dir dir))
|
|
|
|
(oref cheat-file cheats)))
|
|
|
|
cheat-files)))
|
|
|
|
(with-eval-after-load 'run-command
|
|
|
|
(add-to-list 'run-command-recipes 'run-command-recipe-navi)))
|
|
|
|
|
|
|
|
(provide 'init-navi)
|