Vim replace tabs with spaces

To replace all tabs with 4 spaces in vim using the following command:

:%s/\t/    /g

Explained:

: - command
%s - entire selection
/ - separator
\t - search for tab
/ - separator
"    " - replace with 4 spaces
/ - separator
g - global replace
Did this help you? Please let me know with a comment. Thank you
Posted .

Comments (RSS)

Leave a comment