PSU uses emacs?

Alex Martelli aleaxit at yahoo.com
Wed Jan 24 10:46:16 EST 2001


"Ray Drew" <ray_drew at yahoo.co.uk> wrote in message
news:3a6eb2fa.2347467 at reading.news.pipex.net...
    [snip]
> I'm having problems getting the indentation right with gvim. I've got
> the following in my .vmrc file:
>
> au FileType py set ts=4
> au FileType py set sw=4
> au FileType py set expandtab on

I think you need to omit the 'on' here.

> au FileType py set ff=unix
>
> as far as I can make out from the docs, this should set those options
> for all .py files. Tabs appear as 4 chars in gvim but when viewed in
> an IDLE edtor window, tabs appear as 8 and throw a syntax error when

There should never be any tabs in files generated with vim if
'set expandtab' was executed.  Try a :set from within vim to
see all that's set; is expandtab among the variables shown?

> imported (files originally created in IDLE with tab space of 4). Do I
> need to do anything else to get this to work?

If you ever edit existing files that may have tabs in them, and
want to ensure they're turned into spaces, you may add to your
startfile something like:

au BufRead *.py %retab

but take care -- this will NOT make vim think the file has
been _modified_ yet, so a ZZ will not write the changes (you'll
need a :w to write anyway, although of course ZZ will also
write if you DO some editing which causes other changes).


Starting your startfile with a
    set verbose=9
will ensure you get a trace that will help you debug your
startfile settings.

I suspect that on comp.editors you may find people *much*
more skilled than me at VIM-tweaks:-).


Alex






More information about the Python-list mailing list