Comment by πŸš€ stack

Re: "Always off by 1! Is it me?"

In: s/vim

Yea, sort of makes sense, maybe. It sure drives me nuts!

I am constantly catching an extra character by yanking lines in V mode. To copy 2 lines I intuitively go down 2, and catch the first character of the next line! Combine that with pasting in the wrong place, and my next few minutes are occupied by furious remedial editing...

πŸš€ stack [OP/mod]

2024-11-01 Β· 2 years ago

5 Later Comments ↓

🐦 wasolili [...] · 2024-11-01 at 02:35:

for copying 2 lines, I usually just do `yj` which will yank the entire current line and the line after. numbers can be used for more lines, e.g. `y2j` for the current line and the next 2, and k works as expected (e.g yk for current line and the line above it)

then there's `yy` for just the current line. there's also the move and copy commands which are occasionally useful.

I very rarely use visual mode since usually the default motions behave more usefully outside of it. (as in `yj` from normal mode yanks the two lines, but `vyj` only yanks part of each line unless you do `0vj$y`))

πŸ•Έ arma Β· 2024-11-01 at 12:31:

I'd say the off-by-one thing is a UX bug. For me the main powerful idea behind Vi/Vim is not where the cursor ends up, but modes (normal/insert/visual). And the reason why modes matter is that typing becomes easy, because the user rarely has to press more than one key at a time on the keyboard. None of that Ctrl-Alt-Shift finger acrobatics.

🐐 satch · 2024-11-01 at 13:32:

It would be pretty easy to make it the choice of the user whether to have the inconsistency be at the end of the line or the beginning of the line.

That way people who are bothered by the behavior could add something simple to their init script and problem solved.

That being said, it’s pretty easy to get used to - especially if you make frequent use of β€˜A’.

πŸš€ stack [OP/mod] Β· 2024-11-01 at 16:28:

OK, I will make it a goal to find the bindings that actually do what I want and get used to them.

@arma - yes! Before Vim I spent almost a decade or so with Emacs and Common Lisp, and my hands are a wreck.

🦊 fiore · 2024-11-09 at 19:00:

happens to me as well!

Original Post

πŸŒ’ s/vim

πŸš€ stack: [mod]

Always off by 1! Is it me? β€” I love vim, but perhaps I am using it wrong! Whenever I do just about anything, I am pretty much always off by one character. In the simplest case, if I enter the instert mode and exit it, I am no longer on the same character! If I do it repeatedly, the cursor will crawl backwards. Whenever I yank and paste, I invariably wind up one character past where I wanted to paste. I thought I would get used to it eventually, but it's now been years and I am constantly '...

πŸ’¬ 18 comments Β· 2 likes Β· 2024-10-30 Β· 2 years ago