¿Expandir pestañas a espacios en vim solo en archivos python?


¿Cómo puedo hacer que la tecla tab inserte 4 espacios cuando estoy editando archivos "*.py" y no cualquier otro archivo?

Siguiendo una recomendación de Vim y PEP 8 Guide Guía de estilo para Código Python, instalé vim-flake8 (y vim-pathogen). Esto da advertencias cuando se violan las pautas de estilo PEP8. Esto es genial, pero me gustaría que las pestañas se expandieran automáticamente en primer lugar al editar archivos python. Me gustaría tener la tecla tab realmente insertar pestañas al editar otros tipos de file.

En otras palabras, quiero que se aplique lo siguiente cuando estoy editando archivos python y solo archivos python:

set expandtab       " tabs are converted to spaces
set tabstop=4       " numbers of spaces of tab character
set shiftwidth=4    " numbers of spaces to (auto)indent
Author: Community, 2012-04-03

1 answers

autocmd Filetype python setlocal expandtab tabstop=4 shiftwidth=4

O incluso más corto:

au Filetype python setl et ts=4 sw=4
 54
Author: Vlad the Impala,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-04-03 02:54:14