Someone at my workplace committed non-indented JavaScript I have the VIM plugin autoformat installed and want to run :Autoformat on all .js files in my project directory, how would one do this?

1 Answer 1


If your project directory is just a regular directory you could use argdo.

Navigate to the directory in your shell and open vim with vim ./.*. This will open all the files in the directory in vim's argument list. Then you can simply do

:argdo Autoformat <BAR> update

See :help :argdo for more info.

  • 1
    You can also populate the arglist via :args. e.g. :args **/*.js. You can also use backticks to execute a command to make this process quicker/better. :args `ag --js -g ''` , :args `find . -type f -name '*.js'` , or :args `git diff --name-only HEAD^..HEAD` Commented Jul 10, 2017 at 21:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.