Bind 'SPC h d l' for text-searching load-path
Co-authored-by: Rudi Grinberg <139003+rgrinberg@users.noreply.github.com>
This commit is contained in:
parent
820264166c
commit
0df480bf85
2 changed files with 29 additions and 0 deletions
|
@ -570,3 +570,31 @@ config blocks in your private config."
|
|||
"Open PACKAGE's repo or homepage in your browser."
|
||||
(interactive (list (doom--package-list)))
|
||||
(browse-url (doom--package-url package)))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/help-search-load-path (query)
|
||||
"Perform a text search on your `load-path'.
|
||||
Uses the symbol at point or the current selection, if available."
|
||||
(interactive
|
||||
(let ((query
|
||||
;; TODO Generalize this later; into something the lookup module and
|
||||
;; project search commands could as well.
|
||||
(if (use-region-p)
|
||||
(buffer-substring-no-properties (region-beginning) (region-end))
|
||||
(or (symbol-name (symbol-at-point)) ""))))
|
||||
(list (read-string
|
||||
(format "Search load-path (default: %s): " query)
|
||||
nil 'git-grep query))))
|
||||
;; REVIEW Replace with deadgrep or ivy/helm interface when we drop ag/git-grep
|
||||
;; support later
|
||||
(grep-find
|
||||
(mapconcat
|
||||
#'shell-quote-argument
|
||||
(cond ((executable-find "rg")
|
||||
`("rg" "--search-zip" "--no-heading" "--color=never"
|
||||
,query ,@(cl-remove-if-not #'file-directory-p load-path)))
|
||||
((executable-find "ag")
|
||||
`("ag" "--search-zip" "--nogroup" "--nocolor"
|
||||
,query ,@(cl-remove-if-not #'file-directory-p load-path)))
|
||||
((user-error "This command requires ripgrep or the_silver_searcher to be installed on your system")))
|
||||
" ")))
|
||||
|
|
|
@ -313,6 +313,7 @@
|
|||
"dd" #'doom/toggle-debug-mode
|
||||
"df" #'doom/help-faq
|
||||
"dh" #'doom/help
|
||||
"dl" #'doom/help-search-load-path
|
||||
"dm" #'doom/help-modules
|
||||
"dn" #'doom/help-news
|
||||
"dN" #'doom/help-news-search
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue