在 Vim 中插入时间戳的最佳方法? [英] Best way to insert timestamp in Vim?
问题描述
EditPad Lite 有一个很好的功能 (CTRL-E, CTRL-I)邮票例如2008-09-11 10:34:53"到您的代码中.
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.
在 Vim 中获得此功能的最佳方法是什么?
What is the best way to get this functionality in Vim?
(我通过 SSH 在 Linux 服务器上使用 Vim 6.1.在目前的情况下,我们中的许多人共享一个登录名,所以如果有另一种内置的方式来获取,我不想在主目录中创建缩写一个时间戳.)
(I am using Vim 6.1 on a Linux server via SSH. In the current situation a number of us share a login so I don't want to create abbreviations in the home directory if there is another built-in way to get a timestamp.)
推荐答案
http://kenno.wordpress.com/2006/08/03/vim-tip-insert-time-stamp/
试过了,它适用于我的 Mac:
Tried it out, it works on my mac:
:r! date
产生:
Thu Sep 11 10:47:30 CEST 2008
这个:
:r! date "+\%Y-\%m-\%d \%H:\%M:\%S"
产生:
2008-09-11 10:50:56
这篇关于在 Vim 中插入时间戳的最佳方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!