Tuesday, April 17, 2018

Re: Two spaces after punctuation and SpellCap issues

On 2018-04-16 18:05, Bram Moolenaar wrote:
> Tim Chase wrote:
>
> > To reproduce:
> >
> > $ vim -u NONE
> > :syntax on
> > :set spell cpo+=J
> >
> > to let vim know I always put two spaces after a sentence.
> > However, if I enter text like
> >
> > Call Bob re. the faucet.
>
> That 'cpo' flag is not related to spell checking. The spell
> checking relies on recognizing the abbreviation. I don't see "the"
> after "St." highlighted for that reason.

However the 'cpo' "J" flag is related to defining what a sentence is
(must be followed by two spaces when cpo+=J), and in my example(s),
the "the" is getting highlighted as SpellCap because vim thinks a
sentence is ending at the period before "the". So vim suggests I
should *capitalize* "the" (not that it's spelled wrong). Vim knows
enough that a sentence shouldn't end there (using parens to navigate
by sentence doesn't stop at the "t" in "the"; which is the correct
behavior) so there's no reason for the SpellCap recognition to think
a sentence ended before it either.

> Note that this won't cover everything, esp. a dot at the end of the
> line would normally not have spaces after it, thus Vim can't know
> whether it's the end of a sentence or not.

There would be an edge case of text like

Call Bob re.
the faucet

which would reasonably highlight "the" as SpellCap.
But for the case where 'cpo' contains "J", I'd still posit that it's
a bug to consider the sequence "end-of-sentence punctuation, single
space, lowercase-word" as a condition to trigger SpellCap on the
lowercase-word portion. :-)

-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.
For more options, visit https://groups.google.com/d/optout.

No comments: