dotfiles/nvim/.config/nvim/plugin/epoch-converter.vim

15 lines
388 B
VimL

function GetHumanReadableDate()
normal! `<v`>y
let date = trim(system("date -u -d @" . trim(shellescape(@@))))
echo date
endfunction
function GetEpochDate()
normal! `<v`>y
let date = trim(system("date -u -d " . trim(shellescape(@@)) . ' "+%s"'))
echo date
endfunction
xnoremap <LocalLeader>e :call GetHumanReadableDate()<CR>
xnoremap <LocalLeader>E :call GetEpochDate()<CR>