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:
parent
131e5bb364
commit
2e8f138f8b
1 changed files with 14 additions and 0 deletions
14
nvim/.config/nvim/plugin/epoch-converter.vim
Normal file
14
nvim/.config/nvim/plugin/epoch-converter.vim
Normal 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>
|
Loading…
Reference in a new issue