Skip to content

Instantly share code, notes, and snippets.

@mageekguy
Created April 16, 2013 10:07
Show Gist options
  • Save mageekguy/5394811 to your computer and use it in GitHub Desktop.
Save mageekguy/5394811 to your computer and use it in GitHub Desktop.
Command to replace spaces by tabs in a file.
command! -buffer -range=% -nargs=? SpaceToTab execute '<line1>,<line2>s#^\( \{'.(<q-args> ? <q-args> : &ts).'\}\)\+#\=repeat("\t", len(submatch(0))/' . &ts . ')#e'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment