Skip to content

Instantly share code, notes, and snippets.

@5tefan
Forked from yefim/format.vim
Last active October 26, 2016 01:18
Show Gist options
  • Save 5tefan/0fe39ce2fccda362233ad1def2a7f9cb to your computer and use it in GitHub Desktop.
Save 5tefan/0fe39ce2fccda362233ad1def2a7f9cb to your computer and use it in GitHub Desktop.
Reindent and retab any and all files from the command line

Reindent

For a single file

vim /path/to/file.js -c 'retab | wq'

For multiple files

find . -name '*.js' -exec vim {} -c 'retab | wq' \;

A useful argument to find is -maxdepth 1 to limit it to the current directory, for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment