Add +default/search-from-cwd & +default/search-project
This commit is contained in:
parent
748b197676
commit
f2b8280b2a
2 changed files with 33 additions and 6 deletions
|
@ -547,15 +547,11 @@
|
||||||
(:prefix ("/" . "search")
|
(:prefix ("/" . "search")
|
||||||
:desc "Jump to symbol across buffers" "I" #'imenu-anywhere
|
:desc "Jump to symbol across buffers" "I" #'imenu-anywhere
|
||||||
:desc "Search buffer" "b" #'swiper
|
:desc "Search buffer" "b" #'swiper
|
||||||
:desc "Search current directory" "d"
|
:desc "Search current directory" "d" #'+default/search-from-cwd
|
||||||
(cond ((featurep! :completion ivy) #'+ivy/project-search-from-cwd)
|
|
||||||
((featurep! :completion helm) #'+helm/project-search-from-cwd))
|
|
||||||
:desc "Jump to symbol" "i" #'imenu
|
:desc "Jump to symbol" "i" #'imenu
|
||||||
:desc "Jump to link" "l" #'ace-link
|
:desc "Jump to link" "l" #'ace-link
|
||||||
:desc "Look up online" "o" #'+lookup/online-select
|
:desc "Look up online" "o" #'+lookup/online-select
|
||||||
:desc "Search project" "p"
|
:desc "Search project" "p" #'+default/search-project)
|
||||||
(cond ((featurep! :completion ivy) #'+ivy/project-search)
|
|
||||||
((featurep! :completion helm) #'+helm/project-search)))
|
|
||||||
|
|
||||||
(:when (featurep! :feature workspaces)
|
(:when (featurep! :feature workspaces)
|
||||||
(:prefix ("TAB" . "workspace")
|
(:prefix ("TAB" . "workspace")
|
||||||
|
|
|
@ -218,3 +218,34 @@ possible, or just one char if that's not possible."
|
||||||
((doom--backward-delete-whitespace-to-column)))))))
|
((doom--backward-delete-whitespace-to-column)))))))
|
||||||
;; Otherwise, do simple deletion.
|
;; Otherwise, do simple deletion.
|
||||||
((delete-char (- n) killflag))))
|
((delete-char (- n) killflag))))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +default/search-from-cwd (&optional arg)
|
||||||
|
"Conduct a text search in files under the current folder.
|
||||||
|
If prefix ARG is set, prompt for a directory to search from."
|
||||||
|
(interactive "P")
|
||||||
|
(let ((default-directory
|
||||||
|
(if arg
|
||||||
|
(read-directory-name "Switch to project: " default-directory)
|
||||||
|
default-directory)))
|
||||||
|
(call-interactively
|
||||||
|
(cond ((featurep! :completion ivy) #'+ivy/project-search-from-cwd)
|
||||||
|
((featurep! :completion helm) #'+helm/project-search-from-cwd)
|
||||||
|
(#'projectile-grep)))))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +default/search-project (&optional arg)
|
||||||
|
"Conduct a text search in files under the project root.
|
||||||
|
If prefix ARG is set, prompt for a project to search from."
|
||||||
|
(interactive "P")
|
||||||
|
(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)))
|
||||||
|
(call-interactively
|
||||||
|
(cond ((featurep! :completion ivy) #'+ivy/project-search)
|
||||||
|
((featurep! :completion helm) #'+helm/project-search)
|
||||||
|
(#'rgrep)))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue