What script might i use in (vanilla) Vim to insert a snippet with the current date and time into each and every new note generated.
You can use for example:
:pu=strftime('%c')
To put a timestamp into a file in the default timestamp format. The format is adjustable.
You could bind this action to a key (here F5 as an example). Put it to your .vimrc file without the colon in the beginning to make it permanent.
:nnoremap <F5> "=strftime("%c")<CR>P
More examples: https://vim.fandom.com/wiki/Insert_current_date_or_time
In my case I have an insert abbreviation, so, wenever I am typing I just do 'idate'
inoreabbrev idate <C-R>=strftime("%b %d %Y %H:%M")<CR>
Just change the "strftime" to fit your needs
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