Sunday, October 18, 2020

Re: Inconsistent overkill behavior on various motions

On 2020-10-18 01:12, Brennan Vincent wrote:
> "2$" (with cursor on first column) does nothing (presumably an
> error).

For the record, "$" does take a count, going to the end of the line
count-1 lines down. With only the single line, there's no count+1
line to go to, so both (n)vi and vim rightfully errors at you.

:help $

With more than one line you can observe the expected behavior. I'd
use "$" with a count more often if it did "count" lines rather than
"count-1" lines, because "count-1" requires doing the math in my
head. Just a little friction.

> "2^" (cursor on last column) has the same behavior as "^".
> Nvi errors on "2^"; otherwise the behavior is the same as Vim.

"^" doesn't take a count, so both (n)vi (at least here on FreeBSD &
OpenBSD) and vim ignore attempts to provide a count. I could see it
going either way here -- either erroring or just ignoring it.

> "2w" (cursor on first column) jumps to the last character on the
> line (same behavior as "2e").

There are some small "e" implementation differences between vi and
vim as detailed in `:help WORD` (right above `:help object-motions`)
but I don't think you're hitting this known case. I was surprised to
see that this nuance you encountered wasn't documented (as best I can
tell).

-tim






--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20201018074222.36581e4f%40bigbox.attlocal.net.

No comments: