Best way to insert timestamp in Vim?

前端 未结 10 1854
轮回少年
轮回少年 2020-11-30 18:25

EditPad Lite has a nice feature (CTRL-E, CTRL-I) which inserts a time stamp e.g. \"2008-09-11 10:34:53\" into your code.

10条回答
  •  无人及你
    2020-11-30 18:56

    From the Vim Wikia.

    I use this instead of having to move my hand to hit an F key:

    :iab  tds strftime("%F %b %T")
    

    Now in Insert mode it just type tds and as soon as I hit the space bar or return, I get the date and keep typing.

    I put the %b in there, because I like seeing the month name. The %F gives me something to sort by date. I might change that to %Y%m%d so there are no characters between the units.

提交回复
热议问题