On 2024-01-16, Britton Kerin wrote:
> The sequence 'vaw' (visual around word is how I think of it) does
> weird things depending on white space:
> 
>   * 'vaw' while on 'a' in 'foo bar' selects ' bar' (space followed by bar)
> 
>   * 'vaw' while on 'a' in 'foo bar ' (with trailing space) selects
> 'bar ' (bar followed by space)
> 
> Why?
> 
> I could understand (though not exact agree with the policy) if spaces
> are being viewed as part of particular words in this context, but I
> don't see why adding a space after bar causes the one before it to not
> be selected.

I can't find where this is documented, but Vim defines "a word", for
most purposes, as a sequence of word characters followed by white
space.  That definition can't hold at the end of the line, so the
developers were left with a choice of including the preceding white
space or not including any white space.  The choice to include the
preceding white space is pragmatic.

If you want to cut a word from one place and paste it somewhere
else, it is convenient for that cut to include white space so that
you don't have to remove it separately from the cut location nor add
it separately to the paste location.  There is no following white
space at the end of a line, so the preceding white space is included
instead.  Also, if you delete a word at the end of a line,
presumably you don't want to leave white space at the end of that
line.

That logic is also applied in other situations where a sequence of
word characters is followed by a non-word character such as
a closing parenthesis.

Regards,
Gary

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20240119164847.GC26982%40phoenix.

Raspunde prin e-mail lui