4

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**
SuperKrish
  • 217
  • 1
  • 5

1 Answers1

6

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

grodzik
  • 4,588
  • 19
  • 27