39 lines
1.3 KiB
EmacsLisp
39 lines
1.3 KiB
EmacsLisp
;; -*- lexical-binding: t; -*-
|
|
|
|
(use-package navi
|
|
:straight `(:local-repo ,(expand-file-name "packages/navi" user-emacs-directory) :type nil)
|
|
:defer t
|
|
: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)
|
|
:init
|
|
(defvar-keymap embark-navi-map
|
|
:doc "Keymap for actions on Navi cheats"
|
|
:parent embark-general-map
|
|
"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)
|