1

I primarily use Vim for text processing, so in order to lighten that process, I've set some parameters in my .vimrc:

set fo=ant
set tw=80
set ts=3
set nojoinspaces

The nojoinspaces parameter is set in order for various movement operations to be sensitive to sentences without having to append two spaces after a period (which is not a common practice in my language).

I'm mostly happy with this setup, but it bothers me that I have to insert a blank line between any two paragraphs in order for Vim not to collapse them. This is especially bothersome when I'm writing a list. I found that setting formatoptions to antw eliminates this problem, while retaining most of the features I need for 'normal' paragraphs.

So far, so good! But the problem is that whenever I have a line that is EXACTLY 80 characters long, Vim automatically inserts a blank line, i.e.:

A major part of the scientific literature on consciousness consists of studies
that examine the relationship between the experiences reported by subjects and
the activity that simultaneously takes place in their brains—that is, studies of

the neural correlates of consciousness.

You would think this wouldn't happen all that often, but I find it to be a pretty big pain in the backside.

So I guess my question is: Is there any set of formatoptions parameters that would suit my requirements: automatic formatting of NORMAL paragraphs but no need for blank lines between items in, say, a list? Or will I have to keep toggling between them? And why does antw make Vim behave this way in the first place?

  • 1
    Are you working from an 80-columns wide terminal? If so, what happens if you use :set tw=79 inside Vim? – VanLaser Sep 19 '16 at 16:56
  • I can't seem to reproduce that behaviour. Maybe something else is interfering. – Antony Sep 19 '16 at 17:38
  • 2
    (I'm thinking at Sato Katsura's comments here: vi.stackexchange.com/q/9118/1800 "displaying a line 80 characters long on an 80 columns terminal prints an extra newline") – VanLaser Sep 19 '16 at 18:16
  • 1
    Oh, I see. The trailing space is wrapping to the next line. – Antony Sep 19 '16 at 19:19
1

@VanLaser: Thanks, :set tw=79 did the trick!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.