I had to convert a file from ESP-IDF that was using TAB for spacing, and tried to use vim “retab” and “:%s/\t/ /g” with not luck to keep the visual position of the text.
Fortunately the solution is very simple:
$ expand -t 8 core-isa.h > output_filename
Source: https://vi.stackexchange.com/questions/495/how-to-replace-tabs-with-spaces