From: Alexander Barton Date: Thu, 11 Jun 2020 12:07:12 +0000 (+0200) Subject: New "std_functions" default plugin X-Git-Url: https://arthur.barton.de/gitweb/?p=ax-zsh.git;a=commitdiff_plain;h=e78755cd54113dd5864b56916415c433bcec7a5b New "std_functions" default plugin This plugin will implement some "standard" functions. Right now, it only implements take() and zsh_stats() functions, known from OhMyZsh. --- diff --git a/default_plugins/std_functions/std_functions.zshrc b/default_plugins/std_functions/std_functions.zshrc new file mode 100644 index 0000000..fd3378a --- /dev/null +++ b/default_plugins/std_functions/std_functions.zshrc @@ -0,0 +1,12 @@ +# AX-ZSH: Alex' Modular ZSH Configuration +# std_functions: Setup standard ("common") functions + +function take() { + mkdir -p "$@" && cd "${@:$#}" +} + +function zsh_stats() { + fc -l 1 \ + | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' \ + | grep -v "./" | column -c3 -s " " -t | sort -nr | nl -w 3 -s ": " | head -n20 +}