Vim replacing tabs with double spaces

indentation, vim

Solution

You should have a look at `retab`. First set `tabstop`, `shiftwidth` and `expandtab`, then use the `retab` command: it will reformat all your file with the desired format.

Problem

So I've written some code of an assignment and i forgot the universities policy of indent with 2spaces. Normally I'ld have put a: `//vim: ts=2:tw=78: et:` at the top of my files, but this time I forgot. How should I go about replacing all tabs with 2 space? would s/[TAB]/[SPACE][SPACE] work? (replacing [TAB] and [SPACE] with the respective key presses for the characters)

Original source