function! s:spacestotabs() %s/^ / /e %s/^ / /e %s/^ / /e %s/^ / /e %s/^ / /e %s/^ / /e endfunction command SpacesToTabs call s:spacestotabs()