mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
Add command :Datetime to show current time or translate a Unix timestamp
This commit is contained in:
parent
80ceacbb02
commit
39e5e1913f
@ -145,8 +145,12 @@ function! utils#Get_titlestr() abort
|
||||
return l:title_str
|
||||
endfunction
|
||||
|
||||
" Output current time in ISO format.
|
||||
function! utils#iso_time() abort
|
||||
" Output current time or unix timestamp in human-readable format.
|
||||
function! utils#iso_time(timestamp) abort
|
||||
if a:timestamp
|
||||
return strftime('%Y-%m-%d %H:%M:%S%z', a:timestamp)
|
||||
endif
|
||||
|
||||
return strftime('%Y-%m-%d %H:%M:%S%z')
|
||||
endfunction
|
||||
|
||||
|
||||
@ -5,3 +5,6 @@ command! -bar -bang -nargs=+ -complete=file Edit call utils#MultiEdit([<f-args>]
|
||||
call utils#Cabbrev('edit', 'Edit')
|
||||
|
||||
call utils#Cabbrev('man', 'Man')
|
||||
|
||||
" show current date and time in human readable format
|
||||
command! -nargs=? Datetime echo utils#iso_time(<q-args>)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user