Если вы используете Vim , см. :h retab
.
*:ret* *:retab*
:[range]ret[ab][!] [new_tabstop]
Replace all sequences of white-space containing a
<Tab> with new strings of white-space using the new
tabstop value given. If you do not specify a new
tabstop size or it is zero, Vim uses the current value
of 'tabstop'.
The current value of 'tabstop' is always used to
compute the width of existing tabs.
With !, Vim also replaces strings of only normal
spaces with tabs where appropriate.
With 'expandtab' on, Vim replaces all tabs with the
appropriate number of spaces.
This command sets 'tabstop' to the new value given,
and if performed on the whole file, which is default,
should not make any visible change.
Careful: This command modifies any <Tab> characters
inside of strings in a C program. Use "\t" to avoid
this (that's a good habit anyway).
":retab!" may also change a sequence of spaces by
<Tab> characters, which can mess up a printf().
{not in Vi}
Not available when |+ex_extra| feature was disabled at
compile time.
Например, если вы просто наберете
:ret
все ваши вкладки будут развернуты в пробелы.
Возможно, вы захотите
:se et " shorthand for :set expandtab
чтобы убедиться, что любые новые строки не будут использовать буквенные вкладки.
Если вы не используете Vim,
perl -i.bak -pe "s/\t/' 'x(8-pos()%8)/eg" file.py
заменяет табуляцию пробелами, при условии, что табуляция останавливается каждые 8 символов в file.py
(на всякий случай оригинал будет file.py.bak
) Замените восьмерки на 4, если вместо табуляции используются каждые 4 пробела.