There are multiple multiple-cursors implementations for emacs.

I have the impression that extra work has been required to make them work well in evil and spacemacs in particular.

I imagine the competing implementations have their pros and cons. As a newcomer to multiple cursors, I'm interested in the best all-rounder.

How can I make that work? I'm not sure which is most relevant to the problems: evil or spacemacs, but I'm using spacemacs.

  • 1
    Can you add criteria that are crucial for you? Your question as is is pretty much purely opinion based.
    – user12563
    Nov 13 '18 at 22:40
  • 1
    With respect, do you know that, or are you responding to the way I happened to write the question (the fact that I chose to mention competing implementations)? Do you use spacemacs and/or evil with multiple cursors? My suspicion from the spacemacs bug tracker is that in fact there is one that clearly works best, and would win out here -- but the bug tracker is a bad way to assemble that info, and here is not. What I actually care about is getting something working that works reasonably well, rather than nothing (as I use at present) -- and I expect most other people reading this do too. Nov 13 '18 at 22:46
  • “Which is the best one” is definitely opinion based, so please rephrase to ask a discrete question. It would help if you could lay out the criteria you have.
    – Dan
    Nov 14 '18 at 2:53
  • @Dan How can I better communicate the concept "Best all-rounder"? Is it genuinely important to avoid using the word "best" in SE, or rather to avoid questions that are needlessly unspecific (and therefore make it hard to provide clear answers, and hard to divide up problem-space into questions)? I could be wrong, but I think that is in fact my only criterion right now: if find better criteria, I will add them to the question? Nov 25 '18 at 16:13
  • Again, I really want to emphasize that the focus of the question is "how can I use multiple cursors in spacemacs" and not "what is the best multiple-cursors implementation". The word "best" is there to clarify that I'm not interested in the "best" one, because as a newcomer to multiple cursors, I don't have any criteria to define "best". Moderating SE questions is hard, and I think one consequence of that is that one needs to try hard to look at content rather than words. Nov 25 '18 at 16:25

As of Nov 2018, the spacemacs develop branch has a multiple-cursors layer available which notes that:

Currently the only supported backend is evil-mc, but more backends will be available in the future.

The evil-mc package provides the following key bindings:

| Key Binding | Description                        |
|  g r f      | evil-mc-make-and-goto-first-cursor |
|  g r h      | evil-mc-make-cursor-here           |
|  g r j      | evil-mc-make-cursor-move-next-line |
|  g r k      | evil-mc-make-cursor-move-prev-line |
|  g r l      | evil-mc-make-and-goto-last-cursor  |
|  g r m      | evil-mc-make-all-cursors           |
|  g r n      | evil-mc-skip-and-goto-next-match   |
|  g r N      | evil-mc-skip-and-goto-next-cursor  |
|  g r p      | evil-mc-skip-and-goto-prev-match   |
|  g r P      | evil-mc-skip-and-goto-prev-cursor  |
|  g r r      | evil-mc-resume-cursors             |
|  g r s      | evil-mc-pause-cursors              |
|  g r u      | evil-mc-undo-all-cursors           |

For easy navigation you also have the following:

| Key Binding | Description                        |
|  M-n        | evil-mc-make-and-goto-next-cursor  |
|  M-p        | evil-mc-make-and-goto-prev-cursor  |
|  C-n        | evil-mc-make-and-goto-next-match   |
|  C-p        | evil-mc-make-and-goto-prev-match   |
|  C-t        | evil-mc-skip-and-goto-next-match   |
|  C-M-j      | evil-mc-make-cursor-move-next-line |
|  C-M-k      | evil-mc-make-cursor-move-prev-line |
  • 1
    Can you explain how to use it? I'm super confused. I just want to create a cursor column so I can add a few spaces to the front of each line, how would I do that for example?
    – Didier A.
    Aug 14 '19 at 23:47
  • @DidierA. you can simlply use vim keybinding for that: 1. go to beginning of first line, 2. press C-v 3. move down to the last line using j. 4. Press Shift-I to enter insert mode and type whatever you want (f.e. 4 spaces). 5. Press ESC.
    – tigerjack
    Mar 29 '20 at 9:27
  • I find the multiple-cursors layer more usefel for text mode (like org or latex) where you want, f.e., to put different words in bold or italic or whatever. In code mode, you often simply want to refactor code; iedit is great for that (SPC s e)
    – tigerjack
    Mar 29 '20 at 9:29
(require 'evil-mc)
(global-evil-mc-mode 1)

you can look for key bindings of evil-mc, personally I like it quite a lot... C-n for next matching word under cursor, and most of the suite under "gr"

There is also iedit that works quite well, though I normally stay on evil-mc.

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.