Friday, August 26, 2011

Python indentation script...

Hello All!

I've been looking around to see if it is possible to create a script or add a feature that I would use quite a bit.

When editing python code, how much a line is indented sets the scope of the code, as many of you know, however, sometimes with long scopes that are heavily nested, it can be confusing to easily see how many indents you need.

What I would LOVE is to set vim similar to where it shows numbers, but instead, have the number show the number of indents relative to the current setting of ts.

What would happen is this

1) The number is computed by the number of spaces at the lead (^\s*) / tab space setting (ts)

2) If the number had any remainder (so not zero remainder) this means something isn't spaced right, set the text color to orange.

3) If ANY tabs (\t) are in the line, set the color to red to indicate the line needs to be fixed.

I realize computing every line is expensive, but I'd be willing to take that hit on turning this one for some of the difficult functions I write. It would also be nice if it ran on what was displayed only maybe.

Is this possible? Or will I need to actually edit the gvim sourcecode for this sort of functionality?

Thanks!
Rick

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