VIM and tab to space migration

David M. Cooke cookedm+news at physics.mcmaster.ca
Thu May 6 19:39:13 EDT 2004


At some point, Steve Lamb <grey at despair.dmiyu.org> wrote:

> On 2004-05-06, Graham Dumpleton <grahamd at dscpl.com.au> wrote:
>> I then type ^Ke and it will pipe the whole contents of the file being edited
>> through "expand" which will turn all tabs into appropriate number of
>> spaces. Typing ^Ku does the opposite.
>
>> You could run the "expand" program outside of vi as well as part of a shell
>> script and do all your files at the same time.
>
>     Couldn't they just also just add a global %s/\t/    /g to the loading of
> .py files and be done with it?  :)

Not if you've mixed tabs and spaces. A tab isn't 8 spaces (or 4
spaces); it should move to the next tabstop, so for instance the '*'
line up in the following:
>>> print '  \t*'
        *
>>> print '\t*'
        *

-- 
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke
|cookedm(at)physics(dot)mcmaster(dot)ca



More information about the Python-list mailing list