5 ms·
I don't know how people program without this feature You must do some kind of programming I've not encountered in my many years. While my editor of choice can
by solipsism 9y ago
I don't know how people program without this feature
You must do some kind of programming I've not encountered in my many years. While my editor of choice can do this, I would have no idea how, because a feature like "increment duplicates" is needed so infrequently that I would never remember the shortcut.
- derimagia 9y agoIt's one of those things that is incredibly useful. Of course it's possible to survive without it, but it's like saying "I don't know how people program without Copy and Paste". It helps.
- khedoros1 9y agoCopy and paste is something that I use many times a day, even when I'm not programming. Needing to do the same edits over multiple lines doesn't happen often in my code. There are appropriate plugins available for my editor, but I've never felt the need to install them.
- staticassertion 9y agoI don't use this as much as copy/paste, but I absolutely use it daily.
- monkpit 9y agoThat quote was referring to column editing mode, not “increment duplicates” shortcut.
- staticassertion 9y agoIncrement duplicates is just one of many, many utilities that pairs well with multiple carets. Formatting is another. Boilerplate code, for example today I had to implemented code like this: impl Into<Node> for ProcessNode { fn into(self) -> Node { Node {some_boilerplate(self)} } } I had 6 node types. Using multiple cursors I: * Implemented it once * Duplicated it 5x * Copied the names of the types I needed to impl for * Attached a cursor to each impl * Used ctrl + left/ right to word-jump, and past in the appropriate area Now it's not like this saved me more than a minute or two, but this sort of thing is extremely common in my experience, across languages.
- xfer 9y agoOr you could write a macro?
- staticassertion 9y agoThat sounds like considerably more work.
- kazinator 9y agoIn Vim (on Unix), type this into the buffer for x in type1 type2 type3 type4 type5 type6 ; do cat <<! impl Into<$x> for ProcessNode { fn into(self) -> $x { $x {some_boilerplate(self)} } } ! done Now do a line-oriented visual select of all the lines from for to done (using V + cursor movements). Then pipe to shell with !sh[Enter]. Poof! The above is replaced with the following: impl Into<type1> for ProcessNode { fn into(self) -> type1 { type1 {some_boilerplate(self)} } } impl Into<type2> for ProcessNode { fn into(self) -> type2 { type2 {some_boilerplate(self)} } } impl Into<type3> for ProcessNode { fn into(self) -> type3 { type3 {some_boilerplate(self)} } } impl Into<type4> for ProcessNode { fn into(self) -> type4 { type4 {some_boilerplate(self)} } } impl Into<type5> for ProcessNode { fn into(self) -> type5 { type5 {some_boilerplate(self)} } } impl Into<type6> for ProcessNode { fn into(self) -> type6 { type6 {some_boilerplate(self)} } } Don't write in some insane boilerplate-driven programming language in the first place. Anyone proliferating this kind of duplication (whether with multi-cursors or shell here docs or any other way) should be flogged.
- khedoros1 9y agoI've got to agree. It's one of those things that could save me a minute of manual editing every once in a long while, but I feel like there have to be lower-hanging fruit, in terms of increasing my editing speed.