Implement helm-dir-search
This is equivalent to helm-file-search with the current directory as the scope
This commit is contained in:
parent
ba17dd9158
commit
0b2dfd0297
|
@ -150,6 +150,7 @@
|
|||
- [[#searching-in-current-file][Searching in current file]]
|
||||
- [[#searching-in-all-open-buffers-visiting-files][Searching in all open buffers visiting files]]
|
||||
- [[#searching-in-files-in-an-arbitrary-directory][Searching in files in an arbitrary directory]]
|
||||
- [[#searching-in-current-directory][Searching in current directory]]
|
||||
- [[#searching-in-a-project][Searching in a project]]
|
||||
- [[#searching-the-web][Searching the web]]
|
||||
- [[#persistent-highlighting][Persistent highlighting]]
|
||||
|
@ -2562,6 +2563,22 @@ bindings (~SPC e n~ and ~SPC e p~) as well as the error transient state (~SPC e~
|
|||
| ~SPC s t f~ | =pt= |
|
||||
| ~SPC s t F~ | =pt= with default text |
|
||||
|
||||
**** Searching in current directory
|
||||
|
||||
| Key Binding | Description |
|
||||
|-----------------------+-----------------------------------------------------|
|
||||
| ~SPC /~ or ~SPC s d~ | search with the first found tool |
|
||||
| ~SPC *~ or ~SPC s D~ | search with the first found tool with default input |
|
||||
| ~SPC s a d~ | =ag= |
|
||||
| ~SPC s a D~ | =ag= with default text |
|
||||
| ~SPC s g d~ | =grep= with default text |
|
||||
| ~SPC s k d~ | =ack= |
|
||||
| ~SPC s k D~ | =ack= with default text |
|
||||
| ~SPC s t d~ | =pt= |
|
||||
| ~SPC s t D~ | =pt= with default text |
|
||||
| ~SPC s r d~ | =rg= |
|
||||
| ~SPC s r D~ | =rg= with default text |
|
||||
|
||||
**** Searching in a project
|
||||
|
||||
| Key Binding | Description |
|
||||
|
|
|
@ -275,6 +275,66 @@ Search for a search tool in the order provided by `dotspacemacs-search-tools'."
|
|||
(interactive)
|
||||
(spacemacs/helm-files-smart-do-search t))
|
||||
|
||||
;; Search in current dir -----------------------------------------------
|
||||
|
||||
(defun spacemacs/helm-dir-do-ag ()
|
||||
"Search in current directory with `ag'."
|
||||
(interactive)
|
||||
(spacemacs/helm-files-do-ag default-directory))
|
||||
|
||||
(defun spacemacs/helm-dir-do-ag-region-or-symbol ()
|
||||
"Search in current directory with `ag' with a default input."
|
||||
(interactive)
|
||||
(spacemacs//helm-do-ag-region-or-symbol 'spacemacs/helm-files-do-ag default-directory))
|
||||
|
||||
(defun spacemacs/helm-dir-do-ack ()
|
||||
"Search in current directory with `ack'."
|
||||
(interactive)
|
||||
(spacemacs/helm-files-do-ack default-directory))
|
||||
|
||||
(defun spacemacs/helm-dir-do-ack-region-or-symbol ()
|
||||
"Search in current directory with `ack' with a default input."
|
||||
(interactive)
|
||||
(spacemacs//helm-do-ag-region-or-symbol 'spacemacs/helm-files-do-ack default-directory))
|
||||
|
||||
(defun spacemacs/helm-dir-do-pt ()
|
||||
"Search in current directory with `pt'."
|
||||
(interactive)
|
||||
(spacemacs/helm-files-do-pt default-directory))
|
||||
|
||||
(defun spacemacs/helm-dir-do-pt-region-or-symbol ()
|
||||
"Search in current directory with `pt' with a default input."
|
||||
(interactive)
|
||||
(spacemacs//helm-do-ag-region-or-symbol 'spacemacs/helm-files-do-pt default-directory))
|
||||
|
||||
(defun spacemacs/helm-dir-do-rg ()
|
||||
"Search in current directory with `rg'."
|
||||
(interactive)
|
||||
(spacemacs/helm-files-do-rg default-directory))
|
||||
|
||||
(defun spacemacs/helm-dir-do-rg-region-or-symbol ()
|
||||
"Search in current directory with `rg' with a default input."
|
||||
(interactive)
|
||||
(spacemacs//helm-do-ag-region-or-symbol 'spacemacs/helm-files-do-rg default-directory))
|
||||
|
||||
(defun spacemacs/helm-dir-smart-do-search (&optional default-inputp)
|
||||
"Search in current directory using `dotspacemacs-search-tools'.
|
||||
Search for a search tool in the order provided by `dotspacemacs-search-tools'
|
||||
If DEFAULT-INPUTP is non nil then the current region or symbol at point
|
||||
are used as default input."
|
||||
(interactive)
|
||||
(call-interactively
|
||||
(spacemacs//helm-do-search-find-tool "helm-dir-do"
|
||||
dotspacemacs-search-tools
|
||||
default-inputp)))
|
||||
|
||||
(defun spacemacs/helm-dir-smart-do-search-region-or-symbol ()
|
||||
"Search in current directory using `dotspacemacs-search-tools'.
|
||||
with default input.
|
||||
Search for a search tool in the order provided by `dotspacemacs-search-tools'."
|
||||
(interactive)
|
||||
(spacemacs/helm-dir-smart-do-search t))
|
||||
|
||||
;; Search in buffers ---------------------------------------------------
|
||||
|
||||
(defun spacemacs/helm-buffers-do-ag (&optional _)
|
||||
|
@ -478,6 +538,17 @@ Search for a search tool in the order provided by `dotspacemacs-search-tools'."
|
|||
"srF" 'spacemacs/helm-files-do-rg-region-or-symbol
|
||||
"stf" 'spacemacs/helm-files-do-pt
|
||||
"stF" 'spacemacs/helm-files-do-pt-region-or-symbol
|
||||
;; current dir scope
|
||||
"sd" 'spacemacs/helm-dir-smart-do-search
|
||||
"sD" 'spacemacs/helm-dir-smart-do-search-region-or-symbol
|
||||
"sad" 'spacemacs/helm-dir-do-ag
|
||||
"saD" 'spacemacs/helm-dir-do-ag-region-or-symbol
|
||||
"skd" 'spacemacs/helm-dir-do-ack
|
||||
"skD" 'spacemacs/helm-dir-do-ack-region-or-symbol
|
||||
"srd" 'spacemacs/helm-dir-do-rg
|
||||
"srD" 'spacemacs/helm-dir-do-rg-region-or-symbol
|
||||
"std" 'spacemacs/helm-dir-do-pt
|
||||
"stD" 'spacemacs/helm-dir-do-pt-region-or-symbol
|
||||
;; current project scope
|
||||
"/" 'spacemacs/helm-project-smart-do-search
|
||||
"*" 'spacemacs/helm-project-smart-do-search-region-or-symbol
|
||||
|
|
Loading…
Reference in New Issue