4 ms·
When I AM in vim and I need to, for example, delete some large number of lines, I find myself trying to guess how many lines, but guess on the small size. Then
by Osiris 13y ago
When I AM in vim and I need to, for example, delete some large number of lines, I find myself trying to guess how many lines, but guess on the small size. Then I guess again, until I get close enough to see the exact number.
That's my biggest issue using vim, the need to count lines before every operation. I keep getting the feeling I'm doing something wrong when I do that. Sometimes I just break down and use visual selection mode to select the text and delete the whole group, much like I'd do in another editor.
Is there something I'm missing about having to count before doing operations in vim?
- JulianWasTaken 13y agoUsually, yes. I never count. There's a lot of alternatives depending on what you're counting. If you're deleting a block of lines say, usually it's not just some random block, and so usually you want some more targeted motion. Like e.g. d} or d[m for an exotic example. Or d/stuff if you're lazy, like I often am. There's also `relativenumber` for when you really do need to count, but I'm ambivalent on whether I like it. And sometimes you just want `.`. It's dirty, but sometimes it's quicker. I like to basically always be typing every time I have a goal in mind. So I never want to be thinking really for too long once I've decided where I want to get. So I'll do dw... once in awhile. So yeah, it depends.
- johncoltrane 13y ago:set relativenumber shows… line numbers relative to the current line allowing you to: 1. find the last line of the block you want to operate on 2. see the number you need to use 3. use that number Motions and text-objects are very useful as well: dip da{ d{ d/foo d?bar d'a d]m …