Help us understand the problem. What is going on with this article?

multiple-cursor.elの設定を調整してみた

More than 5 years have passed since last update.

SublimeText2の複数カーソルに相当するmultiple-cursors.elはとても便利なのですが、キーバインドを自分で考えて設定しないといけないのが敷居を高くしています。

そこで基本的な操作に困らないようにキーバインドを設定してみました。multiple-cursors.elのキーバインドを少しだけ改善 - 備忘録のsmartrepを使うアイデアをを参考にしています。

インストール

どちらもpackage.elからインストール出来ます。

M-x package-install multiple-cursors
M-x package-install smartrep

.emacs.d/init.el

.emacs.d/init.el
(require 'multiple-cursors)
(require 'smartrep)

(declare-function smartrep-define-key "smartrep")

(global-set-key (kbd "C-M-c") 'mc/edit-lines)
(global-set-key (kbd "C-M-r") 'mc/mark-all-in-region)

(global-unset-key "\C-t")

(smartrep-define-key global-map "C-t"
  '(("C-t"      . 'mc/mark-next-like-this)
    ("n"        . 'mc/mark-next-like-this)
    ("p"        . 'mc/mark-previous-like-this)
    ("m"        . 'mc/mark-more-like-this-extended)
    ("u"        . 'mc/unmark-next-like-this)
    ("U"        . 'mc/unmark-previous-like-this)
    ("s"        . 'mc/skip-to-next-like-this)
    ("S"        . 'mc/skip-to-previous-like-this)
    ("*"        . 'mc/mark-all-like-this)
    ("d"        . 'mc/mark-all-like-this-dwim)
    ("i"        . 'mc/insert-numbers)
    ("o"        . 'mc/sort-regions)
    ("O"        . 'mc/reverse-regions)))

よくあるパターン


  • キーワード選択→C-t連打でキーワードを選択
  • C-tを押した後にsを押すとキーワードをスキップ, uで一つ前に戻る、*で全て選択、dでバッファ内をいい感じで全選択
  • 範囲を選択してC-M-cで全ての行にカーソルを作成
  • 範囲を選択してC-M-rで対話的にキーワードを入力してカーソルを作成

リンク

ongaeshi
ソースコード検索アプリのMilkodeとかを作っています。 ブログ http://ongaeshi.hatenablog.com/
http://ongaeshi.me/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした