Switch TAB indentation to spaces in Vim

Asked

Viewed 246 times

4

I have a project where some files are indented with tab and others with 4 spaces. Is there any way in Vim to reindentate all files for 4 spaces?

2 answers

3


One way is to use the :set expandtab to define the number of spaces it is possible to use :set tabstop=4 then use the command :retab to convert the file.

  • 1

    Complementing, you can use :argdo retab | update to do for all open files.

1

To change on all lines:

:%s/\t/    /g

Or, if you want to change only on the current line:

:s/\t/    /g

Browser other questions tagged

You are not signed in. Login or sign up in order to post.