[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 022e658 090/272: When in prog-mode, "M-n" should wrap inpu
From: |
Oleh Krehel |
Subject: |
[elpa] master 022e658 090/272: When in prog-mode, "M-n" should wrap input with "\b" |
Date: |
Mon, 25 Apr 2016 10:13:18 +0000 |
branch: master
commit 022e65818607af5f8eeb0a9d39ee5957c0c9a9f2
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
When in prog-mode, "M-n" should wrap input with "\b"
When searching for occurrences of a symbol, it's useful to omit the
cases where the symbol is a part of a larger word.
"M-n" will insert the symbol, then if the mode is derived from
`prog-mode', wrap this symbol with \b - the regex notation for word
boundary.
This wrapping can be undone with `undo'.
---
ivy.el | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/ivy.el b/ivy.el
index 3d844d3..b144182 100644
--- a/ivy.el
+++ b/ivy.el
@@ -851,7 +851,17 @@ Call the permanent action if possible."
(defun ivy-next-history-element (arg)
"Forward to `next-history-element' with ARG."
(interactive "p")
- (next-history-element arg)
+ (if (= minibuffer-history-position 0)
+ (progn
+ (insert ivy--default)
+ (when (and (with-ivy-window (derived-mode-p 'prog-mode))
+ (> (point) (minibuffer-prompt-end)))
+ (undo-boundary)
+ (insert "\\b")
+ (goto-char (minibuffer-prompt-end))
+ (insert "\\b")
+ (forward-char (+ 2 (length ivy--default)))))
+ (next-history-element arg))
(ivy--cd-maybe)
(move-end-of-line 1)
(ivy--maybe-scroll-history))
- [elpa] master 6fbab50 128/272: swiper.el (swiper-all): Now auto-updates position, (continued)
- [elpa] master 6fbab50 128/272: swiper.el (swiper-all): Now auto-updates position, Oleh Krehel, 2016/04/25
- [elpa] master 26c8246 131/272: counsel.el (counsel-recoll): add unwind, Oleh Krehel, 2016/04/25
- [elpa] master 87da3a2 132/272: counsel.el (counsel-async-split-string-re): New defvar, Oleh Krehel, 2016/04/25
- [elpa] master 9ffa9c7 121/272: ivy.el (ivy--regex): Don't consider \\(?...\) a group, Oleh Krehel, 2016/04/25
- [elpa] master 71bb1c0 144/272: ivy.el (ivy-alt-done): Simplify, Oleh Krehel, 2016/04/25
- [elpa] master e12ff84 125/272: counsel.el (counsel-list-processes-action-switch): Improve, Oleh Krehel, 2016/04/25
- [elpa] master 1737ced 064/272: ivy.el (ivy-inhibit-action): New variable, Oleh Krehel, 2016/04/25
- [elpa] master 05a7b61 070/272: ivy.el (ivy--reset-state): Support a list of symbols as collection, Oleh Krehel, 2016/04/25
- [elpa] master 65ec32c 080/272: README.md: mention the manual more prominently, Oleh Krehel, 2016/04/25
- [elpa] master 4af5c2e 115/272: Add `counsel-locate-cmd-mdfind`, Oleh Krehel, 2016/04/25
- [elpa] master 022e658 090/272: When in prog-mode, "M-n" should wrap input with "\b",
Oleh Krehel <=
- [elpa] master 9db8308 103/272: counsel.el: Organize the file with outlines, Oleh Krehel, 2016/04/25
- [elpa] master 1c04fb8 126/272: Add ivy-fixed-height-minibuffer, Oleh Krehel, 2016/04/25
- [elpa] master 7a0b243 130/272: Give ivy-read-read-action enough minibuffer space, Oleh Krehel, 2016/04/25
- [elpa] master 708ca11 141/272: ivy.el: Fix a few face declarations, Oleh Krehel, 2016/04/25
- [elpa] master f647bca 136/272: Simplify the ivy-format-function interface, Oleh Krehel, 2016/04/25
- [elpa] master c2b330b 091/272: doc/ivy.org: Add @vindex and @kindex automatically, Oleh Krehel, 2016/04/25
- [elpa] master 4c99ec6 107/272: counsel.el: Shuffle functions, Oleh Krehel, 2016/04/25
- [elpa] master 0fd6a75 142/272: Move switch-to-buffer to :display-transformer-fn, Oleh Krehel, 2016/04/25
- [elpa] master f5a21db 157/272: ivy.el: define setq-local and defvar-local unless defined, Oleh Krehel, 2016/04/25
- [elpa] master 71644d9 190/272: ivy.el (ivy-read): Remove code that sets action index to 1, Oleh Krehel, 2016/04/25