zsh:alias: Add duration that formats seconds

This commit is contained in:
2024-09-20 16:27:58 +02:00
parent c273c3ac52
commit 9d756c2748
2 changed files with 8 additions and 0 deletions

View File

@@ -268,6 +268,8 @@ augroup END
nnoremap <leader>utc ciw<C-r>=strftime("%F %T", @")<CR><Esc>
vnoremap <leader>utc <Cmd>s/\v(^\|[^0-9])\zs[0-9]{10}\ze([^0-9]\|$)/\=strftime("%F %T",submatch(0))/g<CR>
" TODO: <leader>sec that uses the `duration` alias from zsh
" Relax mappings that jump to opening braces on first column: Just make sure
" they are on an unindented line. This is useful for files that use a different
" coding style guide than the kernel and similar.

View File

@@ -131,6 +131,12 @@ fi
alias sizes='du -sch * | sort -h'
# Count number of occurrences for every line in stdin
alias count='sort | uniq -c | sort -n'
# Inspired by https://stackoverflow.com/a/54541337
# > echo 1747502 | duration
# 20d 5h 25m 2s
#
# TODO: do not print values if they are zero
alias duration="dc -e '?60~r60~r24~rn[d ]nn[h ]nn[m ]nn[s]p'"
# Precommand modifiers
alias mkdir='nocorrect mkdir'