branch: elpa/multiple-cursors
commit 80fdb6f68de4cd3ee62eabde2c1f3f690fd47f58
Author: Magnar Sveen <[email protected]>
Commit: Magnar Sveen <[email protected]>
Hook multiple-cursors into mark-multiple, first step:
- C-g in mark-multiple takes you to multiple-cursors
Note: C-g again to remove extra cursors
---
multiple-cursors.el | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/multiple-cursors.el b/multiple-cursors.el
index dcf8d28..2329afa 100644
--- a/multiple-cursors.el
+++ b/multiple-cursors.el
@@ -97,7 +97,7 @@ from being executed if in multiple-cursors-mode."
(unless multiple-cursors-mode
ad-do-it))))
-;; Commands that makes a giant mess of multiple cursors
+;; Commands that make a giant mess of multiple cursors
(unsupported-cmd yank-pop)
;; Commands that should be mirrored by all cursors
@@ -114,8 +114,8 @@ from being executed if in multiple-cursors-mode."
kill-region-or-backward-word
backward-kill-word
backward-delete-char-untabify
- delete-char
- delete-backward-char
+ delete-char c-electric-delete-forward
+ delete-backward-char c-electric-backspace
zap-to-char
move-end-of-line-or-next-line
move-start-of-line-or-prev-line))
@@ -216,6 +216,20 @@ mark-multiple if point and mark is on different columns."
(mc/execute-command-for-all-cursors 'beginning-of-line)
(beginning-of-line))
+(defun mc/switch-to-cursors-from-mark-multiple ()
+ "Removes mark-multiple and switches to multiple cursors instead"
+ (interactive)
+ (let ((offset (- (point) (overlay-start mm/master))))
+ (save-excursion
+ (dolist (mirror mm/mirrors)
+ (goto-char (+ offset (overlay-start mirror)))
+ (mc/add-cursor-at-point)))
+ (mm/clear-all)
+ (deactivate-mark)
+ (multiple-cursors-mode)))
+
+(define-key mm/keymap (kbd "C-g") 'mc/switch-to-cursors-from-mark-multiple)
+
(provide 'multiple-cursors)
;;; multiple-cursors.el ends here