branch: master
commit ac0fc8962eaa15625b127c32f75d2b3daa1ca6ef
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
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