nvim: plugin: Add a plugin to help with epoch timestamp conversions

We look at logs frequently these days with epoch timestamps and this
helps with getting the human readable timestamp and vice versa.
This commit is contained in:
Sanchayan Maity 2022-03-14 11:04:23 +05:30
parent 131e5bb364
commit 2e8f138f8b

View file

@ -0,0 +1,14 @@
function GetHumanReadableDate()
let epoch = expand("<cword>")
let date = trim(system("date -d @" . epoch))
echo date
endfunction
function GetEpochDate()
normal! `<v`>y
let date = trim(system("date -d " . trim(shellescape(@@)) . ' "+%s"'))
echo date
endfunction
nnoremap <LocalLeader>e :call GetHumanReadableDate()<CR>
xnoremap <LocalLeader>e :call GetEpochDate()<CR>