]> arthur.barton.de Git - ax-zsh.git/commitdiff
New "std_functions" default plugin
authorAlexander Barton <alex@barton.de>
Thu, 11 Jun 2020 12:07:12 +0000 (14:07 +0200)
committerAlexander Barton <alex@barton.de>
Thu, 11 Jun 2020 12:21:51 +0000 (14:21 +0200)
This plugin will implement some "standard" functions. Right now, it only
implements take() and zsh_stats() functions, known from OhMyZsh.

default_plugins/std_functions/std_functions.zshrc [new file with mode: 0644]

diff --git a/default_plugins/std_functions/std_functions.zshrc b/default_plugins/std_functions/std_functions.zshrc
new file mode 100644 (file)
index 0000000..fd3378a
--- /dev/null
@@ -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
+}