Add SPC * for project-searching symbol at point
This commit is contained in:
parent
4aec51525b
commit
5e8687cd45
2 changed files with 24 additions and 2 deletions
|
@ -520,6 +520,8 @@
|
||||||
(cond ((featurep! :completion ivy) #'ivy-resume)
|
(cond ((featurep! :completion ivy) #'ivy-resume)
|
||||||
((featurep! :completion helm) #'helm-resume))
|
((featurep! :completion helm) #'helm-resume))
|
||||||
|
|
||||||
|
:desc "Search for symbol in project" "*" #'+default/search-project-for-symbol-at-point
|
||||||
|
|
||||||
:desc "Find file in project" "SPC" #'projectile-find-file
|
:desc "Find file in project" "SPC" #'projectile-find-file
|
||||||
:desc "Blink cursor line" "DEL" #'+nav-flash/blink-cursor
|
:desc "Blink cursor line" "DEL" #'+nav-flash/blink-cursor
|
||||||
:desc "Jump to bookmark" "RET" #'bookmark-jump
|
:desc "Jump to bookmark" "RET" #'bookmark-jump
|
||||||
|
|
|
@ -235,8 +235,8 @@ If prefix ARG is set, prompt for a directory to search from."
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +default/search-project (&optional arg)
|
(defun +default/search-project (&optional arg)
|
||||||
"Conduct a text search in files under the project root.
|
"Conduct a text search in the current project root.
|
||||||
If prefix ARG is set, prompt for a project to search from."
|
If prefix ARG is set, prompt for a known project to search from."
|
||||||
(interactive "P")
|
(interactive "P")
|
||||||
(let ((default-directory
|
(let ((default-directory
|
||||||
(if arg
|
(if arg
|
||||||
|
@ -249,3 +249,23 @@ If prefix ARG is set, prompt for a project to search from."
|
||||||
(cond ((featurep! :completion ivy) #'+ivy/project-search)
|
(cond ((featurep! :completion ivy) #'+ivy/project-search)
|
||||||
((featurep! :completion helm) #'+helm/project-search)
|
((featurep! :completion helm) #'+helm/project-search)
|
||||||
(#'rgrep)))))
|
(#'rgrep)))))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +default/search-project-for-symbol-at-point (&optional arg symbol)
|
||||||
|
"Conduct a text search in the current project for symbol at point.
|
||||||
|
If prefix ARG is set, prompt for a known project to search from."
|
||||||
|
(interactive
|
||||||
|
(list current-prefix-arg
|
||||||
|
(thing-at-point 'symbol t)))
|
||||||
|
(let ((default-directory
|
||||||
|
(if arg
|
||||||
|
(if-let* ((projects (projectile-relevant-known-projects)))
|
||||||
|
(completing-read "Switch to project: " projects
|
||||||
|
nil t nil nil (doom-project-root))
|
||||||
|
(user-error "There are no known projects"))
|
||||||
|
default-directory)))
|
||||||
|
(cond ((featurep! :completion ivy)
|
||||||
|
(+ivy/rg nil symbol))
|
||||||
|
((featurep! :completion helm)
|
||||||
|
(+helm/rg nil symbol))
|
||||||
|
((rgrep (regexp-opt symbol))))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue