[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ivy-hydra b91a4e2 238/395: counsel.el (counsel--git-gre
From: |
Basil L. Contovounesios |
Subject: |
[elpa] externals/ivy-hydra b91a4e2 238/395: counsel.el (counsel--git-grep-index): Add |
Date: |
Thu, 25 Feb 2021 08:32:10 -0500 (EST) |
branch: externals/ivy-hydra
commit b91a4e29960df95f7690364886c78dc93c45cc38
Author: Oleh Krehel <ohwoeowho@gmail.com>
Commit: Oleh Krehel <ohwoeowho@gmail.com>
counsel.el (counsel--git-grep-index): Add
---
counsel.el | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/counsel.el b/counsel.el
index 60f144d..dd66db5 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1528,10 +1528,29 @@ When CMD is non-nil, prompt for a specific \"git grep\"
command."
:require-match t
:caller 'counsel-git-grep))))
+(defun counsel--git-grep-index (_re-str cands)
+ (if (null ivy--old-cands)
+ (let ((ln (with-ivy-window
+ (line-number-at-pos)))
+ (name (file-name-nondirectory (with-ivy-window
(buffer-file-name)))))
+ (or
+ ;; closest to current line going forwards
+ (cl-position-if (lambda (x)
+ (and (string-prefix-p name x)
+ (>= (string-to-number
+ (substring x (1+ (length name)))) ln)))
+ cands)
+ ;; closest to current line going backwards
+ (cl-position-if (lambda (x)
+ (string-prefix-p name x))
+ cands
+ :from-end t)))
+ (ivy-recompute-index-swiper-async nil cands)))
+
(ivy-configure 'counsel-git-grep
:occur #'counsel-git-grep-occur
:unwind-fn #'counsel--grep-unwind
- :index-fn #'ivy-recompute-index-swiper-async
+ :index-fn #'counsel--git-grep-index
:display-transformer-fn #'counsel-git-grep-transformer
:grep-p t
:exit-codes '(1 "No matches found"))
- [elpa] externals/ivy-hydra 5ac1c97 190/395: ivy.el (ivy-dispatching-call): Fix ivy-text being "" for ivy-read-action-ivy, (continued)
- [elpa] externals/ivy-hydra 5ac1c97 190/395: ivy.el (ivy-dispatching-call): Fix ivy-text being "" for ivy-read-action-ivy, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 7abf656 192/395: Allow counsel-cd to run even if recursive minibuffers are not enabled, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra dd8f519 206/395: Fix ivy-completion-in-region return value, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 50b02a0 222/395: Remove unused lexical variable in recent test, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra a5c6ef9 231/395: counsel-kmacro: Create separator with defcustom instead of defvar., Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 4f6bd9e 210/395: .dir-locals.el (outline-regexp): "^(" is not an outline start, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 334d08c 227/395: ivy.el (ivy--update-history): Use ivy-text if it's not "", Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 24e68ea 225/395: counsel.el (counsel-git-log-cmd): Disable coloring., Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra cfb395e 239/395: counsel.el (counsel--sync-sentinel-on-exit): Simplify, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra f4a7d87 241/395: Fix recent addition of caddr in counsel.el, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra b91a4e2 238/395: counsel.el (counsel--git-grep-index): Add,
Basil L. Contovounesios <=
- [elpa] externals/ivy-hydra 781cbbc 255/395: Advertise ivy-string< over string-lessp, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 0e4a55f 242/395: ivy.el (ivy--preselect-index): Don't return nil, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra af2a5fa 247/395: * counsel.el (counsel-pt): Fix counsel-ag usage, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 4aa8073 264/395: ivy.el (ivy-call): Make "M-x cd" work again, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra d1ba9b8 269/395: ivy.el (ivy-resume): Refresh on modified buffer for swiper-isearch, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 5e67e7c 268/395: counsel.el (counsel-rg): Split command args independent of the order, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 6369139 271/395: ivy.el (ivy--update-history): Behave more like completing-read-default, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra c0dc909 277/395: ivy.el (ivy-resume): Support multiple ivy sessions, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 8989ed1 276/395: ivy.el (ivy--update-minibuffer): don't filter while there's input, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra d790e53 278/395: doc/ivy.org: Mention multiple-session ivy-resume, Basil L. Contovounesios, 2021/02/25