diff options
author | Dominik Ritter <dritter03@googlemail.com> | 2015-10-01 01:38:02 +0300 |
---|---|---|
committer | Dominik Ritter <dritter03@googlemail.com> | 2015-10-01 01:38:02 +0300 |
commit | d436c60f243f238a894360a12dbcd053de3fb95b (patch) | |
tree | ac7a74474f0fd466593315f9497270a0a4614191 | |
parent | e8a53c253b4d86c91db4a009a1aa25443b3d5686 (diff) | |
parent | 6d24f93760d866feceda8750a115e19beb6250b1 (diff) |
Merge branch 'ram_prompt' of github.com:dritter/powerlevel9k into ram_prompt
-rwxr-xr-x | powerlevel9k.zsh-theme | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index a08282a1..9e43c96a 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -715,6 +715,31 @@ prompt_load() { "$1_prompt_segment" "$0$FUNCTION_SUFFIX" "$BACKGROUND_COLOR" "$DEFAULT_COLOR" "$(print_icon 'LOAD_ICON') $load_avg_5min" } +# Node version +prompt_node_version() { + local nvm_prompt + nvm_prompt=$(node -v 2>/dev/null) + [[ -z "${nvm_prompt}" ]] && return + + "$1_prompt_segment" "$0" "green" "white" "${nvm_prompt:1} $(print_icon 'NODE_ICON')" +} + +# print a little OS icon +prompt_os_icon() { + "$1_prompt_segment" "$0" "black" "255" "$OS_ICON" +} + +# print PHP version number +prompt_php_version() { + local php_version + php_version=$(php -v 2>&1 | grep -oe "^PHP\s*[0-9.]*") + + if [[ -n "$php_version" ]]; then + "$1_prompt_segment" "$0" "013" "255" "$php_version" + fi +} + +# Show free RAM and used Swap prompt_ram() { defined POWERLEVEL9K_RAM_ELEMENTS || POWERLEVEL9K_RAM_ELEMENTS=(ram_free swap_used) @@ -746,7 +771,7 @@ prompt_ram() { else swap_total=$(grep -o -E "SwapTotal:\s+[0-9]+" /proc/meminfo | grep -o "[0-9]*") swap_free=$(grep -o -E "SwapFree:\s+[0-9]+" /proc/meminfo | grep -o "[0-9]*") - swap_used=$(( swap_free - swap_total )) + swap_used=$(( swap_total - swap_free )) base=K fi @@ -758,30 +783,6 @@ prompt_ram() { "$1_prompt_segment" "$0" "yellow" "$DEFAULT_COLOR" "${rendition% }" } -# Node version -prompt_node_version() { - local nvm_prompt - nvm_prompt=$(node -v 2>/dev/null) - [[ -z "${nvm_prompt}" ]] && return - - "$1_prompt_segment" "$0" "green" "white" "${nvm_prompt:1} $(print_icon 'NODE_ICON')" -} - -# print a little OS icon -prompt_os_icon() { - "$1_prompt_segment" "$0" "black" "255" "$OS_ICON" -} - -# print PHP version number -prompt_php_version() { - local php_version - php_version=$(php -v 2>&1 | grep -oe "^PHP\s*[0-9.]*") - - if [[ -n "$php_version" ]]; then - "$1_prompt_segment" "$0" "013" "255" "$php_version" - fi -} - # rbenv information prompt_rbenv() { if [[ -n "$RBENV_VERSION" ]]; then |