Ian Bicking: the old part of his blog

Re: Other editors comment 000

For the record, regarding indenting, Emacs understands expressions and block terminators in addition to colon. So this is Emacs indenting:

def munge(x, y, z,
          kwarg=None):
    return {
        'x': x,
        'y': y,
        'rest': (z, kwarg),
        }

Emacs will indent the lines to exactly the position I show up there, and after the last line it won't indent at all (since the def is closed by the return). Sometimes -- not often -- it gets it wrong. Other times -- not often -- I don't like how it wants to indent my source. In those cases it can be a little annoying, but mostly because I depend on it so much that it's hard to resist using it. Emacs python-mode also has block indent and block dedent; in comparison to the automatic indenting this isn't a very sophisticated feature, but definitely something you want to have for Python.

(Is that line number modulo 41 the reason you have [what seems to me] strange chunks of verticle whitespace in your source?)

Comment on Other editors comment 000
by Ian Bicking

Comments:

I could be wrong, but I believe the only other editor to come close to Emac's python mode indenting is Vim. Here's what vim looks like for your sample without any fixups:

def munge(x, y, z,
        kwarg=None):
    return {
'x': x,
'y': y,
'rest': (z, keyarg),
}

and with fixups along the way (commented)

def munge(x, y, z,
          kwarg=None):      #space kwarg over 2
    return {
        'x': x,
        'y': y,
        'rest': (z, kwarg),
        }                   # left 2, tab 1

I suspect this could be fixed, but its low on my priority list. Favorite vim feature: tags support - between this and other doc / code lookup features I spend a lot less time clicking about other modules and packages, particularly those I rarely use.

Have used jedit extensively; eric3 as well - found the ubiquity of vim and the extensibility of gvim just too hard to live without. That said, I'm sure a blew a month getting vim configured how I like it and getting used to a modal editor. If its not a long term commitment its not worth going down the vim road I fear.

# Mike Watkins

I'm not sure what python.vim indent plugin you're using, but the updated one from vim.org should produce the following:

def munge(x, y, z,
          kwarg=None):
    return {
        'x':x,
        'y':y,
        'rest': (z, keyarg),
    }

and drops the cursor to the 1st column after the last }. This almost exactly the same as Emacs.

# Keir Mierle