dotfiles/nvim/.config/nvim/plugin/epoch-converter.vim
Sanchayan Maity 2e8f138f8b 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.
2022-03-14 13:36:45 +05:30

15 lines
381 B
VimL

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>