Sunday, June 14, 2015

Re: Formatting of lists and paragraphs containing numbers with fo+=n

On 13.06.15 19:39, Marcin Szewczyk wrote:
> On Sun, Jun 14, 2015 at 12:43:11AM +1000, Erik Christiansen wrote:
> In comparison, mine is:
> >
> > let &flp = '^\s*\(\d\|\a\)\.\s*'
...
> Are you sure you have no "+" after the parenthesis? The flp above
> doesn't allow item numbers greater than 9 and disallows normal numbers
> smaller than 10. After adding the "+" the situation goes bad back again.

Pasted it directly from my .vimrc, but that only proves that I haven't
yet needed a long numbered list. ;-)

Though it was not so evident last night, on the wrong side of midnight,
slowing down now to actually look at the regex for flp, it is clear that
it must revert to false triggering in your case when the '+' is added.
Further, if we want to be 100% immune to list point mimicry due to
unfortunate wrapping, then it is essential to choose a unique regex.
That would seem to require choice of a unique suffix, since the rest is
quite ordinary text.

With '\.' susceptible, and ')' no safer, I'd look at some of these:

1] asdjk kjasldjlkjklj kljaslkdjakljsd lkjadslkjaskldjklaj ljlkj

1} asdjk kjasldjlkjklj kljaslkdjakljsd lkjadslkjaskldjklaj ljlkj

1* asdjk kjasldjlkjklj kljaslkdjakljsd lkjadslkjaskldjklaj ljlkj

1/ asdjk kjasldjlkjklj kljaslkdjakljsd lkjadslkjaskldjklaj ljlkj

1:: asdjk kjasldjlkjklj kljaslkdjakljsd lkjadslkjaskldjklaj ljlkj

1-- asdjk kjasldjlkjklj kljaslkdjakljsd lkjadslkjaskldjklaj ljlkj

This regex provides for the last four:

let &flp = '^\s*\(\d\|\a\)\+\(\*\|/\|::\|--\)\s'

The trailing '*' is gone, because it only served to make the '\s' also
superfluous.

I found that changing flp after starting Vim was ineffective. The
assignment only worked for me when made in .vimrc, and restarting Vim
after each change. I didn't find that documented at ":h flp", but it may
be somewhere else.

If you try something along those lines, then folding-induced mimicry
should be sufficiently unlikely for most text. If using utf-8, then
an even safer option might be choosing a thoroughly weird character,
like the fat little bullet symbol I've seen once or twice. That could
obviously be mapped so that the full digraph sequence need not be
remembered in order to create it.


Erik

--
"With sufficient thrust, pigs fly just fine. However, this is not necessarily
a good idea. It is hard to be sure where they are going to land, and it could
be dangerous sitting under them as they fly overhead." -- RFC 1925
(1 April 1996)

--
--
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:

Post a Comment