[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master f5a32bf 04/18: Add a command to grep the current git repo
From: |
Oleh Krehel |
Subject: |
[elpa] master f5a32bf 04/18: Add a command to grep the current git repo |
Date: |
Mon, 20 Apr 2015 12:39:02 +0000 |
branch: master
commit f5a32bf39a2e0626cdc3cc2234ff632a1da9380a
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Add a command to grep the current git repo
* counsel.el (counsel-git-grep-function): New defun.
(counsel-git-grep): New command.
---
counsel.el | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/counsel.el b/counsel.el
index c1b90d6..a2a0ad4 100644
--- a/counsel.el
+++ b/counsel.el
@@ -149,6 +149,25 @@
(when file
(find-file file))))
+(defun counsel-git-grep-function (string &optional _pred &rest _unused)
+ "Grep in the current git repository for STRING."
+ (split-string
+ (shell-command-to-string
+ (format "git --no-pager grep --full-name -n --no-color -i -e \"%s\""
string))
+ "\n"
+ t))
+
+(defun counsel-git-grep ()
+ "Grep for a string in the current git repository."
+ (interactive)
+ (let ((val (ivy-read "pattern: " 'counsel-git-grep-function))
+ lst)
+ (when val
+ (setq lst (split-string val ":"))
+ (find-file (car lst))
+ (goto-char (point-min))
+ (forward-line (1- (string-to-number (cadr lst)))))))
+
(defun counsel--generic (completion-fn)
"Complete thing at point with COMPLETION-FN."
(let* ((bnd (bounds-of-thing-at-point 'symbol))
- [elpa] master updated (d4a79d3 -> 2f4c2c1), Oleh Krehel, 2015/04/20
- [elpa] master d2f754d 02/18: ivy.el (ivy-alt-done): Update for 0 candidates, Oleh Krehel, 2015/04/20
- [elpa] master 378ee58 03/18: Add "C-v" and "M-v" scrolling, Oleh Krehel, 2015/04/20
- [elpa] master f5a32bf 04/18: Add a command to grep the current git repo,
Oleh Krehel <=
- [elpa] master 9f21e1d 06/18: Add a matching optimization, Oleh Krehel, 2015/04/20
- [elpa] master a9a4e81 05/18: counsel.el (counsel-git-grep): Fix the default-directory, Oleh Krehel, 2015/04/20
- [elpa] master 539fe7d 07/18: ivy.el (ivy-completions): Fix an optimization, Oleh Krehel, 2015/04/20
- [elpa] master 23c0e6a 08/18: ivy.el (ivy-done): Update for non-matching file names, Oleh Krehel, 2015/04/20
- [elpa] master a94ca83 01/18: swiper.el: Add a work-around for window-start not being current, Oleh Krehel, 2015/04/20
- [elpa] master cafcfb9 10/18: Allow "C-." to jump to current symbol definition, Oleh Krehel, 2015/04/20
- [elpa] master d0f3826 11/18: ivy.el (ivy--preselect-index): Give priority to perfect match, Oleh Krehel, 2015/04/20
- [elpa] master 297008b 09/18: Allow to customize the file sorting order, Oleh Krehel, 2015/04/20
- [elpa] master 3282f78 13/18: Speed up the default file sorting even more, Oleh Krehel, 2015/04/20
- [elpa] master 525a19d 14/18: Propertize directories with ivy-subdir face, Oleh Krehel, 2015/04/20