diff --git a/dot_zsh_functions b/dot_zsh_functions index 465e331..53e877d 100644 --- a/dot_zsh_functions +++ b/dot_zsh_functions @@ -113,11 +113,17 @@ function top_commands_full() { history | \cat | awk '{$1=$1};1' | sed 's/^[0-9 TAB]*//g' | awk '{CMD[$0]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "%\t" a; }' | grep "$filter" | sort -nr | nl | head -n50 } function suggest_aliases() { + header "alias recommendations" while read -r line do local matching_aliases=$(ag "$line") if [ ! -z "$matching_aliases" ]; then - echo "there is an alias for $line :\n$matching_aliases\n" + success "there is an alias for $line :" + while read -r alias_line + do + arrow "$alias_line" + done < <(echo "$matching_aliases") + echo fi done < <(top_commands_full | awk '{ $1=""; $2=""; $3=""; print}' | awk 'NF' | awk '{$1=$1};1' | awk -v COUNT=1 'NF>COUNT' | head -20) } @@ -478,3 +484,14 @@ function file_dups { function foreach_run { find . -name "$1" -exec "$2" {} \; } +# input should be something like : 1-10 to generate one number between 1 and 10 +function chance { + [[ $(shuf -i "$1" -n 1) == 1 ]] +} +function runiflucky { + if chance "1-10"; then + if alias "$1" 2> /dev/null || (compgen -A function | grep "$1" && compgen -A function "$1" 1>/dev/null); then + eval "$1" + fi + fi +} diff --git a/dot_zshrc b/dot_zshrc index 869ee9c..5581e9c 100644 --- a/dot_zshrc +++ b/dot_zshrc @@ -30,7 +30,6 @@ POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status background_jobs command_execution_tim POWERLEVEL9K_SHOW_CHANGESET=true POWERLEVEL9K_CHANGESET_HASH_LENGTH=8 - POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR='' POWERLEVEL9K_RIGHT_SUBSEGMENT_SEPARATOR='' @@ -38,13 +37,11 @@ POWERLEVEL9K_TIME_FOREGROUND='245' POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND='245' POWERLEVEL9K_STATUS_OK_FOREGROUND='green' POWERLEVEL9k_STATUS_ERROR_FOREGROUND='red' -POWERLEVEL9k_STATUS_ERROR_FOREGROUND='red' POWERLEVEL9K_TIME_BACKGROUND='clear' POWERLEVEL9K_COMMAND_EXECUTION_TIME_BACKGROUND='clear' POWERLEVEL9K_STATUS_OK_BACKGROUND='clear' POWERLEVEL9K_STATUS_ERROR_BACKGROUND='clear' -POWERLEVEL9K_STATUS_ERROR_BACKGROUND='clear' POWERLEVEL9K_CONTEXT_DEFAULT_BACKGROUND='clear' # Set list of themes to pick from when loading at random @@ -151,8 +148,8 @@ eval "$(fasd --init auto)" #cm apply -# check if we have new jira issues -istherenewissues +# randomly check if we have new jira issues +runiflucky "istherenewissues" case "$(uname -s)" in Darwin) @@ -165,8 +162,6 @@ esac export SDKMAN_DIR="$HOME/.sdkman" [[ -s "$SDKMAN_DIR/bin/sdkman-init.sh" ]] && source "$SDKMAN_DIR/bin/sdkman-init.sh" -#sdk use java 8.0.202-zulu - case "$(uname -s)" in Darwin) ln -snf /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/bin/pip /usr/local/bin/pip3