]> arthur.ath.cx Git - ax-zsh.git/blob - default_plugins/std_functions/std_functions.zshrc
std_functions: Add (very simple) "open" function
[ax-zsh.git] / default_plugins / std_functions / std_functions.zshrc
1 # AX-ZSH: Alex' Modular ZSH Configuration
2 # std_functions: Setup standard ("common") functions
3
4 function open_command() {
5         case $OSTYPE in
6                 darwin*)
7                         open "$@" || return 1
8                         ;;
9                 cygwin*)
10                         cygstart "$@" || return 1
11                         ;;
12                 linux*)
13                         nohup xdg-open "$@" &>/dev/null || return 1
14                         ;;
15         esac
16         return 1
17 }
18
19 function take() {
20         mkdir -p "$@" && cd "${@:$#}"
21 }
22
23 function zsh_stats() {
24         fc -l 1 \
25         | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' \
26         | grep -v "./" | column -c3 -s " " -t | sort -nr | nl -w 3 -s ": " | head -n20
27 }