On 21/11/08 10:33, Michael Iatrou wrote:
> Hi,
>
> 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
>
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.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---