When multiple cursors has marked multiple points in a buffer you can use C-v (mc/cycle-forward) to cycle through and look through all cursors while typing for all cursors. I'm wondering how to enter different text at each cursor point while retaining the mc/cycle-forward cycling behavior or working with mc as seamlessly as possible.

A rough use case (possibly positioning #5 after #7):

  1. mc/mark-all-like-this or equivalent to create multiple cursors
  2. [usual mc interaction with all cursors]
  3. [some action to indicate interaction with a single cursor]
  4. enter text at current cursor
  5. hit C-v an arbitrary number of times to select a different cursor
  6. enter text / move point of a now different current cursor
  7. [some action to restore standard mc behavior]
  8. [resume interaction with all cursors]

I currently use isearch-forward to fill in for this (for example to fill in different section headers in an html document), but this drops me out of mc and forces me to re-mark.

  • 2
    How about using helm-swoop instead? Search what you want then enter edit mode to enter different text.
    – cutejumper
    Commented Mar 20, 2016 at 20:06
  • Finally got around to trying helm swoop :-D That's really nice! It even lets you use multiple cursors in the edit mode! Is there a way to access context of matching lines in the edit mode?
    – ebpa
    Commented Mar 20, 2016 at 21:04
  • 1
    See multiline behavior.
    – cutejumper
    Commented Mar 20, 2016 at 21:20
  • 3
    Another way (of course there are many) might be to use M-x occur (M-s o) to find what you want, switch into the Occur buffer, press 'e' for occur-edit-mode, change what you want (using multiple cursors if you want) and then C-c C-c when finished.
    – stevoooo
    Commented Apr 3, 2017 at 20:06
  • You can try query-replace with recursive-edit (bound to C-r when query-replace is active) if you are trying to replace a few strings in a buffer. Recursive edit would let you freeze the query-replace, make some specific changes at point and let you resume the unfinished query-replace command.
    – narendraj9
    Commented Dec 24, 2020 at 22:03


Your Answer

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

Browse other questions tagged or ask your own question.