diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-06-16 20:19:19 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-06-16 20:19:19 +1200 |
commit | 20d4d7c73e6e095f7328f986e235b7385e073f09 (patch) | |
tree | 17e444c31c807e6d5838017342e7d2977de92114 /vim | |
parent | Consolidate utc.vim and put_date.vim into latter (diff) | |
download | dotfiles-20d4d7c73e6e095f7328f986e235b7385e073f09.tar.gz dotfiles-20d4d7c73e6e095f7328f986e235b7385e073f09.zip |
Refactor and fix arg errors in put_date.vim plugin
Diffstat (limited to 'vim')
-rw-r--r-- | vim/autoload/put_date.vim | 8 | ||||
-rw-r--r-- | vim/plugin/put_date.vim | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/vim/autoload/put_date.vim b/vim/autoload/put_date.vim index 2b618632..c9f52c12 100644 --- a/vim/autoload/put_date.vim +++ b/vim/autoload/put_date.vim @@ -1,10 +1,10 @@ let s:rfc_2822 = '%a, %d %b %Y %T %z' -function! put_date#(line, bang, ...) abort +function! put_date#(line, utc, format) abort let line = a:line - let utc = a:bang ==# '!' - let format = a:0 - \ ? substitute(a:1, '\a', '%&', 'g') + let utc = a:utc + let format = strlen(a:format) + \ ? substitute(a:format, '\a', '%&', 'g') \ : s:rfc_2822 if utc if exists('$TZ') diff --git a/vim/plugin/put_date.vim b/vim/plugin/put_date.vim index e54d6054..7608f978 100644 --- a/vim/plugin/put_date.vim +++ b/vim/plugin/put_date.vim @@ -3,4 +3,4 @@ if exists('loaded_put_date') endif let loaded_put_date = 1 command! -bang -bar -nargs=* -range PutDate - \ call put_date#(<q-line1>, <q-bang>, <q-args>) + \ call put_date#(<q-line1>, <q-bang> ==# '!', <q-args>) |