gabesoft / evil-mc

Multiple cursors implementation for evil-mode
MIT License
387 stars 36 forks source link

Is it possible to create new cursors based on arbitary strings instead of symbols? #19

Open 3rd3 opened 8 years ago

3rd3 commented 8 years ago

With multiple-cursors it is possible to mark some characters, for example the first <a href in this text:

<a href="http://www.example.com"></a>
<a href="http://www.example.com"></a>

then call mc/mark-next-like-this and it would then create a new cursor at the next occurrence of <a href. This is very when editing repeating syntactical structures which are not necessarily matched by symbols (or words, not sure which one evil-mc uses).

gabesoft commented 8 years ago

Yes, if you mark a region evil-mc will use that to match future cursors. When no region is marked then it uses the symbol at point. So, in this case if you select <a href and call evil-mc-make-and-goto-next-match (or press C-n) it should work as expected.

3rd3 commented 8 years ago

Ah, I see, but this does not seem to work with standard Emacs marks, only with marks made in visual mode, could that be?

gabesoft commented 8 years ago

Yes, that is correct. evil-mc checks for regions only if the visual mode is on. For more details see the method evil-mc-set-pattern in evil-mc-cursor-make.el

3rd3 commented 8 years ago

Is this by design, limitation or was it just never considered? Perhaps I am using evil the wrong way, but I occasionally have Emacs marks (for example custom functions that expand the mark in certain ways, and I occasionally mark things with shift in insert mode.)

gabesoft commented 8 years ago

This never came up as an issue. I use evil mode via spacemacs and it's pretty well integrated. You may be able to use the evil methods when creating marks in your functions.

gabesoft commented 8 years ago

I came to emacs from vim though. So, I'm only used to mark via the visual mode.

JJPandari commented 8 years ago

@3rd3 How about installing both evil-mc and multiple-cursors and having the same key binding for evil-mc-make-and-goto-next-match on normal-state and mc/mark-next-like-this on insert-state (so you get consistent experience on both states)?