Change the indentation of TAB to spaces in Vim

4

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

    
asked by anonymous 29.01.2014 / 19:14

2 answers

2

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

    
29.01.2014 / 19:14
1

To change on all lines:

:%s/\t/    /g

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

:s/\t/    /g
    
29.01.2014 / 19:19