Python + vim + spaces vs tab

Neil Cerutti neilc at norwich.edu
Mon Jun 7 13:16:43 EDT 2010


On 2010-06-07, Jean-Michel Pichavant <jeanmichel at sequans.com> wrote:
> Hello,
>
> Does anyone knows a way to configure vim so it automatically
> select to correct expandtab value depending on the current
> buffer 'way of doing' ? I need to edit different files, some
> are using spaces, others tabs. Those belong to different
> projects, and changing all spaces to tabs is not an option for
> me.
>
> I can't make vim automatically comply with the current buffer
> coding style, anyone knows if it is possible ?

:h filetypes will get you started on the right path. It'll be up
to you to program the recognition logic. Do you have a heuristic
in mind?

You will be better off converting tabbed files to be tabless,
which is pretty easy in vim.

:set expandtab
:set tabstop=N
:retab

N should be whatever value makes the file look right, usually 4
or 8.

-- 
Neil Cerutti



More information about the Python-list mailing list