allow initial input in cp-ag and cp-rg
* counsel-projectile.el: (counsel-projectile-ag-initial-input): new variable (counsel-projectile-ag): use the above var (counsel-projectile-rg-initial-input): new variable (counsel-projectile-rg): use the above var [Closes #43]
This commit is contained in:
parent
d55966f113
commit
b9950f6f0b
1 changed files with 19 additions and 2 deletions
|
|
@ -208,6 +208,20 @@ BUFFER may be a string or nil."
|
|||
|
||||
;;; counsel-projectile-ag
|
||||
|
||||
(defvar counsel-projectile-ag-initial-input nil
|
||||
"Initial minibuffer input for `counsel-projectile-ag'. If non-nil, it should be a form whose evaluation yields the initial input string, e.g.
|
||||
|
||||
(setq counsel-projectile-ag-initial-input
|
||||
'(projectile-symbol-or-selection-at-point))
|
||||
|
||||
or
|
||||
|
||||
(setq counsel-projectile-ag-initial-input
|
||||
'(thing-at-point 'symbol t))
|
||||
|
||||
Note that you can always insert the value of `(ivy-thing-at-point)' by
|
||||
hitting \"M-n\" in the minibuffer.")
|
||||
|
||||
;;;###autoload
|
||||
(defun counsel-projectile-ag (&optional options)
|
||||
"Ivy version of `projectile-ag'."
|
||||
|
|
@ -229,7 +243,7 @@ BUFFER may be a string or nil."
|
|||
(concat "--ignore " (shell-quote-argument i)))
|
||||
ignored
|
||||
" "))))
|
||||
(counsel-ag nil
|
||||
(counsel-ag (eval counsel-projectile-ag-initial-input)
|
||||
(projectile-project-root)
|
||||
options
|
||||
(projectile-prepend-project-name "ag")))
|
||||
|
|
@ -237,6 +251,9 @@ BUFFER may be a string or nil."
|
|||
|
||||
;;; counsel-projectile-rg
|
||||
|
||||
(defvar counsel-projectile-rg-initial-input nil
|
||||
"Initial minibuffer input for `counsel-projectile-rg'. See `counsel-projectile-ag-initial-input' for details.")
|
||||
|
||||
;;;###autoload
|
||||
(defun counsel-projectile-rg (&optional options)
|
||||
"Ivy version of `projectile-rg'."
|
||||
|
|
@ -258,7 +275,7 @@ BUFFER may be a string or nil."
|
|||
(concat "--glob " (shell-quote-argument (concat "!" i))))
|
||||
ignored
|
||||
" "))))
|
||||
(counsel-rg nil
|
||||
(counsel-rg (eval counsel-projectile-rg-initial-input)
|
||||
(projectile-project-root)
|
||||
options
|
||||
(projectile-prepend-project-name "rg")))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue