]> code.delx.au - gnu-emacs-elpa/blobdiff - packages/swiper/counsel.el
Merge commit 'ac0fc8962eaa15625b127c32f75d2b3daa1ca6ef' from swiper
[gnu-emacs-elpa] / packages / swiper / counsel.el
index 4a97913df5cbe9d13ccfad15d4759391943dd144..1b5e260702bfad59b4222fba8deef5d78338715e 100644 (file)
     (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