3 ms·
> With a keyboard and a mouse, I have to reach over, select the whole line (being careful not to over or under select), hit Ctrl+C, move the cursor down to the
by munificent 10y ago
> With a keyboard and a mouse, I have to reach over, select the whole line (being careful not to over or under select), hit Ctrl+C, move the cursor down to the beginning of the next line, and hit Ctrl+V.
Sure, but who does that?
In any text editor on the Mac its:
- Command-Left to move to the beginning of the line
- Shift-Command-Right to select to the end of the line
- Command-C to copy
- Command-V to paste
One annoying thing about that, though, is that it doesn't copy the newline itself, so if you want to paste the line and the line terminator multiple times, you need to do something more like:
- Command-Left to move to the beginning of the line
- Shift-Command-Right to select to the end of the line
- Shift-Right to select the newline
- Command-C to copy
- Command-V to paste
But, of course, most full-featured text editors make that easier. In Sublime and Atom, it's:
- Command-L to select the current line
- Command-C to copy
- Command-V to paste
- travv0 10y agoSublime, at least, has a duplicate line command. I believe you can also use the copy command with no text selected to copy the current line. None of your examples seem nearly as effective as pressing yy to copy the line and p to paste below.
- splouk 10y agoAtom is the same.
- GrinningFool 10y ago- [2] Command-Left to move to the beginning of the line - [3] Shift-Command-Right to select to the end of the line - [2] Command-C to copy - [2] Command-V to paste Total keypresses: 9 Total keypresses for yyp: 3 (4 if you have to esc to normal mode first) My point being that even the simple and straightforward actions you provided are more complex than they seem.
- aninhumer 10y agoFirstly, that's 6 keypresses, because you don't need to lift your finger off Command. Secondly, that's just using the minimal set of shortcuts that work anywhere. If you're in an actual editor, it almost certainly has a shortcut like Ctrl-Shift-D for duplicate line. And I think a lot of vim users might be surprised how simple and straightforward things can be in a modern editor.
- GrinningFool 10y agoAbsolutely right on the six, my bad.
- flukus 10y agoHow composable are those commands? The best thing about vim is that it works with text objects, so yy will select a line but yw will select a word, yip select a paragraph, yi( will select in the function call, etc. Similarly, if I want to change them or delete them the y becomes a c or d.