But seriously, I love the work that has been going into all these different text editors. It seems to be net benefit for everyone. Multiple cursors are like a visual kbd-macro-edit..
Obligatory emacs equivalent source:
- https://github.com/magnars/multiple-cursors.el - http://emacsrocks.com/e13.html
By the ever awesome Magnar Sveen
Used Emacs from a few years and I don't remember any more how to do all those things!
> * Multi key commands like ciw do not work at the moment
> * Single key commands that do not terminate properly cause unexpected behavior
> * Undo behavior is unpredictable
> * Performance in terminal vim degrades significantly with more cursors
There are some more than just these. I really wish Vim were easier to hack. The cursor and drawing models are terribly rigid in Vim, so this plugin probably has to resort to some awful hackery to achieve what it does. :-(
That said, good work, but I'll hold off on trying it out, for now. I'd like at least undo to be fixed before I can use it frustration-free in my production-environment, i.e. producing actual code.
I really hope you continue your work, because I'd love to see multi-cursor functionality implemented in Vim!
Please, please, try it out. I'm telling you, this is leaps and bounds above macros/regexp's for most use cases. It's the difference between a visual way to make changes, and a "disconnected" way in which you write commands and hope they work.
Seriously, I consider Multiple Cursors one of the greatest advances in text editing, and everyone who doesn't even bother to try it is just being silly.
Exactly, it's like ed vs vi.
I hear this. Hopefully, the author will be able to implement what Sublime has: a find all field (which accepts regular expressions), and results in multiple cursors on all the matches.
I do this all the time in Sublime and it's so natural:
Cmd+F, /regex/, opt+Enter, [replace, or commands or whatever]
It's just as fast as your usual find and replace or quick macro, except that you have instant feedback, are able to undo, jump around by word, or (with vim-mode), use t or f to find a character, ci", etc.
Selecting a match one case at a time is great, though, when you need to skip some matches. Say you have `old_var`, `old_var2`, and `old_var3`. Just start at the top of the function, and match, match, skip, match, skip, [type and replace]. Sure, you could do a regex on old_var[^\d], but depending on what you're matching and what you're skipping it sometimes is just not worth puzzling out the right regex.
I used to also have plugin for ST1, which allowed you to do common things like selecting a line, then splitting it by a separator. For example, you'd select a line, split it by ", ", and get a cursor on each paramater. It worked wonderfully for these kinds of things.
Mine supports things like multi-key commands and has predictable (if not entirely desirable) undo behavior, but it has issues in its own right. I figure we may both learn a thing or two from each other's attempts.
Vim really does need this feature to get some mindshare back from ST2, and I'd love to see this well-implemented, even if its by someone else.
I have used this command for the purposes of changing a variable name. It could be better but gets the job done most of the time.
> :.,$s/\<<C-r><C-w>\>//gc<Left><Left><Left>
Short demo: http://cl.ly/image/403j153F3u1h
I'm linking it here so people can find it: https://github.com/fatih/subvim
:10,20s/poorly_named_var/nice_var/g
That being said, let me also recommend my favorite clipboard history tool, Jumpcut (http://jumpcut.sourceforge.net/).