[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master f9974e8 12/63: Allow to see the candidate index via ivy-co
From: |
Oleh Krehel |
Subject: |
[elpa] master f9974e8 12/63: Allow to see the candidate index via ivy-count-format |
Date: |
Fri, 21 Aug 2015 12:08:32 +0000 |
branch: master
commit f9974e80f4440cb50e1a005efe9300f5d9476535
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Allow to see the candidate index via ivy-count-format
* ivy.el (ivy--insert-prompt): Update.
To use this feature, use something like this:
(setq ivy-count-format "(%d/%d)")
Basically two number specifiers instead of the usual one. The problem
with this approach is that the prompt length will change as you scroll
e.g. from 9 to 10, which is uncomfortable.
Fixes #167
---
ivy.el | 24 ++++++++++++++++--------
1 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/ivy.el b/ivy.el
index 9a27ebd..25720c9 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1155,21 +1155,29 @@ Insert .* between each char."
(let ((inhibit-read-only t)
(std-props '(front-sticky t rear-nonsticky t field t read-only t))
(n-str
- (format
(concat
(if (and (bound-and-true-p minibuffer-depth-indicate-mode)
(> (minibuffer-depth) 1))
(format "[%d] " (minibuffer-depth))
"")
- head
- ivy--prompt-extra
- tail
+ (if (string-match "%[-0-9 ]*d.*%[-0-9 ]*d" ivy-count-format)
+ (concat (format ivy-count-format (1+ ivy--index)
ivy--length)
+ " "
+ ;; work around swiper
+ (let ((pr (ivy-state-prompt ivy-last)))
+ (if (string-match "%[-0-9 ]*d" pr)
+ (substring pr (1+ (match-end 0)))
+ pr)))
+ (concat (format
+ head
+ (or (and (ivy-state-dynamic-collection ivy-last)
+ ivy--full-length)
+ ivy--length))
+ ivy--prompt-extra
+ tail))
(if ivy--directory
(abbreviate-file-name ivy--directory)
- ""))
- (or (and (ivy-state-dynamic-collection ivy-last)
- ivy--full-length)
- ivy--length))))
+ ""))))
(save-excursion
(goto-char (point-min))
(delete-region (point-min) (minibuffer-prompt-end))
- [elpa] master d6452fb 02/63: Add a custom keymap for ivy-switch-buffer, (continued)
- [elpa] master d6452fb 02/63: Add a custom keymap for ivy-switch-buffer, Oleh Krehel, 2015/08/21
- [elpa] master 1aa7520 03/63: Add a custom keymap for counsel-find-file, Oleh Krehel, 2015/08/21
- [elpa] master 9bbf9f9 04/63: Fixup the last two commits, Oleh Krehel, 2015/08/21
- [elpa] master b465c09 06/63: ivy.el (ivy-switch-buffer): Add a multi-action interface, Oleh Krehel, 2015/08/21
- [elpa] master 082fbbc 05/63: Add a multi-action interface for counsel-locate, Oleh Krehel, 2015/08/21
- [elpa] master 548a766 08/63: ivy.el (ivy--reset-state): Fixup, Oleh Krehel, 2015/08/21
- [elpa] master fe6d2b1 07/63: Make ffap work again, Oleh Krehel, 2015/08/21
- [elpa] master f6f3963 09/63: Bind case-fold-search to t when the input is all lower-case, Oleh Krehel, 2015/08/21
- [elpa] master d5af987 11/63: ivy.el (ivy--reset-state): Fixup, Oleh Krehel, 2015/08/21
- [elpa] master d1f88fa 10/63: ivy.el (ivy-read): Don't put empty string on history, Oleh Krehel, 2015/08/21
- [elpa] master f9974e8 12/63: Allow to see the candidate index via ivy-count-format,
Oleh Krehel <=
- [elpa] master 783f7c5 13/63: Update index formatting logic, Oleh Krehel, 2015/08/21
- [elpa] master 3164753 14/63: counsel.el (counsel-locate-history): Add, Oleh Krehel, 2015/08/21
- [elpa] master 19dcc0f 16/63: ivy.el (ivy--regex): Improve for trailing backslash, Oleh Krehel, 2015/08/21
- [elpa] master ea6525e 18/63: ivy.el (ivy-read): Improve ivy-set-actions interaction, Oleh Krehel, 2015/08/21
- [elpa] master e9c2538 19/63: counsel.el (counsel-rhythmbox-history): Add, Oleh Krehel, 2015/08/21
- [elpa] master 21007c2 17/63: Add counsel-rhythmbox, Oleh Krehel, 2015/08/21
- [elpa] master de2e819 20/63: Allow % in prompt string, Oleh Krehel, 2015/08/21
- [elpa] master 22ee8a6 23/63: swiper.el (swiper-font-lock-ensure): Ignore Man-mode, Oleh Krehel, 2015/08/21
- [elpa] master 8c91662 22/63: ivy.el (ivy-call): Bind to "C-M-m" or "M-RET", Oleh Krehel, 2015/08/21
- [elpa] master 3df2d8e 26/63: ivy-hydra.el: Add featurep for hydra, Oleh Krehel, 2015/08/21