I'm just logging some work as I do it, each line being an action, I will be trying to do this every few minutes. Is there a trick way of inserting date/time something like:
14 June 2011 15:01:00 Downloaded source code from GIT
Would do fine... although thinking about it, inserting the date as I add a new line might be nice too..
Any other shortcuts that anyone else uses when trying to achieve similar would also be welcome.
(Win32, vim6.4)
EDIT
Here is what I ended up with: I type: appending 'vlog' then a space, like so
that was 30 minutes well spent vlog
and my log entry goes:
that was 30 minutes well spent
Jun-14 16:50
With me ready to type the next line, thats with With the .vimrc (_vimrc) entry:
"use this for file logging
:iab vlog <cr><c-r>=strftime("%b-%d %H:%M") <cr>
Cor! now lets get that 30 minutes back... cheers for the replies!
In vim you can execute comands with "!". You can combine that with "r" to insert the output into your current buffer. will insert the date into a file.
Now, anytime you want to insert a Markdown-style header with the current date and time, just press <leader>D (the default leader key in Vim is \ ). A new line with the current date and time, formatted per the strftime format, will be inserted below — great for note-taking or journaling.
I prefer to set an abbreviation for this like:
iab xdate <c-r>=strftime("%d/%m/%y %H:%M:%S")<cr>
So when I type "Downloaded source code on xdate"
, vim automatically expands the "xdate"
to "14/06/11 hrs:mins:secs"
. Being in insert mode and not having to disrupt my flow of typing to either get into normal mode or press a shortcut is useful at times. Also, you can set it to a shorter combination than "xdate"
if you so wish.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With