VIM and tab to space migration
Alejandro López-Valencia
me at privacy.net
Wed May 5 16:12:56 EDT 2004
On 2004-05-05, Alejandro López-Valencia wrote in <c7bh99$239b8$1 at ID-99513.news.uni-berlin.de>:
> On 2004-05-05, Brian Quinlan wrote in <mailman.279.1083781602.25742.python-list at python.org>:
>> Christophe Cavalaria wrote:
>>
>>> Try adding that line at the end of each modified file :
>>>
>>> # vim:sw=4:softtabstop=4:expandtab
>>>
>>> It tells vim all the commands it should automatically run when it opens the
>>> file and it should get you the correct behaviour for 4 spaces no tab
>>> indentation.
>>
>> Thanks for the suggestion but modifying all my files is a pretty ugly
>> solution. Not that I'm above using it if there is no better way :-)
>
I use these settings myself, but just now after posting, I realized that
it is far better to set the preferences on a per-buffer basis, so I
change my advice to the following:
$ mkdir -p .vim/ftplugin
$ cd .vim/ftplugin
$ vim python_pep8.vim
....
$ cat python_pep8.vim
if exists("b:did_python_pep8")
finish
else
let b:did_python_pep8=1
endif
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set textwidth=80
This way, you can open a python file and a file with a different syntax
on two buffers of the same vim session.
And this is *really* all there is to it.
Cheers
--
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