VIM and tab to space migration

Alejandro López-Valencia me at privacy.net
Thu May 6 13:05:18 EDT 2004


On 2004-05-06, Brian Quinlan wrote in <mailman.313.1083853490.25742.python-list at python.org>:
>> If you are starting with a file that already contains tabs *and* spaces,
>> I'd say you have already called upon you the gods of disaster. 
> > [snipped]
>
> But I haven't. I did what you suggested, opened a file using ONLY tabs 
> for indentation and VIM stilled inserted spaces when it pressed the tab yet.
>

Because that's what it is supposed to do. If you want to edit a tab
indented file, you make sure that expandtab is set (it is in the example
I gave) and type the ex command ':h retab! 4', assuming your file was
created with a hardware tab setting (ts) of 4.  Now, your file uses only
spaces and indention settings will work. There are other alternatives to
what you want to do, type the ex command ":h 'tabstop'" in a Vim session
and you'll get the whole story.

As far as I know, only X/Emacs with python-mode.el has the kind of
mind-reading you want. And still you'll have to hand-hold it a bit. I
would suggest you explore JEdit and Jext. Both are Java-based editors
and at least Jext has an embedded Jython interpreter (there, desperately
trying to keep this post on topic ;-). Perhaps these editors already
know how to do what you want.i I don't know them well enough to say
anything about them.

>
>> Then you experience of the world is very limited :-) I am aware of only
>> some very expensive commercial editors/IDEs that can do such thing in a
>> general way. 
>
> Like PythonWin (free) or Eric3 (free)?

I did say "general way", didn't I? As in the way you can setup Visual
SlickEdit or CodeWright to do it for you. Hmm... I shouldn't have
deleted the words "dedicated IDEs" when writing that paragraph, as that
covers idle, PythonWin, Eric, and a few other editors (written in Python
+ some GUI API, and using tabnanny.py or tokenizer.py behind the scenes).

Cheers,

Alejo
-- 
Alejandro López-Valencia
qenqhy ng rgo qbg arg qbg pb
http://dradul.tripod.com/
The limits of my language are the limits of my world.
                                    (L. Wittgenstein)



More information about the Python-list mailing list