[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master ac0fc89 4/5: counsel.el (counsel-git-grep-count): Add defu
From: |
Oleh Krehel |
Subject: |
[elpa] master ac0fc89 4/5: counsel.el (counsel-git-grep-count): Add defun |
Date: |
Mon, 20 Apr 2015 14:13:23 +0000 |
branch: master
commit ac0fc8962eaa15625b127c32f75d2b3daa1ca6ef
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
counsel.el (counsel-git-grep-count): Add defun
---
counsel.el | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/counsel.el b/counsel.el
index 4a97913..1b5e260 100644
--- a/counsel.el
+++ b/counsel.el
@@ -175,6 +175,11 @@
(when file
(find-file file))))
+(defun counsel-git-grep-count (str)
+ "Quickly count the amount of git grep STR matches."
+ (shell-command-to-string
+ (format "git grep -c '%s' | sed 's/.*:\\(.*\\)/\\1/g' | awk '{s+=$1} END
{print s}'" str)))
+
(defun counsel-git-grep-function (string &optional _pred &rest _unused)
"Grep in the current git repository for STRING."
(split-string