branch: elpa/isl
commit bd3c0257c13f1894b2d208370594d23419f4037d
Author: Thierry Volpiatto <[email protected]>
Commit: Thierry Volpiatto <[email protected]>
Add isl-kill-selection command
---
isl.el | 69 +++++++++++++++++++++++++++++++++++++++---------------------------
1 file changed, 41 insertions(+), 28 deletions(-)
diff --git a/isl.el b/isl.el
index 559b28ff887..c0842416efc 100644
--- a/isl.el
+++ b/isl.el
@@ -133,7 +133,8 @@ e.g. \"foo !bar\" would match any symbol containing foo but
not bar.
\\[isl-show-or-hide-context-lines]\t\tHide or show non matching lines
\\[isl-toggle-multi-search-in-line]\t\tToggle multi search style
(InLine/InSymbol)
\\[isl-toggle-invisible-search]\t\tToggle searching in invisible text
-\\[isl-bm-this-pos]\t\tAdd bookmark BM to current pos")
+\\[isl-bm-this-pos]\t\tAdd bookmark BM to current pos
+\\[isl-kill-selection]\t\tKill selected occurence")
(defgroup isl nil
"Search buffers with `isl-search'."
@@ -244,33 +245,34 @@ You can toggle this at any time with
\\<isl-map>\\[isl-toggle-multi-search-in-li
(defvar isl-map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map minibuffer-local-map)
- (define-key map (kbd "C-s") 'isl-goto-next)
- (define-key map (kbd "C-r") 'isl-goto-prev)
- (define-key map (kbd "C-n") 'isl-goto-next)
- (define-key map (kbd "C-p") 'isl-goto-prev)
- (define-key map (kbd "<down>") 'isl-goto-next)
- (define-key map (kbd "<up>") 'isl-goto-prev)
- (define-key map (kbd "RET") 'isl-exit-at-point)
- (define-key map (kbd "C-w") 'isl-yank-word-at-point)
- (define-key map (kbd "C-z") 'isl-yank-symbol-at-point)
- (define-key map (kbd "M-r") 'isl-change-matching-style)
- (define-key map (kbd "M-c") 'isl-select-case-fold-search)
- (define-key map (kbd "M-<") 'isl-goto-first)
- (define-key map (kbd "M->") 'isl-goto-last)
- (define-key map (kbd "M-=") 'isl-goto-closest-from-start)
- (define-key map (kbd "M-s") 'isl-jump-to-helm-occur)
- (define-key map (kbd "M-i") 'isl-toggle-invisible-search)
- (define-key map (kbd "C-;") 'isl-jump-to-iedit-mode)
- (define-key map (kbd "M-%") 'isl-query-replace)
- (define-key map (kbd "C-h m") 'isl-display-or-quit-help)
- (define-key map (kbd "C-q") 'isl-help-quit)
- (define-key map (kbd "C-'") 'isl-show-or-hide-context-lines)
- (define-key map (kbd "C-l") 'isl-recenter)
- (define-key map (kbd "C-v") 'isl-scroll-up)
- (define-key map (kbd "M-v") 'isl-scroll-down)
- (define-key map (kbd "C-k") 'isl-delete-minibuffer-contents)
- (define-key map (kbd "C-j") 'isl-toggle-multi-search-in-line)
- (define-key map (kbd "C-!") 'isl-bm-this-pos)
+ (define-key map (kbd "C-s") 'isl-goto-next)
+ (define-key map (kbd "C-r") 'isl-goto-prev)
+ (define-key map (kbd "C-n") 'isl-goto-next)
+ (define-key map (kbd "C-p") 'isl-goto-prev)
+ (define-key map (kbd "<down>") 'isl-goto-next)
+ (define-key map (kbd "<up>") 'isl-goto-prev)
+ (define-key map (kbd "RET") 'isl-exit-at-point)
+ (define-key map (kbd "C-w") 'isl-yank-word-at-point)
+ (define-key map (kbd "C-z") 'isl-yank-symbol-at-point)
+ (define-key map (kbd "M-r") 'isl-change-matching-style)
+ (define-key map (kbd "M-c") 'isl-select-case-fold-search)
+ (define-key map (kbd "M-<") 'isl-goto-first)
+ (define-key map (kbd "M->") 'isl-goto-last)
+ (define-key map (kbd "M-=") 'isl-goto-closest-from-start)
+ (define-key map (kbd "M-s") 'isl-jump-to-helm-occur)
+ (define-key map (kbd "M-i") 'isl-toggle-invisible-search)
+ (define-key map (kbd "C-;") 'isl-jump-to-iedit-mode)
+ (define-key map (kbd "M-%") 'isl-query-replace)
+ (define-key map (kbd "C-h m") 'isl-display-or-quit-help)
+ (define-key map (kbd "C-q") 'isl-help-quit)
+ (define-key map (kbd "C-'") 'isl-show-or-hide-context-lines)
+ (define-key map (kbd "C-l") 'isl-recenter)
+ (define-key map (kbd "C-v") 'isl-scroll-up)
+ (define-key map (kbd "M-v") 'isl-scroll-down)
+ (define-key map (kbd "C-k") 'isl-delete-minibuffer-contents)
+ (define-key map (kbd "C-j") 'isl-toggle-multi-search-in-line)
+ (define-key map (kbd "C-!") 'isl-bm-this-pos)
+ (define-key map (kbd "C-c C-k") 'isl-kill-selection)
map)
"The map used when `isl-search' is running.
Don't forget to modify `isl-mini-map' accordingly to fit with kmacros
@@ -287,6 +289,17 @@ when modifying keybindings here.")
(goto-char pos)
(setq isl--yank-point pos))))
+(defun isl-kill-selection ()
+ "Kill selected item."
+ (interactive)
+ (with-selected-window (minibuffer-selected-window)
+ (when isl--last-overlay
+ (let ((str (buffer-substring (overlay-start isl--last-overlay)
+ (overlay-end isl--last-overlay))))
+ (kill-new str)
+ (message "`%s' copied to kill-ring" str)))))
+(put 'isl-kill-selection 'no-helm-mx t)
+
(defun isl-bm-this-pos ()
"Toggle bookmark on current position with `bm'.
Need to have the `bm' package installed."