Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If it were linux, I'd do it like this:

echo "w DST_FILE | q" | vim -Esu NONE -r SWP_FILE

I'm trying to do the same under windows with git's bash, but with no result. It hangs and doesn't create recovered file. This way it almost works:

vim -u NONE -r SWP_FILE

But I need to manually save the resulting file. The same happens when I run it from cmd with the same command:

echo "w DST_FILE | q" | vim -Esu NONE -r SWP_FILE
share|improve this question
up vote 2 down vote accepted

Why don't you pass the Vim commands with -c?!

$ vim -u NONE -r SWP_FILE -c 'w DST_FILE' -c q
share|improve this answer
Good question, as far as I remember, I pass commands to stdin because of the example in documentation. – x-yuri Jun 14 '13 at 14:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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