Friday, February 25, 2011

Re: Trailing white space in multi line comments (ft=php)

On 25/02/11 11:53 PM, Marco wrote:
> Hi,
>
> when I edit source code in C (set ft=c) I can input multi line comments
> without problems, when I edit PHP files (set ft=php) a trailing white space is
> introduced.
>
> To reproduce, my settings:
>
> set textwidth=50
> set plugin on
> set indent on
> set ft=php
>
> /*
> * Lorem ipsum dolor sit amet, consectetur
> * adipisicing elit, sed do eiusmod tempor
> * incididunt ut labore dolore magna aliqua.
> *
> */
>
> Here after consectetur and after tempor there's the space. Why? How can I get
> rid of this?

Check the setting of 'formatoptions'

:help 'fo'
:help fo-table

There's an option there about using whitespace at the ends of lines to
indicate a paragraph is continuing. It affects the gq command for
automatic formatting (and maybe others), and is honoured when text
wraps.

Presumably a filetype plugin (ftplugin) for php sets this option. It's
probably easiest to unset it by either putting a :set command in
~/.vim/after/ftplugin/php.vim or an autocommand in your .vimrc after the
commands that enable filetype plugins. Something like

:au FileType php set fo-=whatever

Ben.

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

No comments: