Say I want to edit those two numbers. With multi-cursors, it's as simple as select one number, hitting a button that causes the other number to be selected, then writing the new value.
Now, after I wrote it, I realize I forgot to put a space after the colon, and want to change the formatting. No problem - I just make the change to the first line, and the next line follows.
Same as macros? Kind of. But let's say I make a mistake in the macro, e.g., I move the cursor left to the beggining of the line letter-by-letter instead of hitting "home", which is a killer for a macro since each line is a different length. (this is a contrived example a real vim'er will never do, but there are plenty of real examples of 'oops forgot about that' things when recording macros).
Anyway, when I run my macro, suddenly things won't work, and then undoing and starting the re-record process takes time. But if I'm doing this with mulitple-cursors, I see right away, visually that something's wrong, and it's easy to fix - I just hit "home" after moving the cursor left.
And note - this is a drop-dead-simple use case that happens 10's of times a day for any css programmer. Similarly, most programmers will run into cases where they have two similar if blocks one after another, or two similar "except" blocks, and so on.
And that's not even going into lots of other, very powerful cases, like taking a function that gets a list of paramaters, and being able to easily manipulate these paramaters, e.g. given "foo(a, b, c, d, e)", I can easily multi-cursor all the commas, then copy all the params, then paste them after the func definition, hit enter, and I've got a list of all the params after the function definition. And this isn't hard, at all! I visually see everything I'm doing as I do it, and if something goes wrong, I fix it on the spot.
I could ramble more about this, but I think I've either convinced you I'm crazy, or at least to try multi-cursors out :)
If you do this kind of editing daily, then executing the following commands would become second nature
:s/50/60/g
:s/:/: /g
No need to touch the mouse or use macros. Many use-cases for multiple cursors are satisfied by the core functionality of vim, however they may not be immediately obvious.
Alright, but in more complicated cases you have to bust out macros, and they're just plain harder since they don't give visual feedback.
Take an example like the following:
def foo():
// do stuff
def bar():
// do stuff
Now I want to change my comment to say:
// The function foo does stuff
With multiple cursors, I select both def's, copy the following word, then go down and change the comment.
Again, I'm not saying this can't be done in vim. But it's just plain easier to do with multiple cursors. And if you don't believe me, well, that's your right of course. But having used both, extensively, I'm telling you - please, at least give it a try. For many daily use cases, it's just so much easier. And I don't get anything out of selling you on multiple cursors except for the warm fuzzy feeling of maybe helping a fellow developer learn something that will help them.
More serious response: I think after many years of training ones brain to use the features available to it some of those features become second nature and subconscious. This is great for editing and it's the reason I immediately saw that you left me a really easy way to do it, but it can make seeing the value of new features more difficult.
I run into examples like this a lot and have yet to find an elegant way to deal with it. Honestly, I'd like to see if there's a simple solution.
I find that I spend a lot of time in my editor crafting regular expressions to do clever replacements and I've yet to get so good at it that it doesn't distract me from my editing.
I see the point, but when you have to duplicate the code like here for the `50px`, you should use something like SASS/LESS to put the value in one place and then use a variable everywhere.
<pre> .some-css-rule { padding-left:50px; padding-right:50px; } </pre>
Say I want to edit those two numbers. With multi-cursors, it's as simple as select one number, hitting a button that causes the other number to be selected, then writing the new value.
Now, after I wrote it, I realize I forgot to put a space after the colon, and want to change the formatting. No problem - I just make the change to the first line, and the next line follows.
Same as macros? Kind of. But let's say I make a mistake in the macro, e.g., I move the cursor left to the beggining of the line letter-by-letter instead of hitting "home", which is a killer for a macro since each line is a different length. (this is a contrived example a real vim'er will never do, but there are plenty of real examples of 'oops forgot about that' things when recording macros).
Anyway, when I run my macro, suddenly things won't work, and then undoing and starting the re-record process takes time. But if I'm doing this with mulitple-cursors, I see right away, visually that something's wrong, and it's easy to fix - I just hit "home" after moving the cursor left.
And note - this is a drop-dead-simple use case that happens 10's of times a day for any css programmer. Similarly, most programmers will run into cases where they have two similar if blocks one after another, or two similar "except" blocks, and so on.
And that's not even going into lots of other, very powerful cases, like taking a function that gets a list of paramaters, and being able to easily manipulate these paramaters, e.g. given "foo(a, b, c, d, e)", I can easily multi-cursor all the commas, then copy all the params, then paste them after the func definition, hit enter, and I've got a list of all the params after the function definition. And this isn't hard, at all! I visually see everything I'm doing as I do it, and if something goes wrong, I fix it on the spot.
I could ramble more about this, but I think I've either convinced you I'm crazy, or at least to try multi-cursors out :)