23
2
In vim you can execute comands with "!". You can combine that with "r" to insert the output into your current buffer.
:r!date
Fri Jul 20 09:39:26 SAST 2012
will insert the date into a file.
Now when I try to do some more interesting stuff like date with different format +%F. On the command line
$ date +%F
2012-07-20
In vim
:r!date "+%F"
message.to.followup.lstF
Which out puts the name of the file and puts F after it. some how the r!date "+%F" is being expanded in vim and not run on the command line. What do I need to do to run that so it puts the contents in vim.
Maybe vim has a better way to insert dates into files.
possible duplicate: http://stackoverflow.com/questions/6344750/how-do-i-insert-current-time-into-a-file-using-vim
– Ciro Santilli 新疆改造中心法轮功六四事件 – 2014-10-14T08:59:59.990Here is another valid response using <F3>. You will need to modify your
– nilon – 2019-09-05T15:20:11.890vimrc
to get any date format you like, automatized.