[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil-visualstar bd9e1b50c0 15/19: Merge pull request #4 fr
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil-visualstar bd9e1b50c0 15/19: Merge pull request #4 from guivho/master |
Date: |
Thu, 6 Jan 2022 04:00:25 -0500 (EST) |
branch: elpa/evil-visualstar
commit bd9e1b50c03b37c57355d387f291c2ec8ce51eec
Merge: a18dfe7612 87a5bd8457
Author: Bailey Ling <bling@live.ca>
Commit: Bailey Ling <bling@live.ca>
Merge pull request #4 from guivho/master
This makes visualstar persistent, i.e. one can continue searching the ne...
---
README.md | 6 ++++++
evil-visualstar.el | 30 +++++++++++++++++++++---------
2 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/README.md b/README.md
index 0c0fe6c97a..577f05e3cb 100644
--- a/README.md
+++ b/README.md
@@ -15,4 +15,10 @@ Add `(global-evil-visualstar-mode)` to your configuration.
Make a visual selection with `v` or `V`, and then hit `*` to search that
selection forward, or `#` to search that selection backward.
+If the `evil-visualstar/persistent` option is not nil, visual-state will
+remain in effect, allowing for repeated `*` or `#`.
+
+Note that you than have to exit visualstar-mode before hitting a
+direction key to avoid extending the selection.
+
[1]: http://melpa.org
diff --git a/evil-visualstar.el b/evil-visualstar.el
index 77fe4e60be..d4e7c6c8a2 100644
--- a/evil-visualstar.el
+++ b/evil-visualstar.el
@@ -6,7 +6,7 @@
;; Filename: evil-visualstar.el
;; Description: Starts a * or # search from the visual selection
;; Created: 2013-09-24
-;; Version: 0.1.0
+;; Version: 0.2.0
;; Keywords: evil vim visualstar
;; Package-Requires: ((evil "0"))
;;
@@ -40,30 +40,42 @@
;;
;; Make a visual selection with `v` or `V`, and then hit `*` to search
;; the selection forward, or # to search that selection backward.
+;;
+;; If the evil-visualstar/persistent option is not nil, visual-state
+;; will remain in effect, allowing for repeated * or #.
;;; Code:
(require 'evil)
+(defvar evil-visualstar/persistent nil
+ "Set to `t` if `*` and `#` should keep visual-mode.
+That would visually-select the found occurrence, allowing for
+repeated searches.
+You will need to hit escape to leave visual-mode.")
+
(defun evil-visualstar/begin-search (beg end direction)
(when (evil-visual-state-p)
(evil-exit-visual-state)
- (let ((selection (regexp-quote (buffer-substring-no-properties beg end))))
+ (let ((found)
+ (selection (regexp-quote (buffer-substring-no-properties beg end))))
(if (eq evil-search-module 'isearch)
(progn
(setq isearch-forward direction)
- (evil-search selection direction t))
+ (setq found (evil-search selection direction t)))
(let ((pattern (evil-ex-make-search-pattern selection))
(direction (if direction 'forward 'backward)))
(setq evil-ex-search-direction direction)
(setq evil-ex-search-pattern pattern)
(evil-ex-search-activate-highlight pattern)
- ;; update search history unless this pattern equals the
- ;; previous pattern
- (unless (equal (car-safe evil-ex-search-history) selection)
- (push selection evil-ex-search-history))
- (evil-push-search-history selection (eq direction 'forward))
- (evil-ex-search-next))))))
+ ;; update search history unless this pattern equals the
+ ;; previous pattern
+ (unless (equal (car-safe evil-ex-search-history) selection)
+ (push selection evil-ex-search-history))
+ (evil-push-search-history selection (eq direction 'forward))
+ (setq found (evil-ex-search-next))))
+ (when (and evil-visualstar/persistent found)
+ (push-mark (+ (point) (- end beg)) nil t)))))
(defun evil-visualstar/begin-search-forward (beg end)
"Search for the visual selection forwards."
- [nongnu] elpa/evil-visualstar aafece5bc2 10/19: Commit 2015-05-08 19:00, (continued)
- [nongnu] elpa/evil-visualstar aafece5bc2 10/19: Commit 2015-05-08 19:00, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-visualstar 687ae03c24 18/19: set jumps and don't repeat. resolves #7 and #9., ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-visualstar 37de793029 16/19: Update Evil homepage URL, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-visualstar c8ca5799b5 13/19: Added missing quote, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-visualstar 1bb9ecd6f5 02/19: add readme., ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-visualstar a18dfe7612 09/19: Merge pull request #5 from andyque/master, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-visualstar eb996eca00 17/19: Merge pull request #8 from syohex/update-evil-url, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-visualstar 06c053d8f7 19/19: should be defined as motions, not commands, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-visualstar 3f9bb0e6a1 11/19: Allow for option controlled persistent visualstar searches, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-visualstar 4a93eb8790 04/19: correct package-requires syntax., ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-visualstar bd9e1b50c0 15/19: Merge pull request #4 from guivho/master,
ELPA Syncer <=
- [nongnu] elpa/evil-visualstar ced3ae62e2 08/19: add visualstar search to ex search history and evil search history, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-visualstar 5a9b40f937 12/19: Added missing quote, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-visualstar 53d08370af 03/19: minor grammar change., ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-visualstar 6e9f2349ad 07/19: This makes visualstar persistent, i.e. one can continue searching the next occurrence(s) of the visual selection by repeatedly hitting '*' or '#'., ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-visualstar de939b4013 06/19: reimplement as a minor-mode., ELPA Syncer, 2022/01/06