Think before you speak, read before you think.

vim插入当前日期

by

in

在normal模式下,直接执行

!!date

如果要显示YYYY-MM-DD,需要跟%F,%需要用\转义

!!date +\%F

也可以使用:r!读取date命令

:r! date "+\%Y-\%m-\%d \%H:\%M:\%S"

区别是!!date会将当前行替换成当前日期,:r!date会新建一行并插入当前日期。


Comments

Leave a Reply

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