diff options
Diffstat (limited to 'vim/autoload/put_date.vim')
-rw-r--r-- | vim/autoload/put_date.vim | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/vim/autoload/put_date.vim b/vim/autoload/put_date.vim new file mode 100644 index 00000000..c9f52c12 --- /dev/null +++ b/vim/autoload/put_date.vim @@ -0,0 +1,19 @@ +let s:rfc_2822 = '%a, %d %b %Y %T %z' + +function! put_date#(line, utc, format) abort + let line = a:line + let utc = a:utc + let format = strlen(a:format) + \ ? substitute(a:format, '\a', '%&', 'g') + \ : s:rfc_2822 + if utc + if exists('$TZ') + let tz = $TZ + endif + let $TZ = 'UTC' + endif + execute line.'put =strftime(format)' + if exists('tz') + let $TZ = tz + endif +endfunction |