Formatting the following two lines:
fooSPACESPACE
bar
using gqap (or gq on a visual selection of them) will give:
foo bar
I there a way to customize its behavior, to merge arbitrary number of white
space at the end of the line to a single space character, so that in the
example above I get:
foo bar
TIA
--
Michael Iatrou (iycz)
Maybe by first using the following to suppress all whitespace at ends of
lines? (Note: In "mail" files, the single space at the end of the
dash-dash-space sig delimiter should be left intact, hence the TRUE path
of the :if.)
mark '
1
if &ft == 'mail' && search('^-- $', 'cn')
1,/^-- $/-1s/\s\+$//e
else
1,$s/\s\+//e
endif
''
Note: The second and last lines in the (untested) snippet above are
"naked ranges", they move the cursor to the corresponding line.
Best regards,
Tony.
--
The gods gave man fire and he invented fire engines. They gave him
love and he invented marriage.
> I there a way to customize its behavior, to merge arbitrary number of
> white space at the end of the line to a single space character, so
> that in the example above I get:
>
> foo bar
There's no easy customization so you have to combine several commands.
TextFormat plugin adds a bit more automatic and intelligent
text-formatting commands. It's suitable for human languages and it does
what you asked for (removes extra spaces).