Skip to content
Snippets Groups Projects
Commit 9e96df4b authored by MoScribe's avatar MoScribe
Browse files

add rg search supports

parent f520535a
No related branches found
No related tags found
No related merge requests found
......@@ -138,7 +138,7 @@
(user-error "Couldn't find ripgrep in your PATH"))
(require 'counsel)
(let* ((this-command 'counsel-rg)
(project-root (or (doom-project-root) default-directory))
(project-root default-directory)
(directory (or in project-root))
(args (concat (if all-files " -uu")
(unless recursive " --maxdepth 1")
......@@ -177,5 +177,13 @@ in the search."
(interactive "P")
(ivy-file-search :query initial-query :in directory :all-files arg))
(defun ivy/project-search-from-cwd (&optional arg initial-query)
"Performs a project search recursively from the current directory.
If ARG, include all files."
(interactive "P")
(ivy/project-search arg initial-query default-directory)
)
(provide 'completion)
;;; completion.el ends here
......@@ -10,9 +10,11 @@
"f f" 'counsel-find-file
"f r" 'counsel-recentf
"f s" 'save-buffer
;; "SPC" 'counsel-M-x
"SPC" 'execute-extended-command
"SPC" 'counsel-M-x
;; "SPC" 'execute-extended-command
"s s" 'swiper
"s d" 'user/search-dir
"s p" 'user/search-project
"h i" 'counsel-imenu
;; buffer
"b d" 'kill-current-buffer
......
......@@ -75,5 +75,16 @@ If prefix ARG is set, include ignored/hidden files."
#'ivy/project-search)
))
(defun user/search-dir (&optional arg)
"Conduct a text search in files under the current folder."
(interactive "P")
(let ((default-directory
(if arg
(read-directory-name "Search directory: ")
default-directory)))
(call-interactively
#'ivy/project-search-from-cwd))
)
(provide 'search)
;;; search.el ends here
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment