I'd like to replace all two-space indents with tabs
I can't do :%s/ /^I/g
bc this replaces within lines too.
I can't do :%s/^ /^I/g
bc this replaces only the first two spaces of each line, not each level of indentation.
If there were a way to count how many matches were found, something like this could work :%s/^\( \)*/\count^I/g
, but I don't know whether any of that exists and I've tried looking it up but couldn't find it.
Is there a way I can replace X spaces at the start of a line with X/2 tabs?