Add SPC / D and SPC / P keybinds #1531

For searching from another directory/project (prompted)
This commit is contained in:
Henrik Lissner 2019-07-02 14:13:30 +02:00
parent 65efbc4204
commit 9ffb740b0f
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 19 additions and 5 deletions

View file

@ -550,13 +550,15 @@
;;; <leader> / --- search
(:prefix-map ("/" . "search")
:desc "Search buffer" "b" #'swiper
:desc "Search current directory" "d" #'+default/search-from-cwd
:desc "Search current directory" "d" #'+default/search-cwd
:desc "Search other directory" "D" #'+default/search-other-cwd
:desc "Jump to symbol" "i" #'imenu
:desc "Jump to link" "l" #'ace-link
:desc "Look up online" "o" #'+lookup/online-select
:desc "Look up in local docsets" "k" #'+lookup/in-docsets
:desc "Look up in all docsets" "K" #'+lookup/in-all-docsets
:desc "Search project" "p" #'+default/search-project)
:desc "Search project" "p" #'+default/search-project
:desc "Search other project" "P" #'+default/search-other-project)
;;; <leader> TAB --- workspace
(:when (featurep! :ui workspaces)

View file

@ -220,7 +220,7 @@ possible, or just one char if that's not possible."
((delete-char (- n) killflag))))
;;;###autoload
(defun +default/search-from-cwd (&optional arg)
(defun +default/search-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")
@ -231,7 +231,13 @@ If prefix ARG is set, prompt for a directory to search from."
(call-interactively
(cond ((featurep! :completion ivy) #'+ivy/project-search-from-cwd)
((featurep! :completion helm) #'+helm/project-search-from-cwd)
(#'projectile-grep)))))
(#'rgrep)))))
;;;###autoload
(defun +default/search-other-cwd ()
"Conduct a text search in another directory."
(interactive)
(+default/search-cwd 'other))
;;;###autoload
(defun +default/search-project (&optional arg)
@ -248,7 +254,13 @@ If prefix ARG is set, prompt for a known project to search from."
(call-interactively
(cond ((featurep! :completion ivy) #'+ivy/project-search)
((featurep! :completion helm) #'+helm/project-search)
(#'rgrep)))))
(#'projectile-grep)))))
;;;###autoload
(defun +default/search-other-project ()
"Conduct a text search in a known project."
(interactive)
(+default/search-project 'other))
;;;###autoload
(defun +default/search-project-for-symbol-at-point (&optional arg symbol)