Friday, August 24, 2012

Re: help on vim indenting for php

On 2012-08-24, merry42 wrote:
> Hi,
>
>
> I have installed vim 7.3.429 on my linux box (ubuntu 12.04) and
> php.vim is set to the latest version 1.35 (it was 1.33 -- I
> updated it manually) globlly (file is
> /usr/share/vim/vim73/indent/php.vim)
>
> and my test file is the following:
> if ($a
> )
> {
> $b = 2; }
>
> I would like to get:
> if ($a) {
> $b = 2;
> }
>
> and so I'm using ggVG= in the command mode.
>
> but I only get this:
> f ($a
> )
> {
> $b = 2; }
>
> so the formatting has really taken place, but not as much as what
> I thought it should be able to do on the author's website
> http://www.2072productions.com/to/phpindent.txt
>
> Any help will be greatly appreciated. (I made a research of indent
> on the group site, but it was not to hepful -- I must have been
> misunderstanding something I think).

The Vim indenting feature, including the indent plugins and the =
command, adjusts the indentation of lines. It does not change the
spacing of characters within a line and it does not move characters
from one line to another. See

:help 30.2
:help 30.4

I'm not familiar with PHP, so I can't help you with this specific
plugin and there may be plugins that do the sort of restructuring or
reformatting that you were expecting, but generally speaking, Vim
doesn't do that. Reformatting code like that usually requires an
external formatting program.

I did not see anything on the web site you mentioned that suggested
that the plugin reformatted PHP code, although it appears to
reformat PHP comments.

HTH,
Gary

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

Post a Comment