[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 2a13932 252/272: counsel.el (counsel-grep-or-swiper): New
From: |
Oleh Krehel |
Subject: |
[elpa] master 2a13932 252/272: counsel.el (counsel-grep-or-swiper): New command |
Date: |
Mon, 25 Apr 2016 10:13:28 +0000 |
branch: master
commit 2a139329997a71044593fb416367f5db4908cb81
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
counsel.el (counsel-grep-or-swiper): New command
* counsel.el (counsel-grep-swiper-limit): New defvar.
---
counsel.el | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/counsel.el b/counsel.el
index a27bc68..7e9c2f7 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1496,6 +1496,28 @@ the command."
(unless res
(goto-char init-point)))))
+;;** `counsel-grep-or-swiper'
+(defcustom counsel-grep-swiper-limit 300000
+ "When the buffer is larger than this, use `counsel-grep' instead of
`swiper'."
+ :type 'integer
+ :group 'ivy)
+
+;;;###autoload
+(defun counsel-grep-or-swiper ()
+ "Call `swiper' for small buffers and `counsel-grep' for large ones."
+ (interactive)
+ (if (and (buffer-file-name)
+ (not (ignore-errors
+ (file-remote-p (buffer-file-name))))
+ (> (buffer-size)
+ (if (eq major-mode 'org-mode)
+ (/ counsel-grep-swiper-limit 4)
+ counsel-grep-swiper-limit)))
+ (progn
+ (save-buffer)
+ (counsel-grep))
+ (swiper--ivy (swiper--candidates))))
+
;;** `counsel-recoll'
(defun counsel-recoll-function (string)
"Grep in the current directory for STRING."
- [elpa] master d4fc54b 110/272: ivy-test.el (counsel-unquote-regex-parens): Add test, (continued)
- [elpa] master d4fc54b 110/272: ivy-test.el (counsel-unquote-regex-parens): Add test, Oleh Krehel, 2016/04/25
- [elpa] master 5f0d175 172/272: counsel.el (counsel-prompt-function-dir): Make portable, Oleh Krehel, 2016/04/25
- [elpa] master 5765208 185/272: counsel.el (counsel-pt-base-command): Add regex flag, Oleh Krehel, 2016/04/25
- [elpa] master 67ac850 211/272: counsel.el (counsel-M-x): Add help action, Oleh Krehel, 2016/04/25
- [elpa] master 189c093 207/272: counsel.el (counsel-ace-link): New command, Oleh Krehel, 2016/04/25
- [elpa] master 8c2f213 059/272: counsel.el (counsel-yank-pop): Truncate during display, Oleh Krehel, 2016/04/25
- [elpa] master 5c2c1df 166/272: counsel.el (counsel-git-grep-map): Bind "C-c C-m" to counsel-git-grep-switch-cmd, Oleh Krehel, 2016/04/25
- [elpa] master e6f92fd 191/272: ivy.el (ivy-occur-press): Add counsel-describe-function, Oleh Krehel, 2016/04/25
- [elpa] master 871f78c 168/272: Add optional exit-code table to counsel--async-cmd, Oleh Krehel, 2016/04/25
- [elpa] master 668aaf3 155/272: counsel.el: add outline for `counsel-mode', Oleh Krehel, 2016/04/25
- [elpa] master 2a13932 252/272: counsel.el (counsel-grep-or-swiper): New command,
Oleh Krehel <=
- [elpa] master 0b51e8e 231/272: ivy.el (ivy-minibuffer-map): Fix "DEL", Oleh Krehel, 2016/04/25
- [elpa] master cf78d42 212/272: counsel.el (counsel-find-file): Add :caller, Oleh Krehel, 2016/04/25
- [elpa] master a25e174 248/272: ivy.el (ivy--format-minibuffer-line): Add ignore-errors, Oleh Krehel, 2016/04/25
- [elpa] master ebd3fb9 254/272: Fix read-file-name with specified dir, Oleh Krehel, 2016/04/25
- [elpa] master 7dc86b3 084/272: Add a lot of sections to the documentation, Oleh Krehel, 2016/04/25
- [elpa] master d2a89ea 261/272: doc/ivy.org: Add a note on :predicate, Oleh Krehel, 2016/04/25
- [elpa] master 63a77ba 162/272: swiper.el (swiper-occur): Fix for non-file buffers, Oleh Krehel, 2016/04/25
- [elpa] master d899181 199/272: README.md: Add a section on Contributing, Oleh Krehel, 2016/04/25
- [elpa] master 119a151 242/272: Make "j"/"k" feedback more solid in ivy-occur buffers, Oleh Krehel, 2016/04/25
- [elpa] master 6a00275 187/272: ivy.el (ivy-switch-buffer-occur): Add, Oleh Krehel, 2016/04/25