3 ms·
Does anybody here use the number repeating thing and feel like it's faster? I could _never_ make it faster, doesn't matter if I have relative lines or any other
by doix 2y ago
Does anybody here use the number repeating thing and feel like it's faster? I could _never_ make it faster, doesn't matter if I have relative lines or any other combination of settings. I've spent some time deliberately practicing and just gave up. I set my repeat delay very low and repeat rate pretty high, and just end up holding j/k, {/} or some other movement operator.
Maybe I suck at reading quickly, but by the time my eyes move from where I'm reading code to the line numbers, register what the relative number is, and type it (say 15) I could have just held j or } to get there faster. Same with something like d5w. I can't count 5 words, I'll just ctrl+v to get into visual selection and press 'w' until I'm happy and call it a day.
Pretty much the only time I do counting operations is when I'm doing writing macros, at which point I've slowed down enough that counting this doesn't feel that bad.
- QuadrupleA 2y agoAs a decades-long Vim user, same here, absolutely. Much faster for me to hit j 5 times than to count lines downward in my head. And to use visual mode for deletes etc. rather then precounting in my head beforehand.
- petepete 2y ago> than to count lines downward in my head :set relativenumber Once you get used to jumping right to the line it's far quicker. Searching and hopping can be quite quick _providing_ there's something unique to jump to, otherwise it can be tedious.
- williamdclt 2y agoI'm with you. The page gives "5k 12j" as an example, there's no way in the world it's faster for me to figure out that "12" is the right number faster than through other means. I have H mapped to `5h`, same for jkl, and that's good enough to do biggish jumps that I can eyeball (JJJJ is very quick to type while being iterative)
- bumbledraven 2y ago> The page gives "5k 12j" as an example, there's no way in the world it's faster for me to figure out that "12" is the right number faster than through other means. If you add `set relativenumber` to your .vimrc, then the nth line up and the nth line down from from your current line will each have an n on the left-hand side. This lets you see at a glance which motion (e.g., `5k` or `12j`) will take you to a given line. https://jeffkreeftmeijer.com/vim-number/ https://jeffkreeftmeijer.com/vim-number/
- troyvit 2y agoI spend about half a second estimating. I think, eh that looks like about 30 lines so I'll go 30k. Then it's "oops I was off by 5 lines", so 5j (or jjjjj like you) and I'm there. Unfortunately if I land where I go on the first try it's bad because my fingers leave the home row for a fist pump. "Yesss!" The relative number bit actually drives me nuts. Mostly I'm fixing some code error "on line 465" of my code. I open up my spacevim and I'm always at line 0, so I have to gg then 465G and it's irritating. Probably need a better IDE.
- inanutshellus 2y ago> I'm always at line 0 :set number :set relativenumber With both set, you see the actual line number you're on (e.g. line 465) and all other lines are relative. Personally I end up copy/pasting in/out of vim enough that I turn off line numbers but... FWIW, there's a way to not have the "always on 0" problem. :)
- alfanick 2y agonumber + relativenumber is the best combination I found so far for jumping between lines - you know where exactly you are, but jumping n lines up or down is great.
- faizshah 2y agoI do the same thing I have never understood the use case and it is included in every tutorial aa if it is something used daily. It’s so much slower to move your eyes and type the number even with relative numbers than it is to just hit w, e or f horizontally or j k vertically.
- lambdaba 2y agoI never understood relative numbers. To really grok Vi you have to understand that you should minimize steps and looking at the relative line number and typing it in is not ergonomic, it's better to search most often, absolute line number movements are good when referencing a stack trace etc.
- timrichard 2y agoI didn't get on with the relative numbers either. In IdeaVim and VSCode, I've mapped the spacebar in Normal mode to EasyMotion. For jumps that aren't very close, you can land on any character you can see on the screen in 4-ish keystrokes.
- samatman 2y agoI find that I can 'grok' about four lines. So if I have three lines to delete, I can just type 3dd and not get it wrong. But if I have ten lines to delete, I don't think of it as ten lines, and to be honest I type "shift mouse movement vd". What threw me off for a long time was trying to combine with j: it's `n+1`dj = `n`dd, and the former is almost never what I want. Since j is down I kept thinking I needed to use `jd`, and that isn't how it works. Sort of stuck with that for upward line delete, it's never intuitive to me to want to delete three lines up and express it as 2dk. I wish that D was backward, so it would pair with t/T and f/F, but it's an entirely different sort of deletion which I rarely need to combine with a motion. Even for what it does on its own, I use d$ out of habit. There must be a way to remap it, but one of my premises in using vim mode is that the skill transfers well, and changing any of the conventions fights against that.
- 000ooo000 2y agoPreviously I would use 25j/25k to go up and down 25 lines (for e.g.) but I've recently started using a pair of bindings to jump up/down 10 lines at a time. This seems to be striking a nice balance between my natural instinct to simply go up/down toward the desired line and doing it without a bunch of unnecessary keystrokes; I get ~60 lines on screen so I'm usually only a couple of keystrokes away from the line I want. I was finding that a number of lines requiring my right hand to type (e.g. 7-10 on my split KB) meant my right hand was moving up and then back down to the home row for the jk keystroke, which was slow and felt bad. With the 10 line jumps, most of the time, I only need <6 more lines to reach the line I want which my left hand will press leaving my right hand to jk. Seems a silly thing to worry about but doing it often grated on me. Re. your remarks about d5w: give the t/T and f/F operators a look, if you haven't already. I use these far more than numbered motions when it comes to line based motion. https://unix.stackexchange.com/questions/146824/what-is-the-difference-between-find-and-till-in-vim https://unix.stackexchange.com/questions/146824/what-is-the-...
- JamesLeonis 2y agoYou don't suck. Vim was built for a time when your TTY might take seconds to update. For example, a shell prompt over a modem. In those circumstances the number motions become more precise and less frustrating with such input lag. The other motions have similar commands and you chain them together, which again saves frustration with a painfully slow prompt. These days things are (usually) fast enough you don't have to worry about exactness, but it's right there when you are experiencing a bad connection.
- t43562 2y agoI have used number prefixes for repeating a very pervasive change that has to be done 1000s of times. When you're in that situation no other editor is any good and it's particularly useful for a complicated change which you record as a macro. Typically your macro starts with a regexp search for the next item to change then you have all your editing commands (including arrow keys and inserts and replaces and whatever) - a quite complicated macro, then you stop recording your macro and tell vim to do it 1000 times. if 1000 isn't enough then do it 1000 more. You can end up with junk at the end of your file or other issues but on the whole the ability to do a macro many times is still a fabulously useful feature. sed usually likes to work on a line-by-line basis whereas macros aren't limited to that so vim with numbers can basically do things that no other tool does.