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

link|improve this question

61% accept rate
feedback

1 Answer

up vote 10 down vote accepted

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: http://stackoverflow.com/questions/56052/best-way-to-insert-timestamp-in-vim

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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