I want to paste particular date format (mm--dd-yyyy) using following terminal command in ex command mode:

:r !echo $(date +"%d-%m-%Y")

Its print the current file name instead of printing date,

After that I try another command:

:r date+"%d-%m-%Y"

Its also failed , It returns following error:

**/bin/bash: /tmp/vptQGvY/8: No such file or directory
shell returned 1
E485: Can't read file /tmp/vptQGvY/8
Press ENTER or type command to continue**

1 Answer 1


This should work:

:r !date +"\%d-\%m-\%Y"

But preferred way to do this would be to use strftime(). Here's a link for more info

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.