-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patha-shortcut-to-insert-timestamp-in-vim-editor.html
216 lines (183 loc) · 8.59 KB
/
a-shortcut-to-insert-timestamp-in-vim-editor.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="author" content="Poon" />
<meta name="robots" content="index, follow"/>
<meta property="og:title" content="如何在vim中使用快捷键插入时间戳"/>
<meta property="og:url" content="/a-shortcut-to-insert-timestamp-in-vim-editor.html"/>
<meta property="og:site_name" content="i.M.X.3"/>
<meta property="og:type" content="article"/>
<link rel="canonical" href="/a-shortcut-to-insert-timestamp-in-vim-editor.html" />
<title>如何在vim中使用快捷键插入时间戳 | i.M.X.3</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" />
<link rel="stylesheet" type="text/css" href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" />
<link rel="stylesheet" type="text/css" href="/theme/css/main.css" />
<script type="text/javascript">var switchTo5x=true;</script>
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">
stLight.options({
publisher: "7470bcd0-1833-4a2b-a25f-c4a233bdfced",
doNotHash: false,
doNotCopy: false,
hashAddressBar: false
});
</script>
</head>
<body id="index">
<script>
(function(){
var bp = document.createElement('script');
bp.src = '//push.zhanzhang.baidu.com/push.js';
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
})();
</script>
<div class="row-fluid">
<div class="span10 offset1">
<header id="banner" >
<h1>
<a href="/"> i.M.X.3 </a>
<!-- /#
<strong>
<span style="font-size:12px;vertical-align:bottom">Be a Coder,Lifehacker,Storyteller </span>
</strong>
-->
</h1>
<nav class="navbar">
<div class="navbar-inner">
<ul class="nav">
<li ><a href="tags.html">Tags</a></li>
<li ><a href="about.html">About</a></li>
</ul>
<script>
(function() {
var cx = '005973619447881484970:jf4jwrpc3tg';
var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true;
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
'//www.google.com/cse/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s);
})();
</script>
<div id="google-custom-search" class="nav">
<gcse:search></gcse:search>
</div>
</div>
</nav>
</header><!-- /#banner -->
</div>
</div>
<div class="row-fluid">
<div class="span10 offset1">
<div class="row-fluid">
<div class="span10 offset1">
<section>
<article>
<header>
<h1 class="entry-title">
<a href="/a-shortcut-to-insert-timestamp-in-vim-editor.html" rel="bookmark"
title="Permalink to 如何在vim中使用快捷键插入时间戳">如何在vim中使用快捷键插入时间戳</a></h1>
</header>
<div class="entry-content">
<footer class="post-info">
<address class="vcard author">
by <a class="url fn" href="/author/poon.html">Poon</a>
</address>
in <a href="/category/tech.html">Tech</a>
on 2015-11-08
|
tags: <a href="/tag/vim.html">vim</a>
<a href="/tag/hotkeys.html">hotkeys</a>
<a href="/tag/edit.html">edit</a>
|
<a href="/a-shortcut-to-insert-timestamp-in-vim-editor.html#disqus_thread">comments</a>
</footer><!-- /.post-info -->
<div class="sharethis-top">
<span class='st_fblike_hcount' displayText='Facebook Like'></span>
<span class='st_plusone_hcount' displayText='Google +1'></span>
<span class='st_twitter_hcount' displayText='Tweet'></span>
<span class='st_email_hcount' displayText='Email'></span>
</div>
<p>11 对于这种雕虫小技,stackoverflow早已经说烂了,于是...</p>
<p>使用pelican+markdown写博客,总是要手动输入日期时间,很是麻烦,作为一个geek,怎能忍受每次都手工修改日期这种事情发生呢?所以,必须找到一种能够一键插入时间戳的方法!
对于这种雕虫小技,stackoverflow早已经说烂了,于是,随便找了<a href="http://stackoverflow.com/questions/56052/best-way-to-insert-timestamp-in-vim">一篇</a></p>
<p>~/.vimrc命令:</p>
<div class="highlight"><pre>nmap <F3> a<C-R>=strftime("%Y-%m-%d %a %I:%M %p")<CR><Esc>
imap <F3> <C-R>=strftime("%Y-%m-%d %a %I:%M %p")<CR>
</pre></div>
<p>按f3的输出效果:</p>
<div class="highlight"><pre> 2015-11-08 Sun 11:06 AM
</pre></div>
<p>.vimrc 命令:</p>
<div class="highlight"><pre>nmap <F4> a<C-R>=strftime("%Y-%m-%d %H:%M")<CR><Esc>
imap <F4> <C-R>=strftime("%Y-%m-%d %I:%M")<CR>
</pre></div>
<p>按f4的输出效果:</p>
<div class="highlight"><pre> 2015-11-08 11:06
</pre></div>
<p>注意:f3的时间戳格式是不适合放在pelican的Date: 和 Modified 里的。f4才是。</p>
<p>现在,展示f3的用法:</p>
<div class="highlight"><pre>本文最后更新于 2015-11-08 Sun 11:23 AM
</pre></div>
<p>That's it !</p>
<p>Enjoy!</p>
<div class="sharethis-bottom">
<span class='st_fblike_hcount' displayText='Facebook Like'></span>
<span class='st_plusone_hcount' displayText='Google +1'></span>
<span class='st_twitter_hcount' displayText='Tweet'></span>
<span class='st_email_hcount' displayText='Email'></span>
</div>
</div><!-- /.entry-content -->
<div class="comments">
<h2>Comments</h2>
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_identifier = "a-shortcut-to-insert-timestamp-in-vim-editor.html";
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//gitwillpoonimx3.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
</div>
</article>
</section>
</div>
</div>
</div>
</div>
<footer id="site-footer">
<div class="row-fluid">
<div class="span10 offset1">
<address>
<p>
This blog is proudly powered by <a href="http://getpelican.com/">Pelican</a>, which takes great advantage of <a href="http://python.org">Python</a>.
</p>
<p>
<a href="http://github.com/jsliang/pelican-fresh/">Fresh</a> is a responsive theme designed by <a href="http://jsliang.com/">jsliang</a> and <a href="https://github.com/jsliang/pelican-fresh/graphs/contributors">contributors</a>.
Special thanks to <a href="http://coding.smashingmagazine.com/2009/08/04/designing-a-html-5-layout-from-scratch/">Smashing Magazine</a> and <a href="http://getbootstrap.com/">Twitter Bootstrap</a>.
</p>
</address>
</div>
</div>
</footer>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-69868761-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<script type="text/javascript">
var disqus_shortname = 'gitwillpoonimx3';
(function () {
var s = document.createElement('script'); s.async = true;
s.type = 'text/javascript';
s.src = '//' + disqus_shortname + '.disqus.com/count.js';
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
}());
</script>
<script src="//code.jquery.com/jquery.min.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/2.3.2/js/bootstrap.min.js"></script>
</body>
</html>