This question is a semantically similar question but the OP's intent was more about which implementation of multiple cursors was "best".

I echo one of the commenters of that question who asked "Can you explain how to use it? I'm superconfused". . . as am I! That answer included a list of keybindings (which are also available (though not in handy table format) on the evil-mc readme). When I search on the web for this I get keybindings and others with the same question but have not found just basic instructions.

Could someone just walk through an example of how to use multiple cursors? For example, let's say I have this list of variables cut from a spec (including non-alignment):


I want to change that list to:

 String purpose;
 String dtlastmod; 
 String lastmod;   
 String dtrelver;  
 String relver;
 String comps;

It seems like multiple cursors might make this easy but I'll be darned if I can't figure it out. Is that a good use case? If not, what is a good example and could you talk through the steps?

2 Answers 2


For a pure evil-mc solution you need to have a cursor in each line. I don't know of such a function out of the box, but since this is the hackable editor I defined one:

(define-key evil-normal-state-map (kbd "C-M-<") 'rno/evil-mc-make-cursors-for-all-regexp)
(evil-define-command rno/evil-mc-make-cursors-for-all-regexp ()
  "Initialize `evil-mc-pattern' and make cursors for all matches ignoring exact letter matches."
  :repeat ignore
  :evil-mc t
  (if (evil-mc-has-cursors-p) (user-error "Cursors already exist.")
    (setq evil-mc-pattern
          (cons (evil-ex-make-search-pattern (replace-regexp-in-string
    (evil-mc-print-cursors-info "Created")))

How to use:

  • make a visual selection of the first delimited term from backtick to backtick
  • call the new function using C-M-< to create a cursor on each closing backtick
    • the function takes the selection and replaces all word characters (e.g. letters) by a regex matching all word characters, so it basically searches for two backticks with letters in between and creates cursors there
  • D to delete the backtick and any other characters, e.g. trailing whitespace
  • a;ESC to insert the semicolon at the end
  • T` to move backwards before the next backtick
  • d0 to delete everything until the beginning of the line, e.g. leading whitespace
  • iString SPC ESC to prepend "String "
  • g r q to get rid of all fake cursors

Here is a short animation what it looks like: enter image description here

  • Pretty amazing, thanks for your insights! Fwitw for future readers, I had eventually figured some things out about multiple cursors and contributed those things to this Spacemacs cheatsheet.
    – AndyJ
    Commented Jun 28, 2021 at 15:19

For only affecting the six rows you could narrow-to-region using SPC n r

I'd break it down in the necessary steps:

  • Remove leading whitespace using SPC SPC delete-whitespace-rectangle RET
  • Remove trailing whitespace using SPC x d w
  • Remove backticks using a series of commands, e.g.:
    • v on one backtick to create a visual selection
    • g r m to get a cursor for each instance of the selection
    • x to remove it
    • g r q to get rid of the cursors
  • Prepending "String SPC"
    • ggVG to mark all lines in visual-line mode
    • I to jump the beginning of a line
    • String to insert "String "
    • ESC to leave insert mode and have the insertion apply to all previously selected lines
  • Appending ";"
    • ggVG to mark all lines in visual-line mode
    • A to jump the end of a line
    • ; to insert the semicolon
    • ESC to leave insert mode and have the insertion apply to all previously selected lines

check out my other answer for a pure evil-mc solution

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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