I do use standard 4 space indent. Perhaps copy and paste failed on google group.

That said, I found that I also have no problem with indent in Arch, which has 
the same python.vim under ${VIMRUNTIME}/indent/

I have no additional vim setting. My .vimrc is fairly minimal, but I do have 
this line for python:

au FileType python setlocal ts=4 sw=4 sts=4 sta et fdm=indent

Don't know what's the difference between Arch and Ubuntu

--
MZ

On Tuesday, April 3, 2012 1:01:05 PM UTC-7, Zvezdan Petkovic wrote:
> On Apr 3, 2012, at 2:10 PM, Zetah Ghamin wrote:
> 
> > I am having problem indenting python doctring in vim. Since I use
> > pycontract, a typical docstring looks like the following in which I
> > would like the left side to be aligned:
> > def magic(x, y):
> >    '''this function does magic with x and y
> > 
> >       :param x: the x factor (I hate that show)
> >       :type x: numeric
> >       :param y: a matrix
> >       :type y: array[MxN](float32,>=0)
> >       '''
> > 
> > But when I indent this section using either Ubuntu's default
> > python.vim or the one from here:
> > http://www.vim.org/scripts/script.php?script_id=974
> > the left side does not line up whenever there is a line with
> > parenthesis. Sometimes it affects the line before it too:
> > 
> > def magic(x, y):
> >    '''this function does magic with x and y
> > 
> >       :param x: the x factor (I hate that show)
> >    :type x: numeric
> >    :param y: a matrix
> >     :type y: array[MxN](float32,>=0)
> >       '''
> > 
> > Now, if I remove the parenthesis from the two lines that contain it,
> > then re-indent the block. Everything line up on the left as intended.
> > 
> > Any help is appreciated.
> 
> 
> I cannot reproduce this with the default Vim indenter on Mac or OpenBSD in 
> Vim 7.3 or 7.2.  When I take your function and put it in a file, then press 
> 1GVG= it indents like this:
> 
> def magic(x, y):
>     '''this function does magic with x and y
> 
>       :param x: the x factor (I hate that show)
>       :type x: numeric
>       :param y: a matrix
>       :type y: array[MxN](float32,>=0)
>       '''
> 
> The indentation of the first docstring line is different because you used a 
> three space indent, and the default indent uses a standard four space indent. 
>  Otherwise, the remaining lines were not touched and are left aligned.
> 
> I also tried aligning the lines with the opening quotes for a standard 
> docstring style:
> http://www.python.org/dev/peps/pep-0257/#multi-line-docstrings
> After re-indenting with 1GVG= it leaves the docstring aligned:
> 
> def magic(x, y):
>     '''this function does magic with x and y
> 
>     :param x: the x factor (I hate that show)
>     :type x: numeric
>     :param y: a matrix
>     :type y: array[MxN](float32,>=0)
> 
>     '''
> 
> Did you try this function in a separate file with the default Vim indenter?  
> Does it behave correctly?  If not, what other custom settings are you (or 
> Ubuntu) using that could cause this?
> 
> If it indents correctly when it's alone, there may be some other indenting 
> interaction with the text below or above it perhaps?
> Perhaps some other parenthesis above it is not closed?
> 
> I'm sorry that I can't help you more, but without being able to reproduce the 
> problem I can only guess.
> 
> Regards,
> 
>       Zvezdan

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

Reply via email to