]> code.delx.au - gnu-emacs-elpa/commitdiff
Merge commit 'ac0fc8962eaa15625b127c32f75d2b3daa1ca6ef' from swiper
authorOleh Krehel <ohwoeowho@gmail.com>
Mon, 20 Apr 2015 14:07:30 +0000 (16:07 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Mon, 20 Apr 2015 14:07:30 +0000 (16:07 +0200)
packages/swiper/counsel.el
packages/swiper/ivy.el
packages/swiper/swiper.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
index 2802f078fd92e798ec38f23bbc9532c6cdb9792d..c4a491399888e528da59c1f56c1d2a06710b23d4 100644 (file)
@@ -84,12 +84,16 @@ Only \"./\" and \"../\" apply here. They appear in reverse order."
     (define-key map (kbd "C-j") 'ivy-alt-done)
     (define-key map (kbd "C-n") 'ivy-next-line)
     (define-key map (kbd "C-p") 'ivy-previous-line)
+    (define-key map (kbd "<down>") 'ivy-next-line)
+    (define-key map (kbd "<up>") 'ivy-previous-line)
     (define-key map (kbd "C-s") 'ivy-next-line-or-history)
     (define-key map (kbd "C-r") 'ivy-previous-line-or-history)
     (define-key map (kbd "SPC") 'self-insert-command)
     (define-key map (kbd "DEL") 'ivy-backward-delete-char)
     (define-key map (kbd "M-<") 'ivy-beginning-of-buffer)
     (define-key map (kbd "M->") 'ivy-end-of-buffer)
+    (define-key map (kbd "<left>") 'ivy-beginning-of-buffer)
+    (define-key map (kbd "<right>") 'ivy-end-of-buffer)
     (define-key map (kbd "M-n") 'ivy-next-history-element)
     (define-key map (kbd "M-p") 'ivy-previous-history-element)
     (define-key map (kbd "C-g") 'minibuffer-keyboard-quit)
@@ -584,7 +588,11 @@ CANDIDATES is a list of strings."
                        ivy--old-cands)
                       ((and ivy--old-re
                             (not (equal ivy--old-re ""))
-                            (eq 0 (cl-search ivy--old-re re)))
+                            (memq (cl-search
+                                   (if (string-match "\\\\)$" ivy--old-re)
+                                       (substring ivy--old-re 0 -2)
+                                     ivy--old-re)
+                                   re) '(0 2)))
                        (ignore-errors
                          (cl-remove-if-not
                           (lambda (x) (string-match re x))
index 3190d921de1c8d2f538afb9114108e40bbf0b460..1afd056548c6bb09137689e7c38b7ffdb712aef7 100644 (file)
@@ -153,9 +153,6 @@ When non-nil, INITIAL-INPUT is the initial search pattern."
   (interactive)
   (swiper--ivy initial-input))
 
-(defvar swiper--overlays nil
-  "Store overlays.")
-
 (defvar swiper--anchor nil
   "A line number to which the search should be anchored.")
 
@@ -208,6 +205,9 @@ When non-nil, INITIAL-INPUT is the initial search pattern."
                (setq expose (overlay-get ov 'isearch-open-invisible)))
           (funcall expose ov)))))
 
+(defvar swiper--overlays nil
+  "Store overlays.")
+
 (defun swiper--cleanup ()
   "Clean up the overlays."
   (while swiper--overlays