Friday, June 12, 2015

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

Hi,

I would like vim to wrap text paragraphs automatically and indent list
items as well. Currently I have formatoptions (fo) set to croqlwa1. In
this context only "awn" flags are relevant.

The problem is that with the "n" flag it is impossible to properly
format a paragraph if a line within the paragraph begins with a number
due to line width and wrapping. Vim then treats the next line as a part
of a numbered list's item. It seems that when indenting list items vim
ignores hints like trailing spaces at the end of the line before the
line starting with a number. I thought that the "w" flag would enforce
that.

An example below. Explicit <SP>. A story mentioning some events during
some years:

Blah foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
2013. bar foo bar foo bar foo bar. Foo bar foo bar foo bar foo bar<SP>
foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar.
Blah foo bar foo bar foo bar foo. Foo bar foo bar foo bar foo bar<SP>
2014. bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar<SP>
bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar<SP>
2015. foo bar foo bar foo bar foo bar foo bar foo bar foo bar<SP>
bar foo bar foo bar foo bar foo bar foo bar foo bar foo.
1. foo bar foo bar foo bar foo bar foo bar foo bar foo<SP>
foo bar foo bar foo bar foo bar foo bar foo bar foo bar
2. foo bar foo bar foo bar foo bar foo bar foo bar foo<SP>
foo bar foo bar foo bar foo bar foo bar foo bar foo bar

While indents one line after items 1. and 2. are beneficial, indents
added by vim one line after numbers describing hypothetical years are
messing up the text.

It happens automatically when the "a" flag is enabled or after pressing
gqap.

I have found a similar report from the past:
https://groups.google.com/forum/#!searchin/vim_use/formatoptions$20indent$20number/vim_use/6Hv0e0FRJyU/piKRUB_j7gwJ

Is this a bug or am I doing something wrong? Or maybe my problem could
transform into a feature request?

--
Marcin Szewczyk http://wodny.org
mailto:Marcin.Szewczyk@wodny.borg <- remove b / usuĊ„ b
xmpp:wodny@ubuntu.pl xmpp:wodny@jabster.pl

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