3 ms·
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
by chunkstuntman 12y ago
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.
- astine 12y agoTrivial counter-example: .some-css-rule { padding-left:50px; padding-right:50px; margin:50px; } Pretend you want to avoid changing the margin.
- chunkstuntman 12y ago:s/50/60/g<CR> @: or even just /50<CR>r6n. if there's any new feature I'd like to see in neovim it would be one key that will repeat an ex command like period does for normal/visual mode
- astine 12y agoYou're first example wont work. What you want is :s/50/60/<CR> @: And that still won't handle .some-css-rule { margin:50px; padding-left:50px; padding-right:50px; } The second example will work, for this, but not for the situation where you change your mind halfway through and decide you want 70px instead.
- eckzow 12y agoGlib response: :s/t:50/t:60/g 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.
- astine 12y agoHow about this one: .some-css-rule { padding-left:50px; padding-right:50px; margin-left:50px; margin-right:50px; } 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.
- edanm 12y agoAlright, 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.