]> code.delx.au - gnu-emacs-elpa/commitdiff
counsel.el (counsel-git-grep): Add optional initial-input
authorOleh Krehel <ohwoeowho@gmail.com>
Tue, 28 Apr 2015 19:58:44 +0000 (21:58 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Tue, 28 Apr 2015 19:58:44 +0000 (21:58 +0200)
* counsel.el (counsel-git-grep): Update.

Fixes #66

counsel.el

index f41608d8322b837687f43f3766d8d141e2bb72bd..27825fe9d7ed3664eeba34d1eb223fe593e3fac0 100644 (file)
         (setq ivy--full-length (counsel-git-grep-count ivy-text)))
       (split-string res "\n" t))))
 
-(defun counsel-git-grep ()
+(defun counsel-git-grep (&optional initial-input)
   "Grep for a string in the current git repository."
   (interactive)
   (unwind-protect
                                           (setq swiper--window (selected-window))
                                           (swiper--cleanup)
                                           (swiper--add-overlays (ivy--regex ivy-text)))))
-              (val (ivy-read "pattern: " 'counsel-git-grep-function)))
+              (val (ivy-read "pattern: " 'counsel-git-grep-function
+                             :initial-input initial-input)))
          (when val
            (funcall ivy--persistent-action val)))
     (swiper--cleanup)))