8 thoughts on “Vim Tip: Insert Time-Stamp

  1. Brian Kalbfus

    Doesn’t work as easily in windows – you need to say:

    :r! date /T
    This only gets the date, though. the time you’d have to say:
    :r! time /T

    Before seeing this tip, I did this to use the Vim internal functions:
    :s/$/=strftime(“%c”)^M:noh%M
    This puts the current date and time at the end of the current line. (remember that ^M is actually the enter key captured by preceding it with ctrl-q in windows or ctrl-v in other os)
    I put it in a macro so I can just hit @t to get the timestamp

    Reply
  2. Pingback: Best way to insert timestamp in Vim? - Programmers Goodies

Leave a Reply

Your email address will not be published. Required fields are marked *