Extracted icons into a separate file.

This commit is contained in:
Dominik Ritter 2015-10-23 23:42:59 +02:00
commit d6584e13da
3 changed files with 203 additions and 196 deletions

View file

@ -1,13 +1,10 @@
# vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8
################################################################
# power-functions
# Utility functions
# This file holds some utility-functions for
# the powerlevel9k-ZSH-theme
# https://github.com/bhilburn/powerlevel9k
################################################################
################################################################
# Utility functions
################################################################
# Exits with 0 if a variable has been previously defined (even if empty)
# Takes the name of a variable that should be checked.
@ -29,19 +26,6 @@ function set_default() {
defined "$varname" || typeset -g "$varname"="$default_value"
}
# Safety function for printing icons
# Prints the named icon, or if that icon is undefined, the string name.
function print_icon() {
local icon_name=$1
local ICON_USER_VARIABLE=POWERLEVEL9K_${icon_name}
local USER_ICON=${(P)ICON_USER_VARIABLE}
if defined "$ICON_USER_VARIABLE"; then
echo -n "$USER_ICON"
else
echo -n "${icons[$icon_name]}"
fi
}
# Get numerical color codes. That way we translate ANSI codes
# into ZSH-Style color codes.
function getColorCode() {
@ -140,12 +124,6 @@ function getRelevantItem() {
done
}
get_icon_names() {
for key in ${(@k)icons}; do
echo "POWERLEVEL9K_$key: ${icons[$key]}"
done
}
# OS detection for the `os_icon` segment
case $(uname) in
Darwin)