knu / phi-search-mc.el

Multiple-cursors extension for phi-search
BSD 2-Clause "Simplified" License
11 stars 4 forks source link

phi-search-mc.el

This package is a multiple-cursors extension for phi-search.

Functions

phi-search-mc.el provides the following interactive commands:

Installation

This package is available on MELPA.

Configuration

Run the following line to rebind mc/mark-next-like-this, mc/mark-previous-like-this and mc/mark-all-like-this in phi-search buffer to phi-search-mc/mark-next, phi-search-mc/mark-previous and phi-search-mc/mark-all, respectively.

(phi-search-mc/setup-keys)

Run the following line to bind phi-search, mc/mark-next-like-this, mc/mark-previous-like-this and mc/mark-all-like-this in isearch mode to phi-search-from-isearch, phi-search-from-isearch-mc/mark-next, phi-search-from-isearch-mc/mark-previous and phi-search-from-isearch-mc/mark-all, respectively.

(add-hook 'isearch-mode-hook 'phi-search-from-isearch-mc/setup-keys)

If you have bound multi-stroke keys to mc/mark-next-like-this etc., this may not be enough. For example, I bound C->/C-</C-.! to mc/mark-* functions, and since they are complex multi-stroke keys on my terminal emulator where C-> is mapped to C-x @ c > etc., I had to add the following lines for the features to work properly.

(define-prefix-command 'phi-search-from-isearch-mc/ctl-map)
(let ((map phi-search-from-isearch-mc/ctl-map))
  (define-key map (kbd ">")   'phi-search-from-isearch-mc/mark-next)
  (define-key map (kbd "<")   'phi-search-from-isearch-mc/mark-previous)
  (define-key map (kbd ". !") 'phi-search-from-isearch-mc/mark-all))

(defun phi-search-from-isearch-mc/setup-keys-ad-for-terminal ()
  (define-key isearch-mode-map (kbd "C-x @ c") phi-search-from-isearch-mc/ctl-map))
(advice-add #'phi-search-from-isearch-mc/setup-keys :after #'phi-search-from-isearch-mc/setup-keys-ad-for-terminal)

Author

Copyright (c) 2013-2015 Akinori MUSHA.

Licensed under the 2-clause BSD license. See LICENSE.txt for details.

Visit GitHub Repository for the latest information.