Wednesday, April 28, 2010

Re: How to fix broken automatic indentation in vim

On 2010-04-28, Didlybom wrote:
> Gary,
>
> I do not have the same ~/.vimrc on both computers. In the first computer I
> have a heavily modified .vimrc file. However, on the second computer I did a
> fresh Vim 7.2 install. I actually went to www.vim.org and downloaded the vim
> installer from there. Thus the .vimrc file on the second computer should be
> the default.
>
> However, I did try what you suggested. I executed "vim -N -u NONE", set the
> "filetype plugin indent on" setting and loaded the example file. When I
> issued the "gg=G" command the indentation worked fine.
>
> However, I then tried to indent a VHDL file. This is a simple VHDL which I
> put online. Hopefuly you can access it through:
> http://old.nabble.com/file/p28386622/example.vhd example.vhd .
>
> Again, I opened vim using "vim -N -u NONE", set "filetype indent plugin on"
> and opened the file. I used the "gg=G" command and let vim indent the file.
> Unfortunately I found that vim did not do a good job and that the
> indentation was not good at all :-(
>
> I saved and uploaded the file after indenting into
> http://old.nabble.com/file/p28386622/example_indented.vhd
> example_indented.vhd . If you can open it you will see that the "type
> secondStruct" is not indented properly. Also, the comments (beginning with
> "--") are not indented right and the final "END;" is not indented properly
> either.
>
> Could you give it a try and see if you have the same problem that I do?

I don't know VHDL, but I see those problems you pointed out and it
doesn't seem right to me, either.

> I think that perhaps I originally had 2 problems. One was probably caused by
> something on my .vimrc setup, but there seems to be something else.
>
> Could there be some problem related to the format of the file? Some of these
> files have been edited in Windows and in Linux. Could there be some mix of
> line endings that could confuse vim somehow? When I open the file I do not
> see any "^M" symbol on the line endings so I assumed that their format was
> correct.

As long as you don't see any ^Ms, the file uses only Unix or only
DOS line endings and you should be OK.

I don't know what the problem is, but it seems to be in the indent
plugin and not with your configuration. I looked briefly at the
plugin, $VIMRUNTIME/indent/vhdl.vim, and didn't see anything obvious
in the way of settings that would affect these issues. You might
have a look and see what you think. The author's name and address
are in that file so you might try contacting him directly. That
file says that it supports the "'93 syntax" if that means anything
to you. The plugin I have also says that it is version 1.54, last
changed on 2007 Aug 17.

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