1

I'm using multiple-cursors, setting it up with use-package. By default, when multiple-cursors mode is enabled, <return> is bound to multiple-cursors-mode. I'm trying to override that adding this after :config in the use-package declaration:

(define-key mc/keymap (kbd "<return>") nil)

So, this is part of my init.el:

(use-package multiple-cursors
  :ensure t
  :bind (("s-d" . mc/mark-next-like-this)
         ("s-D" . mc/mark-all-dwim)
         ("s-L" . mc/edit-beginnings-of-lines)
         ("s-<mouse-1>" . mc/add-cursor-on-click))
  :config
  (define-key mc/keymap (kbd "<return>") nil)
    )

Unfortunately, when multiple-cursors mode is enabled, C-h k tells me

<return> runs the command multiple-cursors-mode (found in mc/keymap)

I tried putting the :config bit before :bind just in the off chance it had something to do with the way :bind works, but that didn't make a difference.

  • 1
    1. Can you try evaluating (define-key mc/keymap (kbd "<return>") nil) after using mc. Is it unbound after? 2. Or by wrapping it inside (with-eval-after-load 'multiple-cursors-core (define-key mc/keymap (kbd "<return>") nil))? – Hubisan Nov 19 at 8:02
1

Reading the source code (of multiple-cursors) helped me with this one. :)

This key is defined in file multiple-cursors-core.el and the end of this file provides the feature multiple-cursors-core, so you have to use-package this feature.

(use-package multiple-cursors-core
    :bind
   (:map mc/keymap
         ("<return>" . nil)))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.