Implement directory search for ivy as well

This commit is contained in:
Eivind Fonn 2017-07-01 12:41:26 +02:00
parent 0b2dfd0297
commit ebc6ba015e
2 changed files with 30 additions and 1 deletions

View file

@ -215,7 +215,24 @@ that directory."
"a tool selected from `dotspacemacs-search-tools'."
tool-name))
(interactive)
(spacemacs/counsel-search ,tools t (projectile-project-root))))))
(spacemacs/counsel-search ,tools t (projectile-project-root)))
(defun ,(intern (format "spacemacs/search-dir-%s" tool-name)) ()
,(format
"Use `spacemacs/counsel-search' to search in the current
directory with %s." (if (string= tool-name "auto")
"a tool selected from `dotspacemacs-search-tools'."
tool-name))
(interactive)
(spacemacs/counsel-search ,tools nil default-directory))
(defun ,(intern (format "spacemacs/search-dir-%s-region-or-symbol" tool-name)) ()
,(format
"Use `spacemacs/counsel-search' to search for
the selected region or the symbol around point in the current
directory with %s." (if (string= tool-name "auto")
"a tool selected from `dotspacemacs-search-tools'."
tool-name))
(interactive)
(spacemacs/counsel-search ,tools t default-directory)))))
(defun spacemacs/counsel-git-grep-region-or-symbol ()
"Use `counsel-git-grep' to search for the selected region or

View file

@ -72,26 +72,38 @@
;; search
"/" 'spacemacs/search-project-auto
"*" 'spacemacs/search-project-auto-region-or-symbol
"sd" 'spacemacs/search-dir-auto
"sD" 'spacemacs/search-dir-auto-region-or-symbol
"sf" 'spacemacs/search-auto
"sF" 'spacemacs/search-auto-region-or-symbol
"sp" 'spacemacs/search-project-auto
"sP" 'spacemacs/search-project-auto-region-or-symbol
"sad" 'spacemacs/search-dir-ag
"saD" 'spacemacs/search-dir-ag-region-or-symbol
"saf" 'spacemacs/search-ag
"saF" 'spacemacs/search-ag-region-or-symbol
"sap" 'spacemacs/search-project-ag
"saP" 'spacemacs/search-project-ag-region-or-symbol
"sgd" 'spacemacs/search-dir-grep
"sgD" 'spacemacs/search-dir-grep-region-or-symbol
"sgf" 'spacemacs/search-grep
"sgF" 'spacemacs/search-grep-region-or-symbol
"sgp" 'counsel-git-grep
"sgP" 'spacemacs/counsel-git-grep-region-or-symbol
"skd" 'spacemacs/search-ack-grep
"skD" 'spacemacs/search-ack-grep-region-or-symbol
"skf" 'spacemacs/search-ack
"skF" 'spacemacs/search-ack-region-or-symbol
"skp" 'spacemacs/search-project-ack
"skP" 'spacemacs/search-project-ack-region-or-symbol
"srd" 'spacemacs/search-rg-grep
"srD" 'spacemacs/search-rg-grep-region-or-symbol
"srf" 'spacemacs/search-rg
"srF" 'spacemacs/search-rg-region-or-symbol
"srp" 'spacemacs/search-project-rg
"srP" 'spacemacs/search-project-rg-region-or-symbol
"std" 'spacemacs/search-pt-grep
"stD" 'spacemacs/search-pt-grep-region-or-symbol
"stf" 'spacemacs/search-pt
"stF" 'spacemacs/search-pt-region-or-symbol
"stp" 'spacemacs/search-project-pt