3

I open a text file using vi editor in linux and want to insert date command output without exiting vi editor. What is the trick?

Thanks

Alex
  • 6,477
  • 1
  • 23
  • 32
vnix27
  • 856
  • 2
  • 11
  • 19

1 Answers1

10

Is this what you mean?

:r !date

or to add one week to the current date:

:r !date -d “today 1 week”

Also see this post: https://stackoverflow.com/questions/56052/best-way-to-insert-timestamp-in-vim

pablo
  • 3,020
  • 1
  • 18
  • 23