On 01/30/2012 05:38 PM, Gary Johnson wrote:
On 2012-01-30, AK wrote:
Hi, when editing code, my vim setup indents next line to align with a
brace from line above, e.g.:

myvariable_name = (
                    |)

But if I manually backspace the line to be closer to start of line:

myvariable_name = (
     x = "something",
                    |)

On carriage return the alignment is still at the brace level. So I need
to fix it manually again. How can I avoid having to do that? I still
would like to keep auto-alignment when I don't fix the line manually.

I took a _quick_ look at this but was unable to replicate the
problem.  If I set 'cindent' and type your second example, I get
this:

myvariable_name = (
     x = "something",
     )

where Vim aligned that closing parenthesis as shown.

This behavior will depend on the various indent settings.  What
language are you using?  Are you using an indent plugin?  What are
these values:

     :verbose set cindent? cinoptions? indentexpr?


I'm using indent/python.vim and this behaviour is in GetPythonIndent().
I'll just have to hack it.. If I set cindent or cinoptions, is there
a way to set it up to override indentexpr and work as I described?


By the way, () are parentheses, not braces.  Braces are {} and
brackets are [].


{} and [] () are also called curly, square, and round brackets, so I
thought brackets and braces are interchangeable.. guess not!

Thanks,  -ak

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