Ignore kate backups

This commit is contained in:
caskd 2019-10-27 03:52:00 +01:00
parent 205d677e2f
commit 1aa949949e
No known key found for this signature in database
GPG Key ID: 4D0C454CCA5DF3B6
102 changed files with 12516 additions and 96 deletions

3
.gitignore vendored
View File

@ -1 +1,2 @@
resources/
resources/.*~
*.kate-swp

View File

@ -1,20 +0,0 @@
# Check if running in TTY
if [ -z ${SSH_CONNECTION} ]; then
export TERM="xterm";
ZSH_THEME="dpoggi"; source $ZSHCONF/resources/dpoggi-timestamp.zsh-theme;
else
case $(tty) in
/dev/tty[2-9])
export TERM="xterm";
ZSH_THEME="dpoggi"; source $ZSHCONF/resources/dpoggi-timestamp.zsh-theme;
;;
/dev/pts/*)
export TERM="xterm-256color";
ZSH_THEME="powerlevel9k/powerlevel9k"; source $ZSHCONF/resources/powerlevel9k/powerlevel9k.zsh-theme;
#ZSH_THEME="spaceship"; source $ZSHCONF/resources/spaceship-prompt/spaceship.zsh-theme;
;;
*)
echo "We did not recognize the terminal type you are currently using!"
;;
esac
fi

View File

@ -1,69 +0,0 @@
plugins=(
cp
docker
docker-compose
git
golang
history
perms
sudo
systemadmin
systemd
)
case $(uname -rv) in
*Ubuntu*)
plugins+=(
ubuntu
)
;;
*)
plugins+=(
archlinux
)
;;
esac
function docker-all {
for ((i=0;i<=4;i++)); do
docker -H ssh://fra-n${i} $@
done
}
function build-n-push {
docker build ${1} --tag=localhost:5000/${2} && docker push localhost:5000/${2}
}
function manpdf {
man -Tpdf $1 | okular - &
disown
}
function gitsubrepo {
find . -maxdepth 1 -mindepth 1 -type d -exec sh -c '(echo {} && cd {} && git status -s && echo)' \;
}
function gitcom {
git add -A && git commit -am "$1" && git push
# git diff HEAD^ --compact-summary | while read LINE; do echo "$LINE"; done
}
function osutab {
xinput set-prop 'UGTABLET 6 inch PenTablet Pen (0)' --type=float 153 3.5 0 -0.5 0 2.9 0 0 0 1
}
function ignorekate {
printf ".*~\n*.kate-swp" >> .gitignore
}
function tonullpointer {
if [ -z ${1} ]; then
RANDFN=${RANDOM}
> /tmp/${RANDFN}
curl -F"file=@/tmp/${RANDFN}" http://0x0.st
rm /tmp/${RANDFN}
else
curl -F"file=@${1}" http://0x0.st
fi
}
function convert2gif {
ffmpeg -hwaccel vdpau -i $1 -r 60 -vf "scale=480:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 ${1%.*}.gif
}
function youtube2gif {
if [ -z ${1} ] || [ -z ${2} ] || [ -z ${3} ]; then
echo "Usage: youtube2gif <url> <start position> <lenght> [resolution] [framerate] [bitrate]";
else
ffmpeg -ss ${2} -t ${3} -hwaccel vdpau -i $(youtube-dl -gf "bestvideo[height<=${4-360}]" ${1}) -r ${5-60} -vf "scale=${4-360}:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -b:v ${6-1000} -loop 0 -f gif -;
fi
}

View File

@ -1,6 +0,0 @@
export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH
export LD_LIBRARY_PATH=/usr/lib:/usr/lib32:$HOME/.steam/bin/:$LD_LIBRARY_PATH
export ZSH="/home/caskd/.oh-my-zsh"
export LANG="en_US.UTF-8"
export AURHELPER=yay
export DOCKER_HOST=ssh://fra-n0

View File

@ -0,0 +1 @@
source ${0:A:h}/zsh-autosuggestions.zsh

View File

@ -0,0 +1,742 @@
# Fish-like fast/unobtrusive autosuggestions for zsh.
# https://github.com/zsh-users/zsh-autosuggestions
# v0.5.0
# Copyright (c) 2013 Thiago de Arruda
# Copyright (c) 2016-2018 Eric Freese
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
# conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#--------------------------------------------------------------------#
# Setup #
#--------------------------------------------------------------------#
# Precmd hooks for initializing the library and starting pty's
autoload -Uz add-zsh-hook
# Asynchronous suggestions are generated in a pty
zmodload zsh/zpty
#--------------------------------------------------------------------#
# Global Configuration Variables #
#--------------------------------------------------------------------#
# Color to use when highlighting suggestion
# Uses format of `region_highlight`
# More info: http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Zle-Widgets
: ${ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8'}
# Prefix to use when saving original versions of bound widgets
: ${ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX=autosuggest-orig-}
# Strategies to use to fetch a suggestion
# Will try each strategy in order until a suggestion is returned
(( ! ${+ZSH_AUTOSUGGEST_STRATEGY} )) && ZSH_AUTOSUGGEST_STRATEGY=(history)
# Widgets that clear the suggestion
(( ! ${+ZSH_AUTOSUGGEST_CLEAR_WIDGETS} )) && ZSH_AUTOSUGGEST_CLEAR_WIDGETS=(
history-search-forward
history-search-backward
history-beginning-search-forward
history-beginning-search-backward
history-substring-search-up
history-substring-search-down
up-line-or-beginning-search
down-line-or-beginning-search
up-line-or-history
down-line-or-history
accept-line
)
# Widgets that accept the entire suggestion
(( ! ${+ZSH_AUTOSUGGEST_ACCEPT_WIDGETS} )) && ZSH_AUTOSUGGEST_ACCEPT_WIDGETS=(
forward-char
end-of-line
vi-forward-char
vi-end-of-line
vi-add-eol
)
# Widgets that accept the entire suggestion and execute it
(( ! ${+ZSH_AUTOSUGGEST_EXECUTE_WIDGETS} )) && ZSH_AUTOSUGGEST_EXECUTE_WIDGETS=(
)
# Widgets that accept the suggestion as far as the cursor moves
(( ! ${+ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS} )) && ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS=(
forward-word
emacs-forward-word
vi-forward-word
vi-forward-word-end
vi-forward-blank-word
vi-forward-blank-word-end
vi-find-next-char
vi-find-next-char-skip
)
# Widgets that should be ignored (globbing supported but must be escaped)
(( ! ${+ZSH_AUTOSUGGEST_IGNORE_WIDGETS} )) && ZSH_AUTOSUGGEST_IGNORE_WIDGETS=(
orig-\*
beep
run-help
set-local-history
which-command
yank
yank-pop
)
# Max size of buffer to trigger autosuggestion. Leave null for no upper bound.
: ${ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=}
# Pty name for calculating autosuggestions asynchronously
: ${ZSH_AUTOSUGGEST_ASYNC_PTY_NAME=zsh_autosuggest_pty}
#--------------------------------------------------------------------#
# Utility Functions #
#--------------------------------------------------------------------#
_zsh_autosuggest_escape_command() {
setopt localoptions EXTENDED_GLOB
# Escape special chars in the string (requires EXTENDED_GLOB)
echo -E "${1//(#m)[\"\'\\()\[\]|*?~]/\\$MATCH}"
}
#--------------------------------------------------------------------#
# Feature Detection #
#--------------------------------------------------------------------#
_zsh_autosuggest_feature_detect_zpty_returns_fd() {
typeset -g _ZSH_AUTOSUGGEST_ZPTY_RETURNS_FD
typeset -h REPLY
zpty zsh_autosuggest_feature_detect '{ zshexit() { kill -KILL $$; sleep 1 } }'
if (( REPLY )); then
_ZSH_AUTOSUGGEST_ZPTY_RETURNS_FD=1
else
_ZSH_AUTOSUGGEST_ZPTY_RETURNS_FD=0
fi
zpty -d zsh_autosuggest_feature_detect
}
#--------------------------------------------------------------------#
# Widget Helpers #
#--------------------------------------------------------------------#
_zsh_autosuggest_incr_bind_count() {
if ((${+_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]})); then
((_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]++))
else
_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]=1
fi
typeset -gi bind_count=$_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]
}
_zsh_autosuggest_get_bind_count() {
if ((${+_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]})); then
typeset -gi bind_count=$_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]
else
typeset -gi bind_count=0
fi
}
# Bind a single widget to an autosuggest widget, saving a reference to the original widget
_zsh_autosuggest_bind_widget() {
typeset -gA _ZSH_AUTOSUGGEST_BIND_COUNTS
local widget=$1
local autosuggest_action=$2
local prefix=$ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX
local -i bind_count
# Save a reference to the original widget
case $widgets[$widget] in
# Already bound
user:_zsh_autosuggest_(bound|orig)_*);;
# User-defined widget
user:*)
_zsh_autosuggest_incr_bind_count $widget
zle -N $prefix${bind_count}-$widget ${widgets[$widget]#*:}
;;
# Built-in widget
builtin)
_zsh_autosuggest_incr_bind_count $widget
eval "_zsh_autosuggest_orig_${(q)widget}() { zle .${(q)widget} }"
zle -N $prefix${bind_count}-$widget _zsh_autosuggest_orig_$widget
;;
# Completion widget
completion:*)
_zsh_autosuggest_incr_bind_count $widget
eval "zle -C $prefix${bind_count}-${(q)widget} ${${(s.:.)widgets[$widget]}[2,3]}"
;;
esac
_zsh_autosuggest_get_bind_count $widget
# Pass the original widget's name explicitly into the autosuggest
# function. Use this passed in widget name to call the original
# widget instead of relying on the $WIDGET variable being set
# correctly. $WIDGET cannot be trusted because other plugins call
# zle without the `-w` flag (e.g. `zle self-insert` instead of
# `zle self-insert -w`).
eval "_zsh_autosuggest_bound_${bind_count}_${(q)widget}() {
_zsh_autosuggest_widget_$autosuggest_action $prefix$bind_count-${(q)widget} \$@
}"
# Create the bound widget
zle -N -- $widget _zsh_autosuggest_bound_${bind_count}_$widget
}
# Map all configured widgets to the right autosuggest widgets
_zsh_autosuggest_bind_widgets() {
emulate -L zsh
local widget
local ignore_widgets
ignore_widgets=(
.\*
_\*
zle-\*
autosuggest-\*
$ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX\*
$ZSH_AUTOSUGGEST_IGNORE_WIDGETS
)
# Find every widget we might want to bind and bind it appropriately
for widget in ${${(f)"$(builtin zle -la)"}:#${(j:|:)~ignore_widgets}}; do
if [[ -n ${ZSH_AUTOSUGGEST_CLEAR_WIDGETS[(r)$widget]} ]]; then
_zsh_autosuggest_bind_widget $widget clear
elif [[ -n ${ZSH_AUTOSUGGEST_ACCEPT_WIDGETS[(r)$widget]} ]]; then
_zsh_autosuggest_bind_widget $widget accept
elif [[ -n ${ZSH_AUTOSUGGEST_EXECUTE_WIDGETS[(r)$widget]} ]]; then
_zsh_autosuggest_bind_widget $widget execute
elif [[ -n ${ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS[(r)$widget]} ]]; then
_zsh_autosuggest_bind_widget $widget partial_accept
else
# Assume any unspecified widget might modify the buffer
_zsh_autosuggest_bind_widget $widget modify
fi
done
}
# Given the name of an original widget and args, invoke it, if it exists
_zsh_autosuggest_invoke_original_widget() {
# Do nothing unless called with at least one arg
(( $# )) || return 0
local original_widget_name="$1"
shift
if (( ${+widgets[$original_widget_name]} )); then
zle $original_widget_name -- $@
fi
}
#--------------------------------------------------------------------#
# Highlighting #
#--------------------------------------------------------------------#
# If there was a highlight, remove it
_zsh_autosuggest_highlight_reset() {
typeset -g _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT
if [[ -n "$_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT" ]]; then
region_highlight=("${(@)region_highlight:#$_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT}")
unset _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT
fi
}
# If there's a suggestion, highlight it
_zsh_autosuggest_highlight_apply() {
typeset -g _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT
if (( $#POSTDISPLAY )); then
typeset -g _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT="$#BUFFER $(($#BUFFER + $#POSTDISPLAY)) $ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE"
region_highlight+=("$_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT")
else
unset _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT
fi
}
#--------------------------------------------------------------------#
# Autosuggest Widget Implementations #
#--------------------------------------------------------------------#
# Disable suggestions
_zsh_autosuggest_disable() {
typeset -g _ZSH_AUTOSUGGEST_DISABLED
_zsh_autosuggest_clear
}
# Enable suggestions
_zsh_autosuggest_enable() {
unset _ZSH_AUTOSUGGEST_DISABLED
if (( $#BUFFER )); then
_zsh_autosuggest_fetch
fi
}
# Toggle suggestions (enable/disable)
_zsh_autosuggest_toggle() {
if [[ -n "${_ZSH_AUTOSUGGEST_DISABLED+x}" ]]; then
_zsh_autosuggest_enable
else
_zsh_autosuggest_disable
fi
}
# Clear the suggestion
_zsh_autosuggest_clear() {
# Remove the suggestion
unset POSTDISPLAY
_zsh_autosuggest_invoke_original_widget $@
}
# Modify the buffer and get a new suggestion
_zsh_autosuggest_modify() {
emulate -L zsh
local -i retval
# Only available in zsh >= 5.4
local -i KEYS_QUEUED_COUNT
# Save the contents of the buffer/postdisplay
local orig_buffer="$BUFFER"
local orig_postdisplay="$POSTDISPLAY"
# Clear suggestion while waiting for next one
unset POSTDISPLAY
# Original widget may modify the buffer
_zsh_autosuggest_invoke_original_widget $@
retval=$?
# Don't fetch a new suggestion if there's more input to be read immediately
if (( $PENDING > 0 )) || (( $KEYS_QUEUED_COUNT > 0 )); then
POSTDISPLAY="$orig_postdisplay"
return $retval
fi
# Optimize if manually typing in the suggestion
if (( $#BUFFER > $#orig_buffer )); then
local added=${BUFFER#$orig_buffer}
# If the string added matches the beginning of the postdisplay
if [[ "$added" = "${orig_postdisplay:0:$#added}" ]]; then
POSTDISPLAY="${orig_postdisplay:$#added}"
return $retval
fi
fi
# Don't fetch a new suggestion if the buffer hasn't changed
if [[ "$BUFFER" = "$orig_buffer" ]]; then
POSTDISPLAY="$orig_postdisplay"
return $retval
fi
# Bail out if suggestions are disabled
if [[ -n "${_ZSH_AUTOSUGGEST_DISABLED+x}" ]]; then
return $?
fi
# Get a new suggestion if the buffer is not empty after modification
if (( $#BUFFER > 0 )); then
if [[ -z "$ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE" ]] || (( $#BUFFER <= $ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE )); then
_zsh_autosuggest_fetch
fi
fi
return $retval
}
# Fetch a new suggestion based on what's currently in the buffer
_zsh_autosuggest_fetch() {
if zpty -t "$ZSH_AUTOSUGGEST_ASYNC_PTY_NAME" &>/dev/null; then
_zsh_autosuggest_async_request "$BUFFER"
else
local suggestion
_zsh_autosuggest_fetch_suggestion "$BUFFER"
_zsh_autosuggest_suggest "$suggestion"
fi
}
# Offer a suggestion
_zsh_autosuggest_suggest() {
emulate -L zsh
local suggestion="$1"
if [[ -n "$suggestion" ]] && (( $#BUFFER )); then
POSTDISPLAY="${suggestion#$BUFFER}"
else
unset POSTDISPLAY
fi
}
# Accept the entire suggestion
_zsh_autosuggest_accept() {
local -i max_cursor_pos=$#BUFFER
# When vicmd keymap is active, the cursor can't move all the way
# to the end of the buffer
if [[ "$KEYMAP" = "vicmd" ]]; then
max_cursor_pos=$((max_cursor_pos - 1))
fi
# Only accept if the cursor is at the end of the buffer
if [[ $CURSOR = $max_cursor_pos ]]; then
# Add the suggestion to the buffer
BUFFER="$BUFFER$POSTDISPLAY"
# Remove the suggestion
unset POSTDISPLAY
# Move the cursor to the end of the buffer
CURSOR=${#BUFFER}
fi
_zsh_autosuggest_invoke_original_widget $@
}
# Accept the entire suggestion and execute it
_zsh_autosuggest_execute() {
# Add the suggestion to the buffer
BUFFER="$BUFFER$POSTDISPLAY"
# Remove the suggestion
unset POSTDISPLAY
# Call the original `accept-line` to handle syntax highlighting or
# other potential custom behavior
_zsh_autosuggest_invoke_original_widget "accept-line"
}
# Partially accept the suggestion
_zsh_autosuggest_partial_accept() {
local -i retval cursor_loc
# Save the contents of the buffer so we can restore later if needed
local original_buffer="$BUFFER"
# Temporarily accept the suggestion.
BUFFER="$BUFFER$POSTDISPLAY"
# Original widget moves the cursor
_zsh_autosuggest_invoke_original_widget $@
retval=$?
# Normalize cursor location across vi/emacs modes
cursor_loc=$CURSOR
if [[ "$KEYMAP" = "vicmd" ]]; then
cursor_loc=$((cursor_loc + 1))
fi
# If we've moved past the end of the original buffer
if (( $cursor_loc > $#original_buffer )); then
# Set POSTDISPLAY to text right of the cursor
POSTDISPLAY="${BUFFER[$(($cursor_loc + 1)),$#BUFFER]}"
# Clip the buffer at the cursor
BUFFER="${BUFFER[1,$cursor_loc]}"
else
# Restore the original buffer
BUFFER="$original_buffer"
fi
return $retval
}
for action in clear modify fetch suggest accept partial_accept execute enable disable toggle; do
eval "_zsh_autosuggest_widget_$action() {
local -i retval
_zsh_autosuggest_highlight_reset
_zsh_autosuggest_$action \$@
retval=\$?
_zsh_autosuggest_highlight_apply
zle -R
return \$retval
}"
done
zle -N autosuggest-fetch _zsh_autosuggest_widget_fetch
zle -N autosuggest-suggest _zsh_autosuggest_widget_suggest
zle -N autosuggest-accept _zsh_autosuggest_widget_accept
zle -N autosuggest-clear _zsh_autosuggest_widget_clear
zle -N autosuggest-execute _zsh_autosuggest_widget_execute
zle -N autosuggest-enable _zsh_autosuggest_widget_enable
zle -N autosuggest-disable _zsh_autosuggest_widget_disable
zle -N autosuggest-toggle _zsh_autosuggest_widget_toggle
#--------------------------------------------------------------------#
# History Suggestion Strategy #
#--------------------------------------------------------------------#
# Suggests the most recent history item that matches the given
# prefix.
#
_zsh_autosuggest_strategy_history() {
# Reset options to defaults and enable LOCAL_OPTIONS
emulate -L zsh
# Enable globbing flags so that we can use (#m)
setopt EXTENDED_GLOB
# Escape backslashes and all of the glob operators so we can use
# this string as a pattern to search the $history associative array.
# - (#m) globbing flag enables setting references for match data
# TODO: Use (b) flag when we can drop support for zsh older than v5.0.8
local prefix="${1//(#m)[\\*?[\]<>()|^~#]/\\$MATCH}"
# Get the history items that match
# - (r) subscript flag makes the pattern match on values
typeset -g suggestion="${history[(r)${prefix}*]}"
}
#--------------------------------------------------------------------#
# Match Previous Command Suggestion Strategy #
#--------------------------------------------------------------------#
# Suggests the most recent history item that matches the given
# prefix and whose preceding history item also matches the most
# recently executed command.
#
# For example, suppose your history has the following entries:
# - pwd
# - ls foo
# - ls bar
# - pwd
#
# Given the history list above, when you type 'ls', the suggestion
# will be 'ls foo' rather than 'ls bar' because your most recently
# executed command (pwd) was previously followed by 'ls foo'.
#
# Note that this strategy won't work as expected with ZSH options that don't
# preserve the history order such as `HIST_IGNORE_ALL_DUPS` or
# `HIST_EXPIRE_DUPS_FIRST`.
_zsh_autosuggest_strategy_match_prev_cmd() {
# Reset options to defaults and enable LOCAL_OPTIONS
emulate -L zsh
# Enable globbing flags so that we can use (#m)
setopt EXTENDED_GLOB
# TODO: Use (b) flag when we can drop support for zsh older than v5.0.8
local prefix="${1//(#m)[\\*?[\]<>()|^~#]/\\$MATCH}"
# Get all history event numbers that correspond to history
# entries that match pattern $prefix*
local history_match_keys
history_match_keys=(${(k)history[(R)$prefix*]})
# By default we use the first history number (most recent history entry)
local histkey="${history_match_keys[1]}"
# Get the previously executed command
local prev_cmd="$(_zsh_autosuggest_escape_command "${history[$((HISTCMD-1))]}")"
# Iterate up to the first 200 history event numbers that match $prefix
for key in "${(@)history_match_keys[1,200]}"; do
# Stop if we ran out of history
[[ $key -gt 1 ]] || break
# See if the history entry preceding the suggestion matches the
# previous command, and use it if it does
if [[ "${history[$((key - 1))]}" == "$prev_cmd" ]]; then
histkey="$key"
break
fi
done
# Give back the matched history entry
typeset -g suggestion="$history[$histkey]"
}
#--------------------------------------------------------------------#
# Fetch Suggestion #
#--------------------------------------------------------------------#
# Loops through all specified strategies and returns a suggestion
# from the first strategy to provide one.
#
_zsh_autosuggest_fetch_suggestion() {
typeset -g suggestion
local -a strategies
# Ensure we are working with an array
strategies=(${=ZSH_AUTOSUGGEST_STRATEGY})
for strategy in $strategies; do
# Try to get a suggestion from this strategy
_zsh_autosuggest_strategy_$strategy "$1"
# Break once we've found a suggestion
[[ -n "$suggestion" ]] && break
done
}
#--------------------------------------------------------------------#
# Async #
#--------------------------------------------------------------------#
# Zpty process is spawned running this function
_zsh_autosuggest_async_server() {
emulate -R zsh
# There is a bug in zpty module (fixed in zsh/master) by which a
# zpty that exits will kill all zpty processes that were forked
# before it. Here we set up a zsh exit hook to SIGKILL the zpty
# process immediately, before it has a chance to kill any other
# zpty processes.
zshexit() {
kill -KILL $$
sleep 1 # Block for long enough for the signal to come through
}
# Don't add any extra carriage returns
stty -onlcr
# Don't translate carriage returns to newlines
stty -icrnl
# Silence any error messages
exec 2>/dev/null
local last_pid
while IFS='' read -r -d $'\0' query; do
# Kill last bg process
kill -KILL $last_pid &>/dev/null
# Run suggestion search in the background
(
local suggestion
_zsh_autosuggest_fetch_suggestion "$query"
echo -n -E "$suggestion"$'\0'
) &
last_pid=$!
done
}
_zsh_autosuggest_async_request() {
# Write the query to the zpty process to fetch a suggestion
zpty -w -n $ZSH_AUTOSUGGEST_ASYNC_PTY_NAME "${1}"$'\0'
}
# Called when new data is ready to be read from the pty
# First arg will be fd ready for reading
# Second arg will be passed in case of error
_zsh_autosuggest_async_response() {
setopt LOCAL_OPTIONS EXTENDED_GLOB
local suggestion
zpty -rt $ZSH_AUTOSUGGEST_ASYNC_PTY_NAME suggestion '*'$'\0' 2>/dev/null
zle autosuggest-suggest -- "${suggestion%%$'\0'##}"
}
_zsh_autosuggest_async_pty_create() {
# With newer versions of zsh, REPLY stores the fd to read from
typeset -h REPLY
# If we won't get a fd back from zpty, try to guess it
if (( ! $_ZSH_AUTOSUGGEST_ZPTY_RETURNS_FD )); then
integer -l zptyfd
exec {zptyfd}>&1 # Open a new file descriptor (above 10).
exec {zptyfd}>&- # Close it so it's free to be used by zpty.
fi
# Fork a zpty process running the server function
zpty -b $ZSH_AUTOSUGGEST_ASYNC_PTY_NAME _zsh_autosuggest_async_server
# Store the fd so we can remove the handler later
if (( REPLY )); then
_ZSH_AUTOSUGGEST_PTY_FD=$REPLY
else
_ZSH_AUTOSUGGEST_PTY_FD=$zptyfd
fi
# Set up input handler from the zpty
zle -F $_ZSH_AUTOSUGGEST_PTY_FD _zsh_autosuggest_async_response
}
_zsh_autosuggest_async_pty_destroy() {
# Remove the input handler
zle -F $_ZSH_AUTOSUGGEST_PTY_FD &>/dev/null
# Destroy the zpty
zpty -d $ZSH_AUTOSUGGEST_ASYNC_PTY_NAME &>/dev/null
}
_zsh_autosuggest_async_pty_recreate() {
_zsh_autosuggest_async_pty_destroy
_zsh_autosuggest_async_pty_create
}
_zsh_autosuggest_async_start() {
typeset -g _ZSH_AUTOSUGGEST_PTY_FD
_zsh_autosuggest_feature_detect_zpty_returns_fd
_zsh_autosuggest_async_pty_recreate
# We recreate the pty to get a fresh list of history events
add-zsh-hook precmd _zsh_autosuggest_async_pty_recreate
}
#--------------------------------------------------------------------#
# Start #
#--------------------------------------------------------------------#
# Start the autosuggestion widgets
_zsh_autosuggest_start() {
add-zsh-hook -d precmd _zsh_autosuggest_start
_zsh_autosuggest_bind_widgets
# Re-bind widgets on every precmd to ensure we wrap other wrappers.
# Specifically, highlighting breaks if our widgets are wrapped by
# zsh-syntax-highlighting widgets. This also allows modifications
# to the widget list variables to take effect on the next precmd.
add-zsh-hook precmd _zsh_autosuggest_bind_widgets
if [[ -n "${ZSH_AUTOSUGGEST_USE_ASYNC+x}" ]]; then
_zsh_autosuggest_async_start
fi
}
# Start the autosuggestion widgets on the next precmd
add-zsh-hook precmd _zsh_autosuggest_start

View File

@ -0,0 +1,14 @@
if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
#PROMPT='%* %{$fg[$NCOLOR]%}%n%{$reset_color%}@%{$fg[cyan]%}%m\
PROMPT='%D{%H:%M:%S} %{$fg[$NCOLOR]%}%n%{$reset_color%}@%{$fg[cyan]%}%m\
%{$reset_color%}:%{$fg[magenta]%}%~\
$(git_prompt_info)
%{$fg[red]%}%(!.#.$)%{$reset_color%} '
PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
RPS1='${return_code}'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}("
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}○%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}⚡%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[yellow]%})%{$reset_color%}"

View File

@ -0,0 +1,358 @@
# vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8
################################################################
# Color functions
# This file holds some color-functions for
# the powerlevel9k-ZSH-theme
# https://github.com/bhilburn/powerlevel9k
################################################################
typeset -gAh __P9K_COLORS
# https://jonasjacek.github.io/colors/
# use color names by default to allow dark/light themes to adjust colors based on names
__P9K_COLORS=(
black 000
red 001
green 002
yellow 003
blue 004
magenta 005
cyan 006
white 007
grey 008
maroon 009
lime 010
olive 011
navy 012
fuchsia 013
purple 013
aqua 014
teal 014
silver 015
grey0 016
navyblue 017
darkblue 018
blue3 019
blue3 020
blue1 021
darkgreen 022
deepskyblue4 023
deepskyblue4 024
deepskyblue4 025
dodgerblue3 026
dodgerblue2 027
green4 028
springgreen4 029
turquoise4 030
deepskyblue3 031
deepskyblue3 032
dodgerblue1 033
green3 034
springgreen3 035
darkcyan 036
lightseagreen 037
deepskyblue2 038
deepskyblue1 039
green3 040
springgreen3 041
springgreen2 042
cyan3 043
darkturquoise 044
turquoise2 045
green1 046
springgreen2 047
springgreen1 048
mediumspringgreen 049
cyan2 050
cyan1 051
darkred 052
deeppink4 053
purple4 054
purple4 055
purple3 056
blueviolet 057
orange4 058
grey37 059
mediumpurple4 060
slateblue3 061
slateblue3 062
royalblue1 063
chartreuse4 064
darkseagreen4 065
paleturquoise4 066
steelblue 067
steelblue3 068
cornflowerblue 069
chartreuse3 070
darkseagreen4 071
cadetblue 072
cadetblue 073
skyblue3 074
steelblue1 075
chartreuse3 076
palegreen3 077
seagreen3 078
aquamarine3 079
mediumturquoise 080
steelblue1 081
chartreuse2 082
seagreen2 083
seagreen1 084
seagreen1 085
aquamarine1 086
darkslategray2 087
darkred 088
deeppink4 089
darkmagenta 090
darkmagenta 091
darkviolet 092
purple 093
orange4 094
lightpink4 095
plum4 096
mediumpurple3 097
mediumpurple3 098
slateblue1 099
yellow4 100
wheat4 101
grey53 102
lightslategrey 103
mediumpurple 104
lightslateblue 105
yellow4 106
darkolivegreen3 107
darkseagreen 108
lightskyblue3 109
lightskyblue3 110
skyblue2 111
chartreuse2 112
darkolivegreen3 113
palegreen3 114
darkseagreen3 115
darkslategray3 116
skyblue1 117
chartreuse1 118
lightgreen 119
lightgreen 120
palegreen1 121
aquamarine1 122
darkslategray1 123
red3 124
deeppink4 125
mediumvioletred 126
magenta3 127
darkviolet 128
purple 129
darkorange3 130
indianred 131
hotpink3 132
mediumorchid3 133
mediumorchid 134
mediumpurple2 135
darkgoldenrod 136
lightsalmon3 137
rosybrown 138
grey63 139
mediumpurple2 140
mediumpurple1 141
gold3 142
darkkhaki 143
navajowhite3 144
grey69 145
lightsteelblue3 146
lightsteelblue 147
yellow3 148
darkolivegreen3 149
darkseagreen3 150
darkseagreen2 151
lightcyan3 152
lightskyblue1 153
greenyellow 154
darkolivegreen2 155
palegreen1 156
darkseagreen2 157
darkseagreen1 158
paleturquoise1 159
red3 160
deeppink3 161
deeppink3 162
magenta3 163
magenta3 164
magenta2 165
darkorange3 166
indianred 167
hotpink3 168
hotpink2 169
orchid 170
mediumorchid1 171
orange3 172
lightsalmon3 173
lightpink3 174
pink3 175
plum3 176
violet 177
gold3 178
lightgoldenrod3 179
tan 180
mistyrose3 181
thistle3 182
plum2 183
yellow3 184
khaki3 185
lightgoldenrod2 186
lightyellow3 187
grey84 188
lightsteelblue1 189
yellow2 190
darkolivegreen1 191
darkolivegreen1 192
darkseagreen1 193
honeydew2 194
lightcyan1 195
red1 196
deeppink2 197
deeppink1 198
deeppink1 199
magenta2 200
magenta1 201
orangered1 202
indianred1 203
indianred1 204
hotpink 205
hotpink 206
mediumorchid1 207
darkorange 208
salmon1 209
lightcoral 210
palevioletred1 211
orchid2 212
orchid1 213
orange1 214
sandybrown 215
lightsalmon1 216
lightpink1 217
pink1 218
plum1 219
gold1 220
lightgoldenrod2 221
lightgoldenrod2 222
navajowhite1 223
mistyrose1 224
thistle1 225
yellow1 226
lightgoldenrod1 227
khaki1 228
wheat1 229
cornsilk1 230
grey100 231
grey3 232
grey7 233
grey11 234
grey15 235
grey19 236
grey23 237
grey27 238
grey30 239
grey35 240
grey39 241
grey42 242
grey46 243
grey50 244
grey54 245
grey58 246
grey62 247
grey66 248
grey70 249
grey74 250
grey78 251
grey82 252
grey85 253
grey89 254
grey93 255
)
function termColors() {
if [[ $POWERLEVEL9K_IGNORE_TERM_COLORS == true ]]; then
return
fi
local term_colors
if which tput &>/dev/null; then
term_colors=$(tput colors)
else
term_colors=$(echotc Co)
fi
if (( ! $? && ${term_colors:-0} < 256 )); then
print -P "%F{red}WARNING!%f Your terminal appears to support fewer than 256 colors!"
print -P "If your terminal supports 256 colors, please export the appropriate environment variable"
print -P "_before_ loading this theme in your \~\/.zshrc. In most terminal emulators, putting"
print -P "%F{blue}export TERM=\"xterm-256color\"%f at the top of your \~\/.zshrc is sufficient."
fi
}
# get the proper color code if it does not exist as a name.
function getColor() {
# If Color is not numerical, try to get the color code.
if [[ "$1" != <-> ]]; then
1=$(getColorCode $1)
fi
echo -n "$1"
}
# empty paramenter resets (stops) background color
function backgroundColor() {
echo -n "%K{$(getColor $1)}"
}
# empty paramenter resets (stops) foreground color
function foregroundColor() {
echo -n "%F{$(getColor $1)}"
}
# Get numerical color codes. That way we translate ANSI codes
# into ZSH-Style color codes.
function getColorCode() {
# Early exit: Check if given value is already numerical
if [[ "$1" == <-> ]]; then
# Pad color with zeroes
echo -n "${(l:3::0:)1}"
return
fi
local colorName="${1}"
# Check if value is none with any case.
if [[ "${(L)colorName}" == "none" ]]; then
echo -n 'none'
elif [[ "${colorName}" == "foreground" ]]; then
# for testing purposes in terminal
# call via `getColorCode foreground`
for i in "${(k@)__P9K_COLORS}"; do
print -P "$(foregroundColor $i)$(getColor $i) - $i%f"
done
elif [[ "${colorName}" == "background" ]]; then
# call via `getColorCode background`
for i in "${(k@)__P9K_COLORS}"; do
print -P "$(backgroundColor $i)$(getColor $i) - $i%k"
done
else
# Strip eventual "bg-" prefixes
colorName=${colorName#bg-}
# Strip eventual "fg-" prefixes
colorName=${colorName#fg-}
# Strip eventual "br" prefixes ("bright" colors)
colorName=${colorName#br}
echo -n $__P9K_COLORS[$colorName]
fi
}
# Check if two colors are equal, even if one is specified as ANSI code.
function isSameColor() {
if [[ "$1" == "NONE" || "$2" == "NONE" ]]; then
return 1
fi
local color1=$(getColorCode "$1")
local color2=$(getColorCode "$2")
return $(( color1 != color2 ))
}

View File

@ -0,0 +1,560 @@
# vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8
################################################################
# icons
# This file holds the icon definitions and
# icon-functions for the powerlevel9k-ZSH-theme
# https://github.com/bhilburn/powerlevel9k
################################################################
# These characters require the Powerline fonts to work properly. If you see
# boxes or bizarre characters below, your fonts are not correctly installed. If
# you do not want to install a special font, you can set `POWERLEVEL9K_MODE` to
# `compatible`. This shows all icons in regular symbols.
# Initialize the icon list according to the user's `POWERLEVEL9K_MODE`.
typeset -gAH icons
case $POWERLEVEL9K_MODE in
'flat'|'awesome-patched')
# Awesome-Patched Font required! See:
# https://github.com/gabrielelana/awesome-terminal-fonts/tree/patching-strategy/patched
# Set the right locale to protect special characters
local LC_ALL="" LC_CTYPE="en_US.UTF-8"
icons=(
LEFT_SEGMENT_SEPARATOR $'\uE0B0' # 
RIGHT_SEGMENT_SEPARATOR $'\uE0B2' # 
LEFT_SEGMENT_END_SEPARATOR ' ' # Whitespace
LEFT_SUBSEGMENT_SEPARATOR $'\uE0B1' # 
RIGHT_SUBSEGMENT_SEPARATOR $'\uE0B3' # 
CARRIAGE_RETURN_ICON $'\u21B5' # ↵
ROOT_ICON $'\uE801' # 
SUDO_ICON $'\uF09C' # 
RUBY_ICON $'\uE847 ' # 
AWS_ICON $'\uE895' # 
AWS_EB_ICON $'\U1F331 ' # 🌱
BACKGROUND_JOBS_ICON $'\uE82F ' # 
TEST_ICON $'\uE891' # 
TODO_ICON $'\u2611' # ☑
BATTERY_ICON $'\uE894' # 
DISK_ICON $'\uE1AE ' # 
OK_ICON $'\u2714' # ✔
FAIL_ICON $'\u2718' # ✘
SYMFONY_ICON 'SF'
NODE_ICON $'\u2B22' # ⬢
MULTILINE_FIRST_PROMPT_PREFIX $'\u256D'$'\U2500' # ╭─
MULTILINE_NEWLINE_PROMPT_PREFIX $'\u251C'$'\U2500' # ├─
MULTILINE_LAST_PROMPT_PREFIX $'\u2570'$'\U2500 ' # ╰─
APPLE_ICON $'\uE26E' # 
WINDOWS_ICON $'\uE26F' # 
FREEBSD_ICON $'\U1F608 ' # 😈
ANDROID_ICON $'\uE270' # 
LINUX_ICON $'\uE271' # 
LINUX_ARCH_ICON $'\uE271' # 
LINUX_DEBIAN_ICON $'\uE271' # 
LINUX_UBUNTU_ICON $'\uE271' # 
LINUX_CENTOS_ICON $'\uE271' # 
LINUX_COREOS_ICON $'\uE271' # 
LINUX_ELEMENTARY_ICON $'\uE271' # 
LINUX_MINT_ICON $'\uE271' # 
LINUX_FEDORA_ICON $'\uE271' # 
LINUX_GENTOO_ICON $'\uE271' # 
LINUX_MAGEIA_ICON $'\uE271' # 
LINUX_NIXOS_ICON $'\uE271' # 
LINUX_MANJARO_ICON $'\uE271' # 
LINUX_DEVUAN_ICON $'\uE271' # 
LINUX_ALPINE_ICON $'\uE271' # 
LINUX_AOSC_ICON $'\uE271' # 
LINUX_OPENSUSE_ICON $'\uE271' # 
LINUX_SABAYON_ICON $'\uE271' # 
LINUX_SLACKWARE_ICON $'\uE271' # 
SUNOS_ICON $'\U1F31E ' # 🌞
HOME_ICON $'\uE12C' # 
HOME_SUB_ICON $'\uE18D' # 
FOLDER_ICON $'\uE818' # 
NETWORK_ICON $'\uE1AD' # 
ETC_ICON $'\uE82F' # 
LOAD_ICON $'\uE190 ' # 
SWAP_ICON $'\uE87D' # 
RAM_ICON $'\uE1E2 ' # 
SERVER_ICON $'\uE895' # 
VCS_UNTRACKED_ICON $'\uE16C' # 
VCS_UNSTAGED_ICON $'\uE17C' # 
VCS_STAGED_ICON $'\uE168' # 
VCS_STASH_ICON $'\uE133 ' # 
#VCS_INCOMING_CHANGES_ICON $'\uE1EB ' # 
#VCS_INCOMING_CHANGES_ICON $'\uE80D ' # 
VCS_INCOMING_CHANGES_ICON $'\uE131 ' # 
#VCS_OUTGOING_CHANGES_ICON $'\uE1EC ' # 
#VCS_OUTGOING_CHANGES_ICON $'\uE80E ' # 
VCS_OUTGOING_CHANGES_ICON $'\uE132 ' # 
VCS_TAG_ICON $'\uE817 ' # 
VCS_BOOKMARK_ICON $'\uE87B' # 
VCS_COMMIT_ICON $'\uE821 ' # 
VCS_BRANCH_ICON $'\uE220 ' # 
VCS_REMOTE_BRANCH_ICON $'\u2192' # →
VCS_GIT_ICON $'\uE20E ' # 
VCS_GIT_GITHUB_ICON $'\uE20E ' #
VCS_GIT_BITBUCKET_ICON $'\uE20E ' #
VCS_GIT_GITLAB_ICON $'\uE20E ' #
VCS_HG_ICON $'\uE1C3 ' # 
VCS_SVN_ICON '(svn) '
RUST_ICON '(rust)'
PYTHON_ICON $'\ue63c' # 
SWIFT_ICON ''
GO_ICON ''
PUBLIC_IP_ICON ''
LOCK_ICON $'\UE138' # 
EXECUTION_TIME_ICON $'\UE89C' # 
SSH_ICON '(ssh)'
VPN_ICON '(vpn)'
KUBERNETES_ICON $'\U2388' # ⎈
DROPBOX_ICON $'\UF16B' # 
DATE_ICON $'\uE184' # 
TIME_ICON $'\uE12E' # 
JAVA_ICON $'\U2615' # ☕︎
LARAVEL_ICON ''
)
;;
'awesome-fontconfig')
# fontconfig with awesome-font required! See
# https://github.com/gabrielelana/awesome-terminal-fonts
# Set the right locale to protect special characters
local LC_ALL="" LC_CTYPE="en_US.UTF-8"
icons=(
LEFT_SEGMENT_SEPARATOR $'\uE0B0' # 
RIGHT_SEGMENT_SEPARATOR $'\uE0B2' # 
LEFT_SEGMENT_END_SEPARATOR ' ' # Whitespace
LEFT_SUBSEGMENT_SEPARATOR $'\uE0B1' # 
RIGHT_SUBSEGMENT_SEPARATOR $'\uE0B3' # 
CARRIAGE_RETURN_ICON $'\u21B5' # ↵
ROOT_ICON $'\uF201' # 
SUDO_ICON $'\uF09C' # 
RUBY_ICON $'\uF219 ' # 
AWS_ICON $'\uF270' # 
AWS_EB_ICON $'\U1F331 ' # 🌱
BACKGROUND_JOBS_ICON $'\uF013 ' # 
TEST_ICON $'\uF291' # 
TODO_ICON $'\u2611' # ☑
BATTERY_ICON $'\U1F50B' # 🔋
DISK_ICON $'\uF0A0 ' # 
OK_ICON $'\u2714' # ✔
FAIL_ICON $'\u2718' # ✘
SYMFONY_ICON 'SF'
NODE_ICON $'\u2B22' # ⬢
MULTILINE_FIRST_PROMPT_PREFIX $'\u256D'$'\U2500' # ╭─
MULTILINE_NEWLINE_PROMPT_PREFIX $'\u251C'$'\U2500' # ├─
MULTILINE_LAST_PROMPT_PREFIX $'\u2570'$'\U2500 ' # ╰─
APPLE_ICON $'\uF179' # 
WINDOWS_ICON $'\uF17A' # 
FREEBSD_ICON $'\U1F608 ' # 😈
ANDROID_ICON $'\uE17B' # 
LINUX_ICON $'\uF17C' # 
LINUX_ARCH_ICON $'\uF17C' # 
LINUX_DEBIAN_ICON $'\uF17C' # 
LINUX_UBUNTU_ICON $'\uF17C' # 
LINUX_CENTOS_ICON $'\uF17C' # 
LINUX_COREOS_ICON $'\uF17C' # 
LINUX_ELEMENTARY_ICON $'\uF17C' # 
LINUX_MINT_ICON $'\uF17C' # 
LINUX_FEDORA_ICON $'\uF17C' # 
LINUX_GENTOO_ICON $'\uF17C' # 
LINUX_MAGEIA_ICON $'\uF17C' # 
LINUX_NIXOS_ICON $'\uF17C' # 
LINUX_MANJARO_ICON $'\uF17C' # 
LINUX_DEVUAN_ICON $'\uF17C' # 
LINUX_ALPINE_ICON $'\uF17C' # 
LINUX_AOSC_ICON $'\uF17C' # 
LINUX_OPENSUSE_ICON $'\uF17C' # 
LINUX_SABAYON_ICON $'\uF17C' # 
LINUX_SLACKWARE_ICON $'\uF17C' # 
SUNOS_ICON $'\uF185 ' # 
HOME_ICON $'\uF015' # 
HOME_SUB_ICON $'\uF07C' # 
FOLDER_ICON $'\uF115' # 
ETC_ICON $'\uF013 ' # 
NETWORK_ICON $'\uF09E' # 
LOAD_ICON $'\uF080 ' # 
SWAP_ICON $'\uF0E4' # 
RAM_ICON $'\uF0E4' # 
SERVER_ICON $'\uF233' # 
VCS_UNTRACKED_ICON $'\uF059' # 
VCS_UNSTAGED_ICON $'\uF06A' # 
VCS_STAGED_ICON $'\uF055' # 
VCS_STASH_ICON $'\uF01C ' # 
VCS_INCOMING_CHANGES_ICON $'\uF01A ' # 
VCS_OUTGOING_CHANGES_ICON $'\uF01B ' # 
VCS_TAG_ICON $'\uF217 ' # 
VCS_BOOKMARK_ICON $'\uF27B' # 
VCS_COMMIT_ICON $'\uF221 ' # 
VCS_BRANCH_ICON $'\uF126 ' # 
VCS_REMOTE_BRANCH_ICON $'\u2192' # →
VCS_GIT_ICON $'\uF1D3 ' # 
VCS_GIT_GITHUB_ICON $'\uF113 ' # 
VCS_GIT_BITBUCKET_ICON $'\uF171 ' # 
VCS_GIT_GITLAB_ICON $'\uF296 ' # 
VCS_HG_ICON $'\uF0C3 ' # 
VCS_SVN_ICON '(svn) '
RUST_ICON $'\uE6A8' # 
PYTHON_ICON $'\ue63c' # 
SWIFT_ICON ''
GO_ICON ''
PUBLIC_IP_ICON ''
LOCK_ICON $'\UF023' # 
EXECUTION_TIME_ICON $'\uF253'
SSH_ICON '(ssh)'
VPN_ICON $'\uF023'
KUBERNETES_ICON $'\U2388' # ⎈
DROPBOX_ICON $'\UF16B' # 
DATE_ICON $'\uF073 ' # 
TIME_ICON $'\uF017 ' # 
JAVA_ICON $'\U2615' # ☕︎
LARAVEL_ICON ''
)
;;
'awesome-mapped-fontconfig')
# mapped fontconfig with awesome-font required! See
# https://github.com/gabrielelana/awesome-terminal-fonts
# don't forget to source the font maps in your startup script
# Set the right locale to protect special characters
local LC_ALL="" LC_CTYPE="en_US.UTF-8"
if [ -z "$AWESOME_GLYPHS_LOADED" ]; then
echo "Powerlevel9k warning: Awesome-Font mappings have not been loaded.
Source a font mapping in your shell config, per the Awesome-Font docs
(https://github.com/gabrielelana/awesome-terminal-fonts),
Or use a different Powerlevel9k font configuration.";
fi
icons=(
LEFT_SEGMENT_SEPARATOR $'\uE0B0' # 
RIGHT_SEGMENT_SEPARATOR $'\uE0B2' # 
LEFT_SEGMENT_END_SEPARATOR ' ' # Whitespace
LEFT_SUBSEGMENT_SEPARATOR $'\uE0B1' # 
RIGHT_SUBSEGMENT_SEPARATOR $'\uE0B3' # 
CARRIAGE_RETURN_ICON $'\u21B5' # ↵
ROOT_ICON '\u'$CODEPOINT_OF_OCTICONS_ZAP # 
SUDO_ICON '\u'$CODEPOINT_OF_AWESOME_UNLOCK # 
RUBY_ICON '\u'$CODEPOINT_OF_OCTICONS_RUBY' ' # 
AWS_ICON '\u'$CODEPOINT_OF_AWESOME_SERVER # 
AWS_EB_ICON $'\U1F331 ' # 🌱
BACKGROUND_JOBS_ICON '\u'$CODEPOINT_OF_AWESOME_COG' ' # 
TEST_ICON '\u'$CODEPOINT_OF_AWESOME_BUG # 
TODO_ICON '\u'$CODEPOINT_OF_AWESOME_CHECK_SQUARE_O # 
BATTERY_ICON '\U'$CODEPOINT_OF_AWESOME_BATTERY_FULL # 
DISK_ICON '\u'$CODEPOINT_OF_AWESOME_HDD_O' ' # 
OK_ICON '\u'$CODEPOINT_OF_AWESOME_CHECK # 
FAIL_ICON '\u'$CODEPOINT_OF_AWESOME_TIMES # 
SYMFONY_ICON 'SF'
NODE_ICON $'\u2B22' # ⬢
MULTILINE_FIRST_PROMPT_PREFIX $'\u256D'$'\U2500' # ╭─
MULTILINE_SECOND_PROMPT_PREFIX $'\u2570'$'\U2500 ' # ╰─
APPLE_ICON '\u'$CODEPOINT_OF_AWESOME_APPLE # 
FREEBSD_ICON $'\U1F608 ' # 😈
LINUX_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX # 
LINUX_ARCH_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX # 
LINUX_DEBIAN_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX # 
LINUX_UBUNTU_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX # 
LINUX_CENTOS_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX # 
LINUX_COREOS_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX # 
LINUX_ELEMENTARY_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX # 
LINUX_MINT_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX # 
LINUX_FEDORA_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX # 
LINUX_GENTOO_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX # 
LINUX_MAGEIA_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX # 
LINUX_NIXOS_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX # 
LINUX_MANJARO_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX # 
LINUX_DEVUAN_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX # 
LINUX_ALPINE_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX # 
LINUX_AOSC_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX # 
LINUX_OPENSUSE_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX # 
LINUX_SABAYON_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX # 
LINUX_SLACKWARE_ICON '\u'$CODEPOINT_OF_AWESOME_LINUX # 
SUNOS_ICON '\u'$CODEPOINT_OF_AWESOME_SUN_O' ' # 
HOME_ICON '\u'$CODEPOINT_OF_AWESOME_HOME # 
HOME_SUB_ICON '\u'$CODEPOINT_OF_AWESOME_FOLDER_OPEN # 
FOLDER_ICON '\u'$CODEPOINT_OF_AWESOME_FOLDER_O # 
ETC_ICON '\u'$CODEPOINT_OF_AWESOME_COG' ' # 
NETWORK_ICON '\u'$CODEPOINT_OF_AWESOME_RSS # 
LOAD_ICON '\u'$CODEPOINT_OF_AWESOME_BAR_CHART' ' # 
SWAP_ICON '\u'$CODEPOINT_OF_AWESOME_DASHBOARD # 
RAM_ICON '\u'$CODEPOINT_OF_AWESOME_DASHBOARD # 
SERVER_ICON '\u'$CODEPOINT_OF_AWESOME_SERVER # 
VCS_UNTRACKED_ICON '\u'$CODEPOINT_OF_AWESOME_QUESTION_CIRCLE # 
VCS_UNSTAGED_ICON '\u'$CODEPOINT_OF_AWESOME_EXCLAMATION_CIRCLE # 
VCS_STAGED_ICON '\u'$CODEPOINT_OF_AWESOME_PLUS_CIRCLE # 
VCS_STASH_ICON '\u'$CODEPOINT_OF_AWESOME_INBOX' ' # 
VCS_INCOMING_CHANGES_ICON '\u'$CODEPOINT_OF_AWESOME_ARROW_CIRCLE_DOWN' ' # 
VCS_OUTGOING_CHANGES_ICON '\u'$CODEPOINT_OF_AWESOME_ARROW_CIRCLE_UP' ' # 
VCS_TAG_ICON '\u'$CODEPOINT_OF_AWESOME_TAG' ' # 
VCS_BOOKMARK_ICON '\u'$CODEPOINT_OF_OCTICONS_BOOKMARK # 
VCS_COMMIT_ICON '\u'$CODEPOINT_OF_OCTICONS_GIT_COMMIT' ' # 
VCS_BRANCH_ICON '\u'$CODEPOINT_OF_OCTICONS_GIT_BRANCH' ' # 
VCS_REMOTE_BRANCH_ICON '\u'$CODEPOINT_OF_OCTICONS_REPO_PUSH # 
VCS_GIT_ICON '\u'$CODEPOINT_OF_AWESOME_GIT' ' # 
VCS_GIT_GITHUB_ICON '\u'$CODEPOINT_OF_AWESOME_GITHUB_ALT' ' # 
VCS_GIT_BITBUCKET_ICON '\u'$CODEPOINT_OF_AWESOME_BITBUCKET' ' # 
VCS_GIT_GITLAB_ICON '\u'$CODEPOINT_OF_AWESOME_GITLAB' ' # 
VCS_HG_ICON '\u'$CODEPOINT_OF_AWESOME_FLASK' ' # 
VCS_SVN_ICON '(svn) '
RUST_ICON $'\uE6A8' # 
PYTHON_ICON $'\U1F40D' # 🐍
SWIFT_ICON $'\uE655' # 
PUBLIC_IP_ICON '\u'$CODEPOINT_OF_AWESOME_GLOBE # 
LOCK_ICON '\u'$CODEPOINT_OF_AWESOME_LOCK # 
EXECUTION_TIME_ICON '\u'$CODEPOINT_OF_AWESOME_HOURGLASS_END # 
SSH_ICON '(ssh)'
VPN_ICON '\u'$CODEPOINT_OF_AWESOME_LOCK
KUBERNETES_ICON $'\U2388' # ⎈
DROPBOX_ICON '\u'$CODEPOINT_OF_AWESOME_DROPBOX # 
DATE_ICON $'\uF073 ' # 
TIME_ICON $'\uF017 ' # 
JAVA_ICON $'\U2615' # ☕︎
LARAVEL_ICON ''
)
;;
'nerdfont-complete'|'nerdfont-fontconfig')
# nerd-font patched (complete) font required! See
# https://github.com/ryanoasis/nerd-fonts
# http://nerdfonts.com/#cheat-sheet
# Set the right locale to protect special characters
local LC_ALL="" LC_CTYPE="en_US.UTF-8"
icons=(
LEFT_SEGMENT_SEPARATOR $'\uE0B0' # 
RIGHT_SEGMENT_SEPARATOR $'\uE0B2' # 
LEFT_SEGMENT_END_SEPARATOR ' ' # Whitespace
LEFT_SUBSEGMENT_SEPARATOR $'\uE0B1' # 
RIGHT_SUBSEGMENT_SEPARATOR $'\uE0B3' # 
CARRIAGE_RETURN_ICON $'\u21B5' # ↵
ROOT_ICON $'\uE614 ' # 
SUDO_ICON $'\uF09C' # 
RUBY_ICON $'\uF219 ' # 
AWS_ICON $'\uF270' # 
AWS_EB_ICON $'\UF1BD ' # 
BACKGROUND_JOBS_ICON $'\uF013 ' # 
TEST_ICON $'\uF188' # 
TODO_ICON $'\uF133' # 
BATTERY_ICON $'\UF240 ' # 
DISK_ICON $'\uF0A0' # 
OK_ICON $'\uF00C' # 
FAIL_ICON $'\uF00D' # 
SYMFONY_ICON $'\uE757' # 
NODE_ICON $'\uE617 ' # 
MULTILINE_FIRST_PROMPT_PREFIX $'\u256D'$'\U2500' # ╭─
MULTILINE_NEWLINE_PROMPT_PREFIX $'\u251C'$'\U2500' # ├─
MULTILINE_LAST_PROMPT_PREFIX $'\u2570'$'\U2500 ' # ╰─
APPLE_ICON $'\uF179' # 
WINDOWS_ICON $'\uF17A' # 
FREEBSD_ICON $'\UF30C ' # 
ANDROID_ICON $'\uF17B' # 
LINUX_ARCH_ICON $'\uF303' # 
LINUX_CENTOS_ICON $'\uF304' # 
LINUX_COREOS_ICON $'\uF305' # 
LINUX_DEBIAN_ICON $'\uF306' # 
LINUX_ELEMENTARY_ICON $'\uF309' # 
LINUX_FEDORA_ICON $'\uF30a' # 
LINUX_GENTOO_ICON $'\uF30d' # 
LINUX_MAGEIA_ICON $'\uF310' # 
LINUX_MINT_ICON $'\uF30e' # 
LINUX_NIXOS_ICON $'\uF313' # 
LINUX_MANJARO_ICON $'\uF312' # 
LINUX_DEVUAN_ICON $'\uF307' # 
LINUX_ALPINE_ICON $'\uF300' # 
LINUX_AOSC_ICON $'\uF301' # 
LINUX_OPENSUSE_ICON $'\uF314' # 
LINUX_SABAYON_ICON $'\uF317' # 
LINUX_SLACKWARE_ICON $'\uF319' # 
LINUX_UBUNTU_ICON $'\uF31b' # 
LINUX_ICON $'\uF17C' # 
SUNOS_ICON $'\uF185 ' # 
HOME_ICON $'\uF015' # 
HOME_SUB_ICON $'\uF07C' # 
FOLDER_ICON $'\uF115' # 
ETC_ICON $'\uF013' # 
NETWORK_ICON $'\uF1EB' # 
LOAD_ICON $'\uF080 ' # 
SWAP_ICON $'\uF464' # 
RAM_ICON $'\uF0E4' # 
SERVER_ICON $'\uF0AE' # 
VCS_UNTRACKED_ICON $'\uF059' # 
VCS_UNSTAGED_ICON $'\uF06A' # 
VCS_STAGED_ICON $'\uF055' # 
VCS_STASH_ICON $'\uF01C ' # 
VCS_INCOMING_CHANGES_ICON $'\uF01A ' # 
VCS_OUTGOING_CHANGES_ICON $'\uF01B ' # 
VCS_TAG_ICON $'\uF02B ' # 
VCS_BOOKMARK_ICON $'\uF461 ' # 
VCS_COMMIT_ICON $'\uE729 ' # 
VCS_BRANCH_ICON $'\uF126 ' # 
VCS_REMOTE_BRANCH_ICON $'\uE728 ' # 
VCS_GIT_ICON $'\uF1D3 ' # 
VCS_GIT_GITHUB_ICON $'\uF113 ' # 
VCS_GIT_BITBUCKET_ICON $'\uE703 ' # 
VCS_GIT_GITLAB_ICON $'\uF296 ' # 
VCS_HG_ICON $'\uF0C3 ' # 
VCS_SVN_ICON $'\uE72D ' # 
RUST_ICON $'\uE7A8 ' # 
PYTHON_ICON $'\UE73C ' # 
SWIFT_ICON $'\uE755' # 
GO_ICON $'\uE626' # 
PUBLIC_IP_ICON $'\UF0AC' # 
LOCK_ICON $'\UF023' # 
EXECUTION_TIME_ICON $'\uF252' # 
SSH_ICON $'\uF489' # 
VPN_ICON '(vpn)'
KUBERNETES_ICON $'\U2388' # ⎈
DROPBOX_ICON $'\UF16B' # 
DATE_ICON $'\uF073 ' # 
TIME_ICON $'\uF017 ' # 
JAVA_ICON $'\U2615' # ☕︎
LARAVEL_ICON $'\ue73f ' # 
)
;;
*)
# Powerline-Patched Font required!
# See https://github.com/Lokaltog/powerline-fonts
# Set the right locale to protect special characters
local LC_ALL="" LC_CTYPE="en_US.UTF-8"
icons=(
LEFT_SEGMENT_SEPARATOR $'\uE0B0' # 
RIGHT_SEGMENT_SEPARATOR $'\uE0B2' # 
LEFT_SEGMENT_END_SEPARATOR ' ' # Whitespace
LEFT_SUBSEGMENT_SEPARATOR $'\uE0B1' # 
RIGHT_SUBSEGMENT_SEPARATOR $'\uE0B3' # 
CARRIAGE_RETURN_ICON $'\u21B5' # ↵
ROOT_ICON $'\u26A1' # ⚡
SUDO_ICON $'\uE0A2' # 
RUBY_ICON ''
AWS_ICON 'AWS:'
AWS_EB_ICON $'\U1F331 ' # 🌱
BACKGROUND_JOBS_ICON $'\u2699' # ⚙
TEST_ICON ''
TODO_ICON $'\u2611' # ☑
BATTERY_ICON $'\U1F50B' # 🔋
DISK_ICON $'hdd '
OK_ICON $'\u2714' # ✔
FAIL_ICON $'\u2718' # ✘
SYMFONY_ICON 'SF'
NODE_ICON $'\u2B22' # ⬢
MULTILINE_FIRST_PROMPT_PREFIX $'\u256D'$'\U2500' # ╭─
MULTILINE_NEWLINE_PROMPT_PREFIX $'\u251C'$'\U2500' # ├─
MULTILINE_LAST_PROMPT_PREFIX $'\u2570'$'\U2500 ' # ╰─
APPLE_ICON 'OSX'
WINDOWS_ICON 'WIN'
FREEBSD_ICON 'BSD'
ANDROID_ICON 'And'
LINUX_ICON 'Lx'
LINUX_ARCH_ICON 'Arc'
LINUX_DEBIAN_ICON 'Deb'
LINUX_UBUNTU_ICON 'Ubu'
LINUX_CENTOS_ICON 'Cen'
LINUX_COREOS_ICON 'Cor'
LINUX_ELEMENTARY_ICON 'Elm'
LINUX_MINT_ICON 'LMi'
LINUX_FEDORA_ICON 'Fed'
LINUX_GENTOO_ICON 'Gen'
LINUX_MAGEIA_ICON 'Mag'
LINUX_NIXOS_ICON 'Nix'
LINUX_MANJARO_ICON 'Man'
LINUX_DEVUAN_ICON 'Dev'
LINUX_ALPINE_ICON 'Alp'
LINUX_AOSC_ICON 'Aos'
LINUX_OPENSUSE_ICON 'OSu'
LINUX_SABAYON_ICON 'Sab'
LINUX_SLACKWARE_ICON 'Sla'
SUNOS_ICON 'Sun'
HOME_ICON ''
HOME_SUB_ICON ''
FOLDER_ICON ''
ETC_ICON $'\u2699' # ⚙
NETWORK_ICON 'IP'
LOAD_ICON 'L'
SWAP_ICON 'SWP'
RAM_ICON 'RAM'
SERVER_ICON ''
VCS_UNTRACKED_ICON '?'
VCS_UNSTAGED_ICON $'\u25CF' # ●
VCS_STAGED_ICON $'\u271A' # ✚
VCS_STASH_ICON $'\u235F' # ⍟
VCS_INCOMING_CHANGES_ICON $'\u2193' # ↓
VCS_OUTGOING_CHANGES_ICON $'\u2191' # ↑
VCS_TAG_ICON ''
VCS_BOOKMARK_ICON $'\u263F' # ☿
VCS_COMMIT_ICON ''
VCS_BRANCH_ICON $'\uE0A0 ' # 
VCS_REMOTE_BRANCH_ICON $'\u2192' # →
VCS_GIT_ICON ''
VCS_GIT_GITHUB_ICON ''
VCS_GIT_BITBUCKET_ICON ''
VCS_GIT_GITLAB_ICON ''
VCS_HG_ICON ''
VCS_SVN_ICON ''
RUST_ICON 'Rust'
PYTHON_ICON ''
SWIFT_ICON 'Swift'
GO_ICON 'Go'
PUBLIC_IP_ICON ''
LOCK_ICON $'\UE0A2'
EXECUTION_TIME_ICON 'Dur'
SSH_ICON '(ssh)'
VPN_ICON '(vpn)'
KUBERNETES_ICON $'\U2388' # ⎈
DROPBOX_ICON 'Dropbox'
DATE_ICON ''
TIME_ICON ''
JAVA_ICON $'\U2615' # ☕︎
LARAVEL_ICON ''
)
;;
esac
# Override the above icon settings with any user-defined variables.
case $POWERLEVEL9K_MODE in
'flat')
# Set the right locale to protect special characters
local LC_ALL="" LC_CTYPE="en_US.UTF-8"
icons[LEFT_SEGMENT_SEPARATOR]=''
icons[RIGHT_SEGMENT_SEPARATOR]=''
icons[LEFT_SUBSEGMENT_SEPARATOR]='|'
icons[RIGHT_SUBSEGMENT_SEPARATOR]='|'
;;
'compatible')
# Set the right locale to protect special characters
local LC_ALL="" LC_CTYPE="en_US.UTF-8"
icons[LEFT_SEGMENT_SEPARATOR]=$'\u2B80' # ⮀
icons[RIGHT_SEGMENT_SEPARATOR]=$'\u2B82' # ⮂
icons[VCS_BRANCH_ICON]='@'
;;
esac
if [[ "$POWERLEVEL9K_HIDE_BRANCH_ICON" == true ]]; then
icons[VCS_BRANCH_ICON]=''
fi
# 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}
if defined "$ICON_USER_VARIABLE"; then
echo -n "${(P)ICON_USER_VARIABLE}"
else
echo -n "${icons[$icon_name]}"
fi
}
# Get a list of configured icons
# * $1 string - If "original", then the original icons are printed,
# otherwise "print_icon" is used, which takes the users
# overrides into account.
get_icon_names() {
# Iterate over a ordered list of keys of the icons array
for key in ${(@kon)icons}; do
echo -n "POWERLEVEL9K_$key: "
if [[ "${1}" == "original" ]]; then
# print the original icons as they are defined in the array above
echo "${icons[$key]}"
else
# print the icons as they are configured by the user
echo "$(print_icon "$key")"
fi
done
}

View File

@ -0,0 +1,373 @@
# vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8
################################################################
# Utility functions
# This file holds some utility-functions for
# the powerlevel9k-ZSH-theme
# https://github.com/bhilburn/powerlevel9k
################################################################
# Exits with 0 if a variable has been previously defined (even if empty)
# Takes the name of a variable that should be checked.
function defined() {
[[ ! -z "${(tP)1}" ]]
}
# Given the name of a variable and a default value, sets the variable
# value to the default only if it has not been defined.
#
# Typeset cannot set the value for an array, so this will only work
# for scalar values.
function set_default() {
local varname="$1"
local default_value="$2"
defined "$varname" || typeset -g "$varname"="$default_value"
}
# Converts large memory values into a human-readable unit (e.g., bytes --> GB)
# Takes two arguments:
# * $size - The number which should be prettified
# * $base - The base of the number (default Bytes)
printSizeHumanReadable() {
typeset -F 2 size
size="$1"+0.00001
local extension
extension=('B' 'K' 'M' 'G' 'T' 'P' 'E' 'Z' 'Y')
local index=1
# if the base is not Bytes
if [[ -n $2 ]]; then
local idx
for idx in "${extension[@]}"; do
if [[ "$2" == "$idx" ]]; then
break
fi
index=$(( index + 1 ))
done
fi
while (( (size / 1024) > 0.1 )); do
size=$(( size / 1024 ))
index=$(( index + 1 ))
done
echo "$size${extension[$index]}"
}
# Gets the first value out of a list of items that is not empty.
# The items are examined by a callback-function.
# Takes two arguments:
# * $list - A list of items
# * $callback - A callback function to examine if the item is
# worthy. The callback function has access to
# the inner variable $item.
function getRelevantItem() {
local -a list
local callback
# Explicitly split the elements by whitespace.
list=(${=1})
callback=$2
for item in $list; do
# The first non-empty item wins
try=$(eval "$callback")
if [[ -n "$try" ]]; then
echo "$try"
break;
fi
done
}
# OS detection
case $(uname) in
Darwin)
OS='OSX'
OS_ICON=$(print_icon 'APPLE_ICON')
;;
CYGWIN_NT-* | MSYS_NT-*)
OS='Windows'
OS_ICON=$(print_icon 'WINDOWS_ICON')
;;
FreeBSD)
OS='BSD'
OS_ICON=$(print_icon 'FREEBSD_ICON')
;;
OpenBSD)
OS='BSD'
OS_ICON=$(print_icon 'FREEBSD_ICON')
;;
DragonFly)
OS='BSD'
OS_ICON=$(print_icon 'FREEBSD_ICON')
;;
Linux)
OS='Linux'
os_release_id="$(grep -E '^ID=([a-zA-Z]*)' /etc/os-release | cut -d '=' -f 2)"
case "$os_release_id" in
*arch*)
OS_ICON=$(print_icon 'LINUX_ARCH_ICON')
;;
*debian*)
OS_ICON=$(print_icon 'LINUX_DEBIAN_ICON')
;;
*ubuntu*)
OS_ICON=$(print_icon 'LINUX_UBUNTU_ICON')
;;
*elementary*)
OS_ICON=$(print_icon 'LINUX_ELEMENTARY_ICON')
;;
*fedora*)
OS_ICON=$(print_icon 'LINUX_FEDORA_ICON')
;;
*coreos*)
OS_ICON=$(print_icon 'LINUX_COREOS_ICON')
;;
*gentoo*)
OS_ICON=$(print_icon 'LINUX_GENTOO_ICON')
;;
*mageia*)
OS_ICON=$(print_icon 'LINUX_MAGEIA_ICON')
;;
*centos*)
OS_ICON=$(print_icon 'LINUX_CENTOS_ICON')
;;
*opensuse*|*tumbleweed*)
OS_ICON=$(print_icon 'LINUX_OPENSUSE_ICON')
;;
*sabayon*)
OS_ICON=$(print_icon 'LINUX_SABAYON_ICON')
;;
*slackware*)
OS_ICON=$(print_icon 'LINUX_SLACKWARE_ICON')
;;
*linuxmint*)
OS_ICON=$(print_icon 'LINUX_MINT_ICON')
;;
*alpine*)
OS_ICON=$(print_icon 'LINUX_ALPINE_ICON')
;;
*aosc*)
OS_ICON=$(print_icon 'LINUX_AOSC_ICON')
;;
*nixos*)
OS_ICON=$(print_icon 'LINUX_NIXOS_ICON')
;;
*devuan*)
OS_ICON=$(print_icon 'LINUX_DEVUAN_ICON')
;;
*manjaro*)
OS_ICON=$(print_icon 'LINUX_MANJARO_ICON')
;;
*)
OS='Linux'
OS_ICON=$(print_icon 'LINUX_ICON')
;;
esac
# Check if we're running on Android
case $(uname -o 2>/dev/null) in
Android)
OS='Android'
OS_ICON=$(print_icon 'ANDROID_ICON')
;;
esac
;;
SunOS)
OS='Solaris'
OS_ICON=$(print_icon 'SUNOS_ICON')
;;
*)
OS=''
OS_ICON=''
;;
esac
# Determine the correct sed parameter.
#
# `sed` is unfortunately not consistent across OSes when it comes to flags.
SED_EXTENDED_REGEX_PARAMETER="-r"
if [[ "$OS" == 'OSX' ]]; then
local IS_BSD_SED="$(sed --version &>> /dev/null || echo "BSD sed")"
if [[ -n "$IS_BSD_SED" ]]; then
SED_EXTENDED_REGEX_PARAMETER="-E"
fi
fi
# Determine if the passed segment is used in the prompt
#
# Pass the name of the segment to this function to test for its presence in
# either the LEFT or RIGHT prompt arrays.
# * $1: The segment to be tested.
segment_in_use() {
local key=$1
if [[ -n "${POWERLEVEL9K_LEFT_PROMPT_ELEMENTS[(r)$key]}" ]] || [[ -n "${POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS[(r)$key]}" ]]; then
return 0
else
return 1
fi
}
# Print a deprecation warning if an old segment is in use.
# Takes the name of an associative array that contains the
# deprecated segments as keys, the values contain the new
# segment names.
print_deprecation_warning() {
typeset -AH raw_deprecated_segments
raw_deprecated_segments=(${(kvP@)1})
for key in ${(@k)raw_deprecated_segments}; do
if segment_in_use $key; then
# segment is deprecated
print -P "%F{yellow}Warning!%f The '$key' segment is deprecated. Use '%F{blue}${raw_deprecated_segments[$key]}%f' instead. For more informations, have a look at the CHANGELOG.md."
fi
done
}
# A helper function to determine if a segment should be
# joined or promoted to a full one.
# Takes three arguments:
# * $1: The array index of the current segment
# * $2: The array index of the last printed segment
# * $3: The array of segments of the left or right prompt
function segmentShouldBeJoined() {
local current_index=$1
local last_segment_index=$2
# Explicitly split the elements by whitespace.
local -a elements
elements=(${=3})
local current_segment=${elements[$current_index]}
local joined=false
if [[ ${current_segment[-7,-1]} == '_joined' ]]; then
joined=true
# promote segment to a full one, if the predecessing full segment
# was conditional. So this can only be the case for segments that
# are not our direct predecessor.
if (( $(($current_index - $last_segment_index)) > 1)); then
# Now we have to examine every previous segment, until we reach
# the last printed one (found by its index). This is relevant if
# all previous segments are joined. Then we want to join our
# segment as well.
local examined_index=$((current_index - 1))
while (( $examined_index > $last_segment_index )); do
local previous_segment=${elements[$examined_index]}
# If one of the examined segments is not joined, then we know
# that the current segment should not be joined, as the target
# segment is the wrong one.
if [[ ${previous_segment[-7,-1]} != '_joined' ]]; then
joined=false
break
fi
examined_index=$((examined_index - 1))
done
fi
fi
# Return 1 means error; return 0 means no error. So we have
# to invert $joined
if [[ "$joined" == "true" ]]; then
return 0
else
return 1
fi
}
################################################################
# Given a directory path, truncate it according to the settings.
# Parameters:
# * $1 Path: string - the directory path to be truncated
# * $2 Length: integer - length to truncate to
# * $3 Delimiter: string - the delimiter to use
# * $4 From: string - "right" | "middle". If omited, assumes right.
function truncatePath() {
# if the current path is not 1 character long (e.g. "/" or "~")
if (( ${#1} > 1 )); then
# convert $2 from string to integer
2=$(( $2 ))
# set $3 to "" if not defined
[[ -z $3 ]] && 3="" || 3=$(echo -n $3)
# set $4 to "right" if not defined
[[ -z $4 ]] && 4="right"
# create a variable for the truncated path.
local trunc_path
# if the path is in the home folder, add "~/" to the start otherwise "/"
[[ $1 == "~"* ]] && trunc_path='~/' || trunc_path='/'
# split the path into an array using "/" as the delimiter
local paths=$1
paths=(${(s:/:)${paths//"~\/"/}})
# declare locals for the directory being tested and its length
local test_dir test_dir_length
# do the needed truncation
case $4 in
right)
# include the delimiter length in the threshhold
local threshhold=$(( $2 + ${#3} ))
# loop through the paths
for (( i=1; i<${#paths}; i++ )); do
# get the current directory value
test_dir=$paths[$i]
test_dir_length=${#test_dir}
# only truncate if the resulting truncation will be shorter than
# the truncation + delimiter length and at least 3 characters
if (( $test_dir_length > $threshhold )) && (( $test_dir_length > 3 )); then
# use the first $2 characters and the delimiter
trunc_path+="${test_dir:0:$2}$3/"
else
# use the full path
trunc_path+="${test_dir}/"
fi
done
;;
middle)
# we need double the length for start and end truncation + delimiter length
local threshhold=$(( $2 * 2 ))
# create a variable for the start of the end truncation
local last_pos
# loop through the paths
for (( i=1; i<${#paths}; i++ )); do
# get the current directory value
test_dir=$paths[$i]
test_dir_length=${#test_dir}
# only truncate if the resulting truncation will be shorter than
# the truncation + delimiter length
if (( $test_dir_length > $threshhold )); then
# use the first $2 characters, the delimiter and the last $2 characters
last_pos=$(( $test_dir_length - $2 ))
trunc_path+="${test_dir:0:$2}$3${test_dir:$last_pos:$test_dir_length}/"
else
# use the full path
trunc_path+="${test_dir}/"
fi
done
;;
esac
# return the truncated path + the current directory
echo $trunc_path${1:t}
else # current path is 1 character long (e.g. "/" or "~")
echo $1
fi
}
# Given a directory path, truncate it according to the settings for
# `truncate_from_right`
function truncatePathFromRight() {
local delim_len=${#POWERLEVEL9K_SHORTEN_DELIMITER:-1}
echo $1 | sed $SED_EXTENDED_REGEX_PARAMETER \
"s@(([^/]{$((POWERLEVEL9K_SHORTEN_DIR_LENGTH))})([^/]{$delim_len}))[^/]+/@\2$POWERLEVEL9K_SHORTEN_DELIMITER/@g"
}
# Search recursively in parent folders for given file.
function upsearch () {
if [[ "$PWD" == "$HOME" || "$PWD" == "/" ]]; then
echo "$PWD"
elif test -e "$1"; then
pushd .. > /dev/null
upsearch "$1"
popd > /dev/null
echo "$PWD"
else
pushd .. > /dev/null
upsearch "$1"
popd > /dev/null
fi
}

View File

@ -0,0 +1,169 @@
# vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8
################################################################
# vcs
# This file holds supplemental VCS functions
# for the powerlevel9k-ZSH-theme
# https://github.com/bhilburn/powerlevel9k
################################################################
set_default POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY true
function +vi-git-untracked() {
# TODO: check git >= 1.7.2 - see function git_compare_version()
local FLAGS
FLAGS=('--porcelain')
if [[ "$POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY" == "false" ]]; then
FLAGS+='--ignore-submodules=dirty'
fi
if [[ $(command git rev-parse --is-inside-work-tree 2> /dev/null) == 'true' && \
-n $(command git status ${FLAGS} | \grep -E '^\?\?' 2> /dev/null | tail -n1) ]]; then
hook_com[unstaged]+=" $(print_icon 'VCS_UNTRACKED_ICON')"
VCS_WORKDIR_HALF_DIRTY=true
else
VCS_WORKDIR_HALF_DIRTY=false
fi
}
function +vi-git-aheadbehind() {
local ahead behind branch_name
local -a gitstatus
branch_name=$(command git symbolic-ref --short HEAD 2>/dev/null)
# for git prior to 1.7
# ahead=$(command git rev-list origin/${branch_name}..HEAD | wc -l)
ahead=$(command git rev-list "${branch_name}"@{upstream}..HEAD 2>/dev/null | wc -l)
(( ahead )) && gitstatus+=( " $(print_icon 'VCS_OUTGOING_CHANGES_ICON')${ahead// /}" )
# for git prior to 1.7
# behind=$(command git rev-list HEAD..origin/${branch_name} | wc -l)
behind=$(command git rev-list HEAD.."${branch_name}"@{upstream} 2>/dev/null | wc -l)
(( behind )) && gitstatus+=( " $(print_icon 'VCS_INCOMING_CHANGES_ICON')${behind// /}" )
hook_com[misc]+=${(j::)gitstatus}
}
function +vi-git-remotebranch() {
local remote branch_name
# Are we on a remote-tracking branch?
remote=${$(command git rev-parse --verify HEAD@{upstream} --symbolic-full-name 2>/dev/null)/refs\/(remotes|heads)\/}
branch_name=$(command git symbolic-ref --short HEAD 2>/dev/null)
if [[ -n "$POWERLEVEL9K_VCS_SHORTEN_LENGTH" ]] && [[ -n "$POWERLEVEL9K_VCS_SHORTEN_MIN_LENGTH" ]]; then
set_default POWERLEVEL9K_VCS_SHORTEN_DELIMITER $'\U2026'
if [ ${#hook_com[branch]} -gt $POWERLEVEL9K_VCS_SHORTEN_MIN_LENGTH ] && [ ${#hook_com[branch]} -gt $POWERLEVEL9K_VCS_SHORTEN_LENGTH ]; then
case "$POWERLEVEL9K_VCS_SHORTEN_STRATEGY" in
truncate_middle)
hook_com[branch]="$(echo "${branch_name:0:$POWERLEVEL9K_VCS_SHORTEN_LENGTH}")$POWERLEVEL9K_VCS_SHORTEN_DELIMITER$(echo "${branch_name: -$POWERLEVEL9K_VCS_SHORTEN_LENGTH}")"
;;
truncate_from_right)
hook_com[branch]="$(echo "${branch_name:0:$POWERLEVEL9K_VCS_SHORTEN_LENGTH}")$POWERLEVEL9K_VCS_SHORTEN_DELIMITER"
;;
esac
fi
fi
hook_com[branch]="$(print_icon 'VCS_BRANCH_ICON')${hook_com[branch]}"
# Always show the remote
#if [[ -n ${remote} ]] ; then
# Only show the remote if it differs from the local
if [[ -n ${remote} ]] && [[ "${remote#*/}" != "${branch_name}" ]] ; then
hook_com[branch]+="$(print_icon 'VCS_REMOTE_BRANCH_ICON')${remote// /}"
fi
}
set_default POWERLEVEL9K_VCS_HIDE_TAGS false
function +vi-git-tagname() {
if [[ "$POWERLEVEL9K_VCS_HIDE_TAGS" == "false" ]]; then
# If we are on a tag, append the tagname to the current branch string.
local tag
tag=$(command git describe --tags --exact-match HEAD 2>/dev/null)
if [[ -n "${tag}" ]] ; then
# There is a tag that points to our current commit. Need to determine if we
# are also on a branch, or are in a DETACHED_HEAD state.
if [[ -z $(command git symbolic-ref HEAD 2>/dev/null) ]]; then
# DETACHED_HEAD state. We want to append the tag name to the commit hash
# and print it. Unfortunately, `vcs_info` blows away the hash when a tag
# exists, so we have to manually retrieve it and clobber the branch
# string.
local revision
revision=$(command git rev-list -n 1 --abbrev-commit --abbrev=${POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH} HEAD)
hook_com[branch]="$(print_icon 'VCS_BRANCH_ICON')${revision} $(print_icon 'VCS_TAG_ICON')${tag}"
else
# We are on both a tag and a branch; print both by appending the tag name.
hook_com[branch]+=" $(print_icon 'VCS_TAG_ICON')${tag}"
fi
fi
fi
}
# Show count of stashed changes
# Port from https://github.com/whiteinge/dotfiles/blob/5dfd08d30f7f2749cfc60bc55564c6ea239624d9/.zsh_shouse_prompt#L268
function +vi-git-stash() {
local -a stashes
if [[ -s $(command git rev-parse --git-dir)/refs/stash ]] ; then
stashes=$(command git stash list 2>/dev/null | wc -l)
hook_com[misc]+=" $(print_icon 'VCS_STASH_ICON')${stashes// /}"
fi
}
function +vi-hg-bookmarks() {
if [[ -n "${hgbmarks[@]}" ]]; then
hook_com[hg-bookmark-string]=" $(print_icon 'VCS_BOOKMARK_ICON')${hgbmarks[@]}"
# To signal that we want to use the sting we just generated, set the special
# variable `ret' to something other than the default zero:
ret=1
return 0
fi
}
function +vi-vcs-detect-changes() {
if [[ "${hook_com[vcs]}" == "git" ]]; then
local remote=$(command git ls-remote --get-url 2> /dev/null)
if [[ "$remote" =~ "github" ]] then
vcs_visual_identifier='VCS_GIT_GITHUB_ICON'
elif [[ "$remote" =~ "bitbucket" ]] then
vcs_visual_identifier='VCS_GIT_BITBUCKET_ICON'
elif [[ "$remote" =~ "stash" ]] then
vcs_visual_identifier='VCS_GIT_BITBUCKET_ICON'
elif [[ "$remote" =~ "gitlab" ]] then
vcs_visual_identifier='VCS_GIT_GITLAB_ICON'
else
vcs_visual_identifier='VCS_GIT_ICON'
fi
elif [[ "${hook_com[vcs]}" == "hg" ]]; then
vcs_visual_identifier='VCS_HG_ICON'
elif [[ "${hook_com[vcs]}" == "svn" ]]; then
vcs_visual_identifier='VCS_SVN_ICON'
fi
if [[ -n "${hook_com[staged]}" ]] || [[ -n "${hook_com[unstaged]}" ]]; then
VCS_WORKDIR_DIRTY=true
else
VCS_WORKDIR_DIRTY=false
fi
}
function +vi-svn-detect-changes() {
local svn_status="$(svn status)"
if [[ -n "$(echo "$svn_status" | \grep \^\?)" ]]; then
hook_com[unstaged]+=" $(print_icon 'VCS_UNTRACKED_ICON')"
VCS_WORKDIR_HALF_DIRTY=true
fi
if [[ -n "$(echo "$svn_status" | \grep \^\M)" ]]; then
hook_com[unstaged]+=" $(print_icon 'VCS_UNSTAGED_ICON')"
VCS_WORKDIR_DIRTY=true
fi
if [[ -n "$(echo "$svn_status" | \grep \^\A)" ]]; then
hook_com[staged]+=" $(print_icon 'VCS_STAGED_ICON')"
VCS_WORKDIR_DIRTY=true
fi
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,12 @@
# EditorConfig
# http://EditorConfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

View File

@ -0,0 +1,10 @@
<!--
Thanks for filing an issue 😄
BEFORE SUBMITTING NEW ISSUE, PLEASE, READ THE TROUBLESHOOTING PAGE!
https://github.com/denysdovhan/spaceship-prompt/blob/master/docs/Troubleshooting.md
Check the other issue templates if you are trying to submit a bug report, feature request, or question.
Search open/closed issues before submitting since someone might have asked the same thing before!
-->

View File

@ -0,0 +1,43 @@
---
name: 🐛 Bug Report
about: If something isn't working as expected 🤔.
---
<!--
Please read our TROUBLESHOOTING page for commonly encountered problems:
https://github.com/denysdovhan/spaceship-prompt/blob/master/docs/Troubleshooting.md
-->
**Current behavior**
A clear and concise description of the behavior.
**Expected behavior**
A clear and concise description of what you expected to happen.
#### Relevant Zsh configuration (`.zshrc`)
```zsh
# Your configuration here
```
#### Environment
**Spaceship version:** <version> (use `echo $SPACESHIP_VERSION`)
**Zsh version:** <version>
**Zsh framework:** <None/oh-my-zsh/prezto/etc>
**Zsh plugin manager:** <None/antigen/zplug/etc>
**Terminal emulator:** <iTerm/Hyper/Terminator/etc>
**Operating system:** <macOS/Windows/Linux>
#### Screenshot
Provide a screenshot that shows your issue.
![screenshot](url)
**Possible solution**
<!--- Only if you have suggestions on a fix/reason for the bug -->

View File

@ -0,0 +1,35 @@
---
name: 🚀 Feature Request
about: I have a suggestion (and might want to implement myself 🙂)!
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is.
For example, I have an issue when […]
**Is your feature request related to new section on prompt? Then consider the following questions:**
* Will it clutter the prompt?
* Is it worth to be aware of it?
* Will it slow down the prompt?
<!--
For more information on above points, See our contributing guidelines:
https://github.com/denysdovhan/spaceship-prompt/blob/master/CONTRIBUTING.md#sections
-->
**Describe the solution you'd like**
A clear and concise description of what you want to happen. Add any considered drawbacks.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Documentation, adoption**
If you can, explain how users will be able to use this and possibly write out a version the docs.
Maybe a screenshot?

View File

@ -0,0 +1,13 @@
---
name: 🤗 Support Question
about: If you have a question 💬 about configuring prompt.
---
<!--
If you have a trouble configuring `spaceship-prompt` on your machine, feel free to ask.
Make sure you're not asking duplicate question by searching on the issues lists.
Also read our TROUBLESHOOTING page for commonly encountered problems:
https://github.com/denysdovhan/spaceship-prompt/blob/master/docs/Troubleshooting.md
-->

View File

@ -0,0 +1,13 @@
<!-- Thanks for your pull-request!
Please, make sure you've read `CONTRIBUTING.md` before submitting this PR. -->
#### Description
<!-- Describe your pull-request, what was changed and why… -->
#### Screenshot
<!-- Please, attach a screenshot, if possible.
![screenshot](url) -->

View File

@ -0,0 +1,6 @@
node_modules
_book
# Lockfiles
package-lock.json
yarn.lock

View File

@ -0,0 +1,3 @@
[submodule "modules/shunit2"]
path = modules/shunit2
url = https://github.com/kward/shunit2.git

View File

@ -0,0 +1,46 @@
sudo: true
language: generic
os:
- linux
- osx
addons:
apt:
packages:
- build-essential
before_install:
# Install OSX dependencies
# - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install mercurial; fi;
# Install Linux dependencies
# - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get -qq update; fi;
# - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -y mercurial; fi;
# Set LOCAL for correct ZSH compilaction
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then LOCAL=/usr/local; fi;
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then LOCAL=/tmp; fi;
# Donwload, install and compile ZSH 5.2
- curl -L https://sourceforge.net/projects/zsh/files/zsh/5.2/zsh-5.2.tar.gz/download | tar zx
- cd zsh-5.2
- ./configure --prefix=$LOCAL > /dev/null
- make
- make install
- cd -
- export PATH="$LOCAL/bin:$PATH"
install:
- sudo chsh -s $(which zsh)
before_script:
- zsh --version
script:
- scripts/tests.sh
jobs:
include:
- stage: deploy gitbook
if: branch = master AND type = push
script:
- npm install --only=dev --ignore-scripts
- npm run docs:build
deploy:
provider: pages
skip-cleanup: true
github-token: $GITHUB_TOKEN
committer-from-gh: true
keep-history: true
local-dir: _book

View File

@ -0,0 +1,58 @@
# Contributing
First of all, thank you for contributing. Any contribution is highly appreciated and welcome.
## Philosophy
There's a simple philosophy behind the Spaceship:
* **Show only what's needed.** The prompt should not be overloaded, it shows only what user needs at the moment (current directory, git branch, etc).
* **Work out of the box.** The prompt should work right after installation without any additional configuration. Install it and use it.
* **Be configurable.** It works without configuration, but if a configuration is needed, it provides an easy-to-use interface for customization.
Please, keep this simple rules in mind while you're contributing to Spaceship.
## Setup
1. **Fork** this repo (click the _fork_ button)
2. **Clone** your fork to your working machine (via `git clone`)
3. **Update submodules** in your fork (via `git submodule update --init --recursive`)
4. **Make your changes**. Check our [API](./docs/API.md) for more information (we suggest you to check out a new branch for changes).
5. **Test** your code (via `npm test`)
6. **Add and commit** your contributions
7. **Push** your changes to your remote fork
8. **Open a pull-request** to our primary repo
## Sections
Spaceship supports most of the popular programming languages, runtimes, version managers, etc. If it doesn't support something that you need, feel free to open a pull request, but answer these questions for yourself before:
### Will it clutter the prompt?
Having too much in prompt looks ugly. your much space or be shown too often.
* **Good:** `🚀 v1.2.3`
* **Bad:** `🚀 spasheship#c3BhY2VzaGlw`
### Is it worth to be aware of it?
Is value changes quite often so it needs to be shown in prompt? Would it be useful for other users? Maybe there's a reason to execute a command instead of cluttering prompt.
* **Good:** git status/branch, runtime version via version manager, etc
* **Bad:** version of language-specific framework, settled projects versions, etc
### Will it slow down the prompt?
Every additional section will slow down the prompt a little bit. If your section performs any heavy checkings, find a way to make it faster or consider using an alias instead of creating a new section.
* **Good:** check if command exists, check the value of environment variable
* **Bad:** network requests, reading large files, etc
### Documentation
When updating documentation for your section, make sure the markdown document is being properly rendered by Github. Specifically, the following common pitfalls have already been discovered:
* Empty inline code block ` ` will only be rendered if you put at least one non-breaking whitespace "&nbsp;" inside, like so: `` ` ` `` → ` `
* Leading and trailing whitespaces in inline code blocks will be stripped, to indicate that a whitespace is present, use the middot symbol `·`, like so: `` `🚀·` `` → `🚀·`
**Thanks for reading this contribution guide! Happy hacking!**

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2016-2018 [Denys Dovhan](https://denysdovhan.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,310 @@
<h1 align="center">
<a href="https://github.com/denysdovhan/spaceship-prompt">
<img alt="spaceship →~ prompt" src="https://cloud.githubusercontent.com/assets/3459374/21679181/46e24706-d34b-11e6-82ee-5efb3d2ba70f.png" width="400">
</a>
<br>🚀⭐ Spaceship ZSH <br>
</h1>
<h4 align="center">
<a href="http://zsh.org" target="_blank"><code>Zsh</code></a> prompt for Astronauts.
</h4>
<p align="center">
<!-- NPM Version -->
<a href="https://npmjs.org/package/spaceship-prompt">
<img src="https://img.shields.io/npm/v/spaceship-prompt.svg?style=flat-square"
alt="NPM Version" />
</a>
<a href="https://travis-ci.org/denysdovhan/spaceship-prompt">
<img src="https://img.shields.io/travis/denysdovhan/spaceship-prompt.svg?style=flat-square"
alt="CI Status" />
</a>
<a href="http://zsh.org/">
<img src="https://img.shields.io/badge/zsh-%3E%3Dv5.2-777777.svg?style=flat-square"
alt="Zsh Version" />
</a>
<a href="https://twitter.com/SpaceshipZSH">
<img src="https://img.shields.io/badge/twitter-%40SpaceshipZSH-00ACEE.svg?style=flat-square"
alt="Spaceship ZSH Twitter" />
</a>
<a href="#donate">
<img src="https://img.shields.io/badge/$-donate-ff69b4.svg?style=flat-square"
alt="Donate" />
</a>
</p>
<div align="center">
<h4>
<a href="https://denysdovhan.com/spaceship-prompt/">Website</a> |
<a href="#installing">Install</a> |
<a href="#features">Features</a> |
<a href="./docs/Options.md">Options</a> |
<a href="./docs/API.md">API</a>
</h4>
</div>
<div align="center">
<sub>Built with ❤︎ by
<a href="https://denysdovhan.com">Denys Dovhan</a> and
<a href="https://github.com/denysdovhan/spaceship-prompt/graphs/contributors">contributors </a>
</div>
<br>
Spaceship is a minimalistic, powerful and extremely customizable [Zsh][zsh-url] prompt. It combines everything you may need for convenient work, without unnecessary complications, like a real spaceship.
<p align="center">
<img alt="Spaceship with Hyper and One Dark" src="https://user-images.githubusercontent.com/10276208/36086434-5de52ace-0ff2-11e8-8299-c67f9ab4e9bd.gif" width="980px">
</p>
<sub>Vist <a href="./docs/Troubleshooting.md#why-doesnt-my-prompt-look-like-the-preview">Troubleshooting</a> for similar setup and find more examples with different color schemes in <a href="https://github.com/denysdovhan/spaceship-prompt/wiki/Screenshots">Screenshots </a>wiki-page.</sub>
## Features
* Clever hostname and username displaying.
* Prompt character turns red if the last command exits with non-zero code.
* Current Git branch and rich repo status:
* `?` — untracked changes;
* `+` — uncommitted changes in the index;
* `!` — unstaged changes;
* `»` — renamed files;
* `✘` — deleted files;
* `$` — stashed changes;
* `=` — unmerged changes;
* `⇡` — ahead of remote branch;
* `⇣` — behind of remote branch;
* `⇕` — diverged changes.
* Current Mercurial bookmark/branch and rich repo status:
* `?` — untracked changes;
* `+` — uncommitted changes in the index;
* `!` — unstaged changes;
* `✘` — deleted files;
* Indicator for jobs in the background (`✦`).
* Current Node.js version, through nvm/nodenv/n (`⬢`).
* Current Ruby version, through rvm/rbenv/chruby/asdf (`💎`).
* Current Elm version (`🌳`)
* Current Elixir version, through kiex/exenv/elixir (`💧`).
* Current Swift version, through swiftenv (`🐦`).
* Current Xcode version, through xenv (`🛠`).
* Current Go version (`🐹`).
* Current PHP version (`🐘`).
* Current Rust version (`𝗥`).
* Current version of Haskell GHC Compiler, defined in stack.yaml file (`λ`).
* Current Julia version (`ஃ`).
* Current Docker version and connected machine (`🐳`).
* Current Amazon Web Services (AWS) profile (`☁️`) ([Using named profiles](http://docs.aws.amazon.com/cli/latest/userguide/cli-multiple-profiles.html)).
* Current Python virtualenv.
* Current Conda virtualenv (`🅒`).
* Current Python pyenv (`🐍`).
* Current .NET SDK version, through dotnet-cli (`.NET`).
* Current Ember.js version, through ember-cli (`🐹`).
* Current Kubectl context (`☸️`).
* Current Terraform workspace (`🛠`).
* Package version, if there's is a package in current directory (`📦`).
* Current battery level and status:
* `⇡` - charging;
* `⇣` - discharging;
* `•` - fully charged.
* Current Vi-mode mode ([with handy aliases for temporarily enabling](./docs/Options.md#vi-mode-vi_mode)).
* Optional exit-code of last command ([how to enable](./docs/Options.md#exit-code-exit_code)).
* Optional time stamps 12/24hr in format ([how to enable](./docs/Options.md#time-time)).
* Execution time of the last command if it exceeds the set threshold.
Want more features? Please, [open an issue](https://github.com/denysdovhan/spaceship-prompt/issues/new/choose) or send pull request.
**💡 Tip:** Follow our Twitter to keep yourself updated about new features, improvements, and bugfixes.
## Requirements
To work correctly, you will first need:
* [`zsh`](http://www.zsh.org/) (v5.2 or recent) must be installed.
* [Powerline Font](https://github.com/powerline/fonts) must be installed and used in your terminal (for example, switch font to [Fira Code](https://github.com/tonsky/FiraCode)).
## Installing
### [npm]
```
npm install -g spaceship-prompt
```
Done. This command should link `spaceship.zsh` as `prompt_spaceship_setup` to your `$fpath` and set `prompt spaceship` in `.zshrc`. Just reload your terminal.
**💡 Tip:** Update Spaceship to new versions as you would any other package.
### [oh-my-zsh]
Clone this repo:
```zsh
git clone https://github.com/denysdovhan/spaceship-prompt.git "$ZSH_CUSTOM/themes/spaceship-prompt"
```
Symlink `spaceship.zsh-theme` to your oh-my-zsh custom themes directory:
```zsh
ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme"
```
Set `ZSH_THEME="spaceship"` in your `.zshrc`.
### [prezto]
* Follow [prezto-contrib#usage](https://github.com/belak/prezto-contrib#usage) to clone `prezto-contrib` to the proper location.
* Enable the `contrib-prompt` module (before the `prompt` module).
* Set `zstyle ':prezto:module:prompt' theme 'spaceship'` in your `.zpreztorc`.
### [antigen]
Add the following snippet in your `~/.zshrc`:
```
antigen theme denysdovhan/spaceship-prompt
```
### [antibody]
Update your `.zshrc` file with the following line:
```
antibody bundle denysdovhan/spaceship-prompt
```
### [zgen]
Add the following line to your `~/.zshrc` where you're adding your other Zsh plugins:
```
zgen load denysdovhan/spaceship-prompt spaceship
```
### [zplug]
Use this command in your `.zshrc` to load Spaceship as prompt theme:
```
zplug denysdovhan/spaceship-prompt, use:spaceship.zsh, from:github, as:theme
```
### Linux package manager
#### Arch Linux
Install the latest master from the AUR package [`spaceship-prompt-git`](https://aur.archlinux.org/packages/spaceship-prompt-git/):
```
git clone https://aur.archlinux.org/spaceship-prompt-git.git
cd spaceship-prompt-git
makepkg -si
```
### Manual
If you have problems with approaches above, follow these instructions:
* Clone this repo `git clone https://github.com/denysdovhan/spaceship-prompt.git`
* Symlink `spaceship.zsh` to somewhere in [`$fpath`](http://www.refining-linux.org/archives/46/ZSH-Gem-12-Autoloading-functions/) as `prompt_spaceship_setup`.
* Initialize prompt system and choose `spaceship`.
#### Example
Run `echo $fpath` to see possible location and link `spaceship.zsh` there, like:
```zsh
$ ln -sf "$PWD/spaceship.zsh" "/usr/local/share/zsh/site-functions/prompt_spaceship_setup"
```
For a user-specific installation, simply add a directory to `$fpath` for that user in `.zshrc`:
```zsh
fpath=( "$HOME/.zfunctions" $fpath )
```
Then install the theme like this:
```zsh
$ ln -sf "$PWD/spaceship.zsh" "$HOME/.zfunctions/prompt_spaceship_setup"
```
For initializing prompt system add this to your `.zshrc`:
```zsh
# .zshrc
autoload -U promptinit; promptinit
prompt spaceship
```
## Customization
Spaceship works well out of the box, but you can customize almost everything if you want.
* [**Options**](./docs/Options.md) — Tweak section's behavior with tons of options.
* [**API**](./docs/API.md) — Define a custom section that will do exactly what you want.
You have ability to customize or disable specific elements of Spaceship. All options must be overridden in your `.zshrc` file **after** the theme.
Also, take a look at popular option presets or share your own configuration on [Presets](https://github.com/denysdovhan/spaceship-prompt/wiki/Presets) wiki page.
## Troubleshooting
Having trouble? Take a look at out [Troubleshooting](./docs/Troubleshooting.md) page.
Still struggling? Please, [file an issue](https://github.com/denysdovhan/spaceship-prompt/issues/new/choose), describe your problem and we will gladly help you.
## Related Projects
Here's a list of related projects that have been inspired by Spaceship ZSH.
- [**matchai/spacefish**](https://github.com/matchai/spacefish) - A port of Spaceship ZSH for fish shell intending to achieve complete feature parity.
## Team
| [![Denys Dovhan](https://github.com/denysdovhan.png?size=100)](http://denysdovhan.com) | [![Salmanul Farzy](https://github.com/salmanulfarzy.png?size=100)](https://github.com/salmanulfarzy) | [![Maxim Baz](https://github.com/maximbaz.png?size=100)](https://github.com/maximbaz) |
| :---: | :---: | :---: |
| [Denys Dovhan](https://github.com/denysdovhan) | [Salmanul Farzy](https://github.com/salmanulfarzy) | [Maxim Baz](https://github.com/maximbaz) |
## Donate
Hi! I work on this project in my spare time, in addition to my primary job. I hope you enjoy using Spaceship. If you do, please, [buy me a cup of tea ☕️][donate-card-url].
| Credit/Debit card | Bitcoin | Ethereum |
|:-----------------:|:-------:|:--------:|
| [Donate with LiqPay][donate-card-url] | `1FrPrQb6ACTkbSBAz9PduJWrDFfq41Ggb4` | `0x6aF39C917359897ae6969Ad682C14110afe1a0a1` |
| <img src="https://cloud.githubusercontent.com/assets/3459374/25771981/6f2ba08c-3268-11e7-9fc8-49e3f7b9e0e5.png" width="100px"/> | <img src="https://user-images.githubusercontent.com/3459374/33760933-1c9b81b4-dc10-11e7-8e4b-22d81f98c138.png" width="100px"/> | <img src="https://user-images.githubusercontent.com/3459374/33760932-1c7b3fb2-dc10-11e7-9774-411264d533da.png" width="100px"/> |
I would appreciate your support! _Thank you!_
## License
MIT © [Denys Dovhan](http://denysdovhan.com)
<!-- Badges -->
[npm-url]: https://npmjs.org/package/spaceship-prompt
[npm-image]: https://img.shields.io/npm/v/spaceship-prompt.svg?style=flat-square
[ci-url]: https://travis-ci.org/denysdovhan/spaceship-prompt
[ci-image]: https://img.shields.io/travis/denysdovhan/spaceship-prompt.svg?style=flat-square
[zsh-url]: http://zsh.org/
[zsh-image]: https://img.shields.io/badge/zsh-%3E%3Dv5.2-777777.svg?style=flat-square
[donate-card-url]: https://www.liqpay.com/en/checkout/380951100392
<!-- References -->
[oh-my-zsh]: http://ohmyz.sh/
[prezto]: https://github.com/sorin-ionescu/prezto
[antigen]: http://antigen.sharats.me/
[zgen]: https://github.com/tarjoilija/zgen
[npm]: https://www.npmjs.com/
[antibody]: https://github.com/getantibody/antibody
[zplug]: https://github.com/zplug/zplug
[n]: https://github.com/tj/n
[xcenv]: http://xcenv.org/
[swiftenv]: https://github.com/kylef/swiftenv
[powerline]: https://github.com/powerline/fonts

View File

@ -0,0 +1,61 @@
# Summary
* [Home](/README.md)
* [Options](/docs/Options.md)
* [Order](/docs/Options.md#order)
* [Prompt](/docs/Options.md#prompt)
* [Char (char)](/docs/Options.md#char)
* [Time (time)](/docs/Options.md#time-time)
* [Username (user)](/docs/Options.md#username-user)
* [Hostname (host)](/docs/Options.md#hostname-host)
* [Directory (dir)](/docs/Options.md#directory-dir)
* [Git (git)](/docs/Options.md#git-git)
* [Git branch (git_branch)](/docs/Options.md#git-branch-gitbranch)
* [Git status (git_status)](/docs/Options.md#git-status-gitstatus)
* [Mercurial (hg)](/docs/Options.md#mercurial-hg)
* [Mercurial branch (hg_branch)](/docs/Options.md#mercurial-branch-hg_branch)
* [Mercurial status (hg_status)](/docs/Options.md#mercurial-status-hg_status)
* [Package version (package)](/docs/Options.md#package-version-package)
* [Node (node)](/docs/Options.md#nodejs-node)
* [Ruby (ruby)](/docs/Options.md#ruby-ruby)
* [Elm (elm)](/docs/Options.md#elm-elm)
* [Elixir (elixir)](/docs/Options.md#elixir-elixir)
* [Xcode (xcode)](/docs/Options.md#xcode-xcode)
* [Swift (swift)](/docs/Options.md#swift-swift)
* [Go (go)](/docs/Options.md#go-golang)
* [PHP (php)](/docs/Options.md#php-php)
* [Rust (rust)](/docs/Options.md#rust-rust)
* [Haskell (haskell)](/docs/Options.md#haskell-haskell)
* [Julia (julia)](/docs/Options.md#julia-julia)
* [Docker (docker)](/docs/Options.md#docker-docker)
* [Amazon Web Services (aws)](/docs/Options.md#amazon-web-services-aws-aws)
* [Virtualenv (venv)](/docs/Options.md#virtualenv-venv)
* [Conda Virtualenv (conda)](/docs/Options.md#conda-virtualenv-conda)
* [Pyenv (pyenv)](/docs/Options.md#pyenv-pyenv)
* [.NET (dotnet)](/docs/Options.md#net-dotnet)
* [Ember (ember)](/docs/Options.md#emberjs-ember)
* [Kubectl context (kubecontext)](/docs/Options.md#kubectl-context-kubecontext)
* [Terraform workspace (terraform)](/docs/Options.md#terraform-workspace-terraform)
* [Execution time (exec_time)](/docs/Options.md#execution-time-exec_time)
* [Battery (battery)](/docs/Options.md#battery-battery)
* [Vi-mode (vi_mode)](/docs/Options.md#vi-mode-vi_mode)
* [Background Jobs (jobs)](/docs/Options.md#jobs-jobs)
* [Exit code (exit_code)](/docs/Options.md#exit-code-exit_code)
* [Contributing Guide](/CONTRIBUTING.md)
* [Philosophy](/CONTRIBUTING.md#philosophy)
* [Setup](/CONTRIBUTING.md#setup)
* [Sections](/CONTRIBUTING.md#sections)
* [API](/docs/API.md)
* [Typical section](/docs/API.md#typical-section)
* [SPACESHIP_VERSION](/docs/API.md#spaceshipversion)
* [SPACESHIP_ROOT](/docs/API.md#spaceshiproot)
* [spaceship::section](/docs/API.md#spaceshipsection-color-prefix-content-suffix)
* [spaceship::exists](/docs/API.md#spaceshipexists-command)
* [spaceship::defined](/docs/API.md#spaceshipdefined-function)
* [spaceship::is_git](/docs/API.md#spaceshipisgit)
* [spaceship::is_hg](/docs/API.md#spaceshipishg)
* [spaceship::deprecated](/docs/API.md#spaceshipdeprecated-option-message)
* [spaceship::displaytime](/docs/API.md#spaceshipdisplaytime-seconds)
* [spaceship::union](/docs/API.md#spaceshipunion-arr1-arr2-)
* [Troubleshooting](/docs/Troubleshooting.md)

View File

@ -0,0 +1,23 @@
{
"gitbook": "3.x.x",
"title": "Spaceship ZSH",
"plugins": ["edit-link", "github", "github-buttons", "anchorjs"],
"pluginsConfig": {
"edit-link": {
"base": "https://github.com/denysdovhan/spaceship-prompt/tree/master",
"label": "Edit This Page"
},
"github": {
"url": "https://github.com/denysdovhan/spaceship-prompt/"
},
"github-buttons": {
"buttons": [{
"user": "denysdovhan",
"repo": "spaceship-prompt",
"type": "star",
"size": "small",
"count": true
}]
}
}
}

View File

@ -0,0 +1,256 @@
# API
This page describes Spaceship API for creating plugins and tweaking Spaceship's behavior.
Spaceship uses `SPACESHIP_` prefix for variables and `spaceship::` prefix for a function to avoid conflicts with other ones. All section, including custom ones, are being required to use `spaceship_` prefix before their name to load properly.
## Typical section
Below is an example of a typical section for Spaceship. Pay attention to a few crucial moments:
* Define options for customization. Their names should start with `SPACESHIP_`.
* Section's name should start with `spaceship_`.
* Show section only where it's needed (in directories which contains specific files, when a specific command is available, etc).
Take a look at [Contribution guidelines](../CONTRIBUTING.md) for further information.
```zsh
#
# Foobar
#
# Foobar is a supa-dupa cool tool for making you development easier.
# Link: https://www.foobar.xyz
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_FOOBAR_SHOW="${SPACESHIP_FOOBAR_SHOW=true}"
SPACESHIP_FOOBAR_PREFIX="${SPACESHIP_FOOBAR_PREFIX="$SPACESHIP_PROMPT_DEFAULT_PREFIX"}"
SPACESHIP_FOOBAR_SUFFIX="${SPACESHIP_FOOBAR_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_FOOBAR_SYMBOL="${SPACESHIP_FOOBAR_SYMBOL="🍷 "}"
SPACESHIP_FOOBAR_COLOR="${SPACESHIP_FOOBAR_COLOR="white"}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show foobar status
# spaceship_ prefix before section's name is required!
# Otherwise this section won't be loaded.
spaceship_foobar() {
# If SPACESHIP_FOOBAR_SHOW is false, don't show foobar section
[[ $SPACESHIP_FOOBAR_SHOW == false ]] && return
# Check if foobar command is available for execution
spaceship::exists foobar || return
# Show foobar section only when there are foobar-specific files in current
# working directory.
# Here glob qualifiers are used to check if files with specific extension are
# present in directory. Read more about them here:
# http://zsh.sourceforge.net/Doc/Release/Expansion.html
[[ -f foobar.conf || -n *.foo(#qN^/) || -n *.bar(#qN^/) ]] || return
# Use quotes around unassigned local variables to prevent
# getting replaced by global aliases
# http://zsh.sourceforge.net/Doc/Release/Shell-Grammar.html#Aliasing
local 'foobar_status'
if [[ $SOME_CONDITION ]]; then
foobar_status=$(foobar baz)
else
foobar_status=$(foobar foo)
fi
# Display foobar section
spaceship::section \
"$SPACESHIP_FOOBAR_COLOR" \
"$SPACESHIP_FOOBAR_PREFIX" \
"$SPACESHIP_FOOBAR_SYMBOL$foobar_status" \
"$SPACESHIP_FOOBAR_SUFFIX"
}
```
## `SPACESHIP_VERSION`
An environment variable that defines the version of currently running Spaceship prompt version. Can be used for issue reporting or debugging purposes.
Accessible to any program or script running in a current shell session.
### Example:
```zsh
echo $SPACESHIP_VERSION
#> 3.0.0
```
## `SPACESHIP_ROOT`
> **Attention!** Do not modify the value of this variable! Changing the value may cause the damage to Spaceship installation!
An environment variable that defines the path to Spaceship prompt installation. Spaceship uses this variable for resolving path to sections and utils.
Accessible to any program or script running in a current shell session.
### Example:
```zsh
echo $SPACESHIP_ROOT
#> /path/to/spaceship-prompt
```
## `spaceship::section <color> [prefix] <content> [suffix]`
This command displays prompt section prefixed with `prefix`, suffixed with `suffix` and `content` painted in `color`. **Bold** style is applied by default.
`prefix`, `suffix` and `content` can contain escapes to set additional foreground color, background color and other visual effects. Read more about escapes in [13 Prompt Expansion](http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html) section of Zsh documentation.
If `SPACESHIP_PROMPT_PREFIXES_SHOW` is `false` or if the section is not the first in the prompt, then `prefix` will be omitted.
If `SPACESHIP_PROMPT_SUFFIXES_SHOW` is `false`, then `suffix` will be omitted.
Both `prefix` and `suffix` are optional. They are equal to empty strings by default.
### Arguments
1. `color` _Required_ — Color for displaying the `content`. Can be any of [basic colors](https://wiki.archlinux.org/index.php/zsh#Colors) or [color codes](https://upload.wikimedia.org/wikipedia/commons/1/15/Xterm_256color_chart.svg).
2. `prefix` _Optional_ — Prefix before `content`. Usually, it's the value of `SPACESHIP_*_PREFIX`.
3. `content` _Required_ — The content of the section. Can be any valid value or result of command execution.
4. `suffix` _Optional_ — Suffix after `content`. Usually, it's the value of `SPACESHIP_*_SUFFIX`.
### Example
```zsh
# Display prompt section with prefix and suffix
# Backslash is used to escape line ending
spaceship::section \
"$SPACESHIP_SECTION_COLOR" \
"$SPACESHIP_SECTION_PREFIX" \
"$SPACESHIP_SECTION_SYMBOL$section_content" \
"$SPACESHIP_SECTION_SUFFIX"
# Display prompt section without prefix and suffix
spaceship::section "$color" "$SPACESHIP_CHAR_SYMBOL"
```
## `spaceship::exists <command>`
This command validates that given program is available for execution. It checks for PATH binaries, functions, and builtins. It returns zero exit code if a `command` exists and non-zero code otherwise.
You can use this utility to check if some program is installed and perform actions conditionally. For example, you can either return an error and exit or continue script's execution.
### Arguments
1. `command` _Required_ — a command that needs to be checked.
### Example
```zsh
# Check multiple commands for existing
if spaceship::exists nvm; then
# extract nvm version
elif spaceship::exists node; then
# extract node version
else
return
fi
# Do nothing if pyenv is not installed
spaceship::exists pyenv || return
```
## `spaceship::defined <function>`
The same as [`spaceship::exists`](#spaceshipexists-command), but for functions. It returns zero exit code if a `function` has been defined previously and non-zero if `function` hasn't.
You can use this utility to check if a user has previously defined a function or not. Spaceship uses this utility internally to check if a custom section has been defined and available for execution.
### Arguments
1. `function` _Required_ — a function that needs to be checked.
### Example
```zsh
# Check if section has been defined
if spaceship::defined spaceship_section; then
spaceship_section
else
# section is not found
fi
```
## `spaceship::is_git`
This utility returns zero exit code if a current working directory is a Git repository and non-zero if it's not.
### Example
```zsh
# Return if current directory is not a git repository
spaceship::is_git || return
```
## `spaceship::is_hg`
The same as [`spaceship::is_git`](#spaceshipisgit), but for Mercurial repositories. This utility returns zero exit code if a current working directory is a Mercurial repository and non-zero if it's not.
### Example
```zsh
# Return if current directory is not a Mercurial repository
spaceship::is_hg || return
```
## `spaceship::deprecated <option> [message]`
This utility checks if `option` variable is set and if it is, prints the `message`. The `message` supports escapes to set foreground color, background color and other visual effects. Read more about escapes in [13 Prompt Expansion](http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html) section of Zsh documentation.
### Arguments
1. `option` _Required_ — the name of a deprecated variable. If this variable is set (contains any value), then `"%B$deprecated%b is deprecated.` will be printed. `%B` and `%b` is escapes to set the bold style for text.
2. `message` _Optional_ — a string for additional deprecation message.
### Example
```zsh
# Check if SPACESHIP_BATTERY_ALWAYS_SHOW is set
spaceship::deprecated SPACESHIP_BATTERY_ALWAYS_SHOW "Use %BSPACESHIP_BATTERY_SHOW='always'%b instead."
#> SPACESHIP_BATTERY_ALWAYS_SHOW is deprecated. Use SPACESHIP_BATTERY_SHOW='always' instead.
```
## `spaceship::displaytime <seconds>`
This utility converts `seconds` into a human-readable format. It splits `seconds` into days (`d`), hours (`h`), minutes (`m`) and seconds (`s`).
### Arguments
1. `seconds` _Required_ — seconds for conversion into the readable format.
### Example
```zsh
spaceship::displaytime 123456
#> 1d 10h 17m 36s
```
## `spaceship::union <arr1[ arr2[ ...]]>`
A utility for performing a union (intersection) of arrays. It lists the contents found in two or more arrays.
Spaceship uses this utility internally for resolution of sections that need to be sourced.
### Arguments
1. `arr...` — a list of arrays.
### Example
```zsh
arr1=('a' 'b' 'c')
arr2=('b' 'c' 'd')
arr3=('c' 'd' 'e')
spaceship::union $arr1 $arr2 $arr3
#> a b c d e
```

View File

@ -0,0 +1,600 @@
## Options
You have ability to customize or disable specific elements of Spaceship. All options must be overridden in your `.zshrc` file **after** the theme.
Colors for sections can be [basic colors](https://wiki.archlinux.org/index.php/zsh#Colors) or [color codes](https://upload.wikimedia.org/wikipedia/commons/1/15/Xterm_256color_chart.svg).
**Note:** the symbol `·` in this document represents a regular space character ` `, it is used to clearly indicate when an option default value starts or ends with a space.
### Order
You can specify the order of prompt section using `SPACESHIP_PROMPT_ORDER` option. Use Zsh array syntax to define your own prompt order.
The order also defines which sections that Spaceship loads. If you're struggling with slow prompt, you can just omit the sections that you don't use, and they won't be loaded.
The default order is:
```zsh
SPACESHIP_PROMPT_ORDER=(
time # Time stamps section
user # Username section
dir # Current directory section
host # Hostname section
git # Git section (git_branch + git_status)
hg # Mercurial section (hg_branch + hg_status)
package # Package version
node # Node.js section
ruby # Ruby section
elixir # Elixir section
xcode # Xcode section
swift # Swift section
golang # Go section
php # PHP section
rust # Rust section
haskell # Haskell Stack section
julia # Julia section
docker # Docker section
aws # Amazon Web Services section
venv # virtualenv section
conda # conda virtualenv section
pyenv # Pyenv section
dotnet # .NET section
ember # Ember.js section
kubecontext # Kubectl context section
terraform # Terraform workspace section
exec_time # Execution time
line_sep # Line break
battery # Battery level and status
vi_mode # Vi-mode indicator
jobs # Background jobs indicator
exit_code # Exit code section
char # Prompt character
)
```
You can also add items to the right prompt by specifying them in the `SPACESHIP_RPROMPT_ORDER` option. By default `SPACESHIP_RPROMPT_ORDER` is empty.
### Prompt
This group of options defines a behaviour of prompt and standard parameters for sections displaying.
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_PROMPT_ADD_NEWLINE` | `true` | Adds a newline character before each prompt line |
| `SPACESHIP_PROMPT_SEPARATE_LINE` | `true` | Make the prompt span across two lines |
| `SPACESHIP_PROMPT_FIRST_PREFIX_SHOW` | `false` | Shows a prefix of the first section in prompt |
| `SPACESHIP_PROMPT_PREFIXES_SHOW` | `true` | Show prefixes before prompt sections or not |
| `SPACESHIP_PROMPT_SUFFIXES_SHOW` | `true` | Show suffixes before prompt sections or not |
| `SPACESHIP_PROMPT_DEFAULT_PREFIX` | `via ` | Default prefix for prompt sections |
| `SPACESHIP_PROMPT_DEFAULT_SUFFIX` | ` ` | Default suffix for prompt section |
### Char
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_CHAR_PREFIX` | ` ` | Prefix before prompt character |
| `SPACESHIP_CHAR_SUFFIX` | ` ` | Suffix after prompt character |
| `SPACESHIP_CHAR_SYMBOL` | `➜ ` | Prompt character to be shown before any command |
| `SPACESHIP_CHAR_SYMBOL_ROOT` | `$SPACESHIP_CHAR_SYMBOL` | Prompt character to be shown before any command for the root user |
| `SPACESHIP_CHAR_SYMBOL_SECONDARY` | `$SPACESHIP_CHAR_SYMBOL` | Secondary prompt character to be shown for incomplete commands |
| `SPACESHIP_CHAR_COLOR_SUCCESS` | `green` | Color of prompt character if last command completes successfully |
| `SPACESHIP_CHAR_COLOR_FAILURE` | `red` | Color of prompt character if last command returns non-zero exit-code |
| `SPACESHIP_CHAR_COLOR_SECONDARY` | `yellow` | Color of secondary prompt character |
### Time (`time`)
Disabled by default. Set `SPACESHIP_TIME_SHOW` to `true` in your `.zshrc`, if you need to show time stamps.
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_TIME_SHOW` | `false` | Show time (set to `true` for enabling) |
| `SPACESHIP_TIME_PREFIX` | `at·` | Prefix before time section |
| `SPACESHIP_TIME_SUFFIX` | `$SPACESHIP_PROMPT_DEFAULT_SUFFIX` | Suffix after time section |
| `SPACESHIP_TIME_COLOR` | `yellow` | Color of time section |
| `SPACESHIP_TIME_FORMAT` | `false` | Custom date formatting [ZSH date formats](http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Date-and-time) |
| `SPACESHIP_TIME_12HR` | `false` | Format time using 12-hour clock (am/pm) |
### Username (`user`)
By default, a username is shown only when it's not the same as `$LOGNAME`, when you're connected via SSH or when you're root. Root user is highlighted in `SPACESHIP_USER_COLOR_ROOT` color (red as default).
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_USER_SHOW` | `true` | Show user section (`true`, `false`, `always` or `needed`) |
| `SPACESHIP_USER_PREFIX` | `with·` | Prefix before user section |
| `SPACESHIP_USER_SUFFIX` | `$SPACESHIP_PROMPT_DEFAULT_SUFFIX` | Suffix after user section |
| `SPACESHIP_USER_COLOR` | `yellow` | Color of user section |
| `SPACESHIP_USER_COLOR_ROOT` | `red` | Color of user section when it's root |
`SPACESHIP_USER_SHOW` defines when to show username section. Here are possible values:
| `SPACESHIP_USER_SHOW` | Show on local | Show on remote |
| :-------------------: | :------------- | :-------------- |
| `false` | Never | Never |
| `always` | Always | Always |
| `true` | If needed | Always |
| `needed` | If needed | If needed |
### Hostname (`host`)
Hostname is shown only when you're connected via SSH unless you change this behavior.
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_HOST_SHOW` | `true` | Show host section (`true`, `false` or `always`) |
| `SPACESHIP_HOST_SHOW_FULL` | `false` | Show full hostname section (`true`, `false`) |
| `SPACESHIP_HOST_PREFIX` | `at·` | Prefix before the connected SSH machine name |
| `SPACESHIP_HOST_SUFFIX` | `$SPACESHIP_PROMPT_DEFAULT_SUFFIX` | Suffix after the connected SSH machine name |
| `SPACESHIP_HOST_COLOR` | `blue` | Color of host section |
| `SPACESHIP_HOST_COLOR_SSH` | `green` | Color of host in SSH connection |
### Directory (`dir`)
Directory is always shown and truncated to the value of `SPACESHIP_DIR_TRUNC`. While you are in repository, it shows only root directory and folders inside it.
If current directory is write-protected or if current user has not enough rights to write in it, a padlock (by default) is displayed as a suffix.
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_DIR_SHOW` | `true` | Show directory section |
| `SPACESHIP_DIR_PREFIX` | `in·` | Prefix before current directory |
| `SPACESHIP_DIR_SUFFIX` | `$SPACESHIP_PROMPT_DEFAULT_SUFFIX` | Suffix after current directory |
| `SPACESHIP_DIR_TRUNC` | `3` | Number of folders of cwd to show in prompt, 0 to show all |
| `SPACESHIP_DIR_TRUNC_PREFIX` | ` ` | Prefix before cwd when it's truncated. For example `…/` or `.../`, empty to disable |
| `SPACESHIP_DIR_TRUNC_REPO` | `true` | While in `git` repo, show only root directory and folders inside it |
| `SPACESHIP_DIR_COLOR` | `cyan` | Color of directory section |
| `SPACESHIP_DIR_LOCK_SYMBOL` | ![·](https://user-images.githubusercontent.com/10276208/46248218-4af95d80-c434-11e8-8e25-595d792503f1.png) | The symbol displayed if directory is write-protected (requires powerline patched font) |
| `SPACESHIP_DIR_LOCK_COLOR` | `red` | Color for the lock symbol |
### Git (`git`)
Git section is consists with `git_branch` and `git_status` subsections. It is shown only in Git repositories.
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_GIT_SHOW` | `true` | Show Git section |
| `SPACESHIP_GIT_PREFIX` | `on·` | Prefix before Git section |
| `SPACESHIP_GIT_SUFFIX` | `$SPACESHIP_PROMPT_DEFAULT_SUFFIX` | Suffix after Git section |
| `SPACESHIP_GIT_SYMBOL` | ![·](https://user-images.githubusercontent.com/3459374/34947621-4f324a92-fa13-11e7-9b99-cdba2cdda6b9.png) | Character to be shown before Git section (requires [powerline patched font](https://github.com/powerline/fonts) |
#### Git branch (`git_branch`)
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_GIT_BRANCH_SHOW` | `true` | Show Git branch subsection |
| `SPACESHIP_GIT_BRANCH_PREFIX` | `$SPACESHIP_GIT_SYMBOL` | Prefix before Git branch subsection |
| `SPACESHIP_GIT_BRANCH_SUFFIX` | ` ` | Suffix after Git branch subsection |
| `SPACESHIP_GIT_BRANCH_COLOR` | `magenta` | Color of Git branch subsection |
#### Git status (`git_status`)
Git status indicators is shown only when you have dirty repository.
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_GIT_STATUS_SHOW` | `true` | Show Git status subsection |
| `SPACESHIP_GIT_STATUS_PREFIX` | `·[` | Prefix before Git status subsection |
| `SPACESHIP_GIT_STATUS_SUFFIX` | `]` | Suffix after Git status subsection |
| `SPACESHIP_GIT_STATUS_COLOR` | `red` | Color of Git status subsection |
| `SPACESHIP_GIT_STATUS_UNTRACKED` | `?` | Indicator for untracked changes |
| `SPACESHIP_GIT_STATUS_ADDED` | `+` | Indicator for added changes |
| `SPACESHIP_GIT_STATUS_MODIFIED` | `!` | Indicator for unstaged files |
| `SPACESHIP_GIT_STATUS_RENAMED` | `»` | Indicator for renamed files |
| `SPACESHIP_GIT_STATUS_DELETED` | `✘` | Indicator for deleted files |
| `SPACESHIP_GIT_STATUS_STASHED` | `$` | Indicator for stashed changes |
| `SPACESHIP_GIT_STATUS_UNMERGED` | `=` | Indicator for unmerged changes |
| `SPACESHIP_GIT_STATUS_AHEAD` | `⇡` | Indicator for unpushed changes (ahead of remote branch) |
| `SPACESHIP_GIT_STATUS_BEHIND` | `⇣` | Indicator for unpulled changes (behind of remote branch) |
| `SPACESHIP_GIT_STATUS_DIVERGED` | `⇕` | Indicator for diverged changes (diverged with remote branch) |
### Mercurial (`hg`)
Mercurial section is consists with `hg_branch` and `hg_status` subsections. It is shown only in Mercurial repositories.
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_HG_SHOW` | `true` | Show Mercurial section |
| `SPACESHIP_HG_PREFIX` | `on·` | Prefix before Mercurial section |
| `SPACESHIP_HG_SUFFIX` | `$SPACESHIP_PROMPT_DEFAULT_SUFFIX` | Suffix after Mercurial section |
| `SPACESHIP_HG_SYMBOL` | `☿·` | Character to be shown before Mercurial section |
#### Mercurial branch (`hg_branch`)
Shows Mercurial bookmarks when available, otherwise shows Mercurial branch information.
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_HG_BRANCH_SHOW` | `true` | Show Mercurial branch subsection |
| `SPACESHIP_HG_BRANCH_PREFIX` | `$SPACESHIP_HG_SYMBOL` | Prefix before Mercurial branch subsection |
| `SPACESHIP_HG_BRANCH_SUFFIX` | `$SPACESHIP_PROMPT_DEFAULT_SUFFIX` | Suffix after Mercurial branch subsection |
| `SPACESHIP_HG_BRANCH_COLOR` | `magenta` | Color of Mercurial branch subsection |
#### Mercurial status (`hg_status`)
Mercurial status indicators is shown only when you have dirty repository.
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_HG_STATUS_SHOW` | `true` | Show Mercurial status subsection |
| `SPACESHIP_HG_STATUS_PREFIX` | `[` | Prefix before Mercurial status subsection |
| `SPACESHIP_HG_STATUS_SUFFIX` | `]` | Suffix after Mercurial status subsection |
| `SPACESHIP_HG_STATUS_COLOR` | `red` | Color of Mercurial status subsection |
| `SPACESHIP_HG_STATUS_UNTRACKED` | `?` | Indicator for untracked changes |
| `SPACESHIP_HG_STATUS_ADDED` | `+` | Indicator for added changes |
| `SPACESHIP_HG_STATUS_MODIFIED` | `!` | Indicator for unstaged files |
| `SPACESHIP_HG_STATUS_DELETED` | `✘` | Indicator for deleted files |
### Package version (`package`)
> Works only for [npm](https://www.npmjs.com/) at the moment. Please, help us improve this section!
Package version is shown when repository is a package (e.g. contains a `package.json` file). Install [jq](https://stedolan.github.io/jq/) for **improved performace** of this section ([Why?](./Troubleshooting.md#why-is-my-prompt-slow))
> **Note:** This is the version of the package you are working on, not the version of package manager itself.
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_PACKAGE_SHOW` | `true` | Show package version |
| `SPACESHIP_PACKAGE_PREFIX` | `is·` | Prefix before package version section |
| `SPACESHIP_PACKAGE_SUFFIX` | `$SPACESHIP_PROMPT_DEFAULT_SUFFIX` | Suffix after package version section |
| `SPACESHIP_PACKAGE_SYMBOL` | `📦·` | Character to be shown before package version |
| `SPACESHIP_PACKAGE_COLOR` | `red` | Color of package version section |
### Node.js (`node`)
Node.js section is shown only in directories that contain `package.json` file, or `node_modules` folder, or any other file with `.js` extension.
If you set `SPACESHIP_NODE_DEFAULT_VERSION` to the default Node.js version and your current version is the same as `SPACESHIP_NODE_DEFAULT_VERSION`, then Node.js section will be hidden.
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_NODE_SHOW` | `true` | Current Node.js section |
| `SPACESHIP_NODE_PREFIX` | `$SPACESHIP_PROMPT_DEFAULT_PREFIX` | Prefix before Node.js section |
| `SPACESHIP_NODE_SUFFIX` | `$SPACESHIP_PROMPT_DEFAULT_SUFFIX` | Suffix after Node.js section |
| `SPACESHIP_NODE_SYMBOL` | `⬢·` | Character to be shown before Node.js version |
| `SPACESHIP_NODE_DEFAULT_VERSION` | ` ` | Node.js version to be treated as default |
| `SPACESHIP_NODE_COLOR` | `green` | Color of Node.js section |
### Ruby (`ruby`)
Ruby section is shown only in directories that contain `Gemfile`, or `Rakefile`, or any other file with `.rb` extension.
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_RUBY_SHOW` | `true` | Show Ruby section |
| `SPACESHIP_RUBY_PREFIX` | `$SPACESHIP_PROMPT_DEFAULT_PREFIX` | Prefix before Ruby section |
| `SPACESHIP_RUBY_SUFFIX` | `$SPACESHIP_PROMPT_DEFAULT_SUFFIX` | Suffix after Ruby section |
| `SPACESHIP_RUBY_SYMBOL` | `💎·` | Character to be shown before Ruby version |
| `SPACESHIP_RUBY_COLOR` | `red` | Color of Ruby section |
### Elm (`elm`)
Elm section is shown only in directories that contain `elm.json` file, `elm-package.json` file, `elm-stuff` directory, or any other file with `.elm` extension.
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_ELM_SHOW` | `true` | Show installed Elm version |
| `SPACESHIP_ELM_PREFIX` | `$SPACESHIP_PROMPT_DEFAULT_PREFIX` | Prefix before Elm section |
| `SPACESHIP_ELM_SUFFIX` | `$SPACESHIP_PROMPT_DEFAULT_SUFFIX` | Suffix after Elm section |
| `SPACESHIP_ELM_SYMBOL` | `🌳·` | Character to be shown before Elm version |
| `SPACESHIP_ELM_COLOR` | `cyan` | Color of Elm section |
### Elixir (`elixir`)
Elixir section is shown only in directories that contain `mix.exs`, or any other file with `.ex` or `.exs` extension. If the current elixir version is the same as the version set in `SPACESHIP_ELIXIR_DEFAULT_VERSION`, the elixir section will be hidden.
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_ELIXIR_SHOW` | `true` | Show Elixir section |
| `SPACESHIP_ELIXIR_PREFIX` | `$SPACESHIP_PROMPT_DEFAULT_PREFIX` | Prefix before Elixir section |
| `SPACESHIP_ELIXIR_SUFFIX` | `$SPACESHIP_PROMPT_DEFAULT_SUFFIX` | Suffix after Elixir section |
| `SPACESHIP_ELIXIR_DEFAULT_VERSION` | ` ` | Elixir version to be treated as default |
| `SPACESHIP_ELIXIR_SYMBOL` | `💧·` | Character to be shown before Elixir version |
| `SPACESHIP_ELIXIR_COLOR` | `magenta` | Color of Elixir section |
### Xcode (`xcode`)
Shows current version of Xcode. Local version has more priority than global.
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_XCODE_SHOW_LOCAL` | `true` | Current local Xcode version based on [xcenv] |
| `SPACESHIP_XCODE_SHOW_GLOBAL` | `true` | Global Xcode version based on [xcenv] |
| `SPACESHIP_XCODE_PREFIX` | `$SPACESHIP_PROMPT_DEFAULT_PREFIX` | Prefix before Xcode section |
| `SPACESHIP_XCODE_SUFFIX` | `$SPACESHIP_PROMPT_DEFAULT_SUFFIX` | Suffix after Xcode section |
| `SPACESHIP_XCODE_SYMBOL` | `🛠·` | Character to be shown before Xcode version |
| `SPACESHIP_XCODE_COLOR` | `blue` | Color of Xcode section |
### Swift (`swift`)
Shows current version of Swift. Local version has more priority than global.
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_SWIFT_SHOW_LOCAL` | `true` | Current local Swift version based on [swiftenv] |
| `SPACESHIP_SWIFT_SHOW_GLOBAL` | `false` | Global Swift version based on [swiftenv] |
| `SPACESHIP_SWIFT_PREFIX` | `$SPACESHIP_PROMPT_DEFAULT_PREFIX` | Prefix before the Swift section |
| `SPACESHIP_SWIFT_SUFFIX` | `$SPACESHIP_PROMPT_DEFAULT_SUFFIX` | Suffix to be shown before the Swift section |
| `SPACESHIP_SWIFT_SYMBOL` | `🐦·` | Character to be shown before Swift version |
| `SPACESHIP_SWIFT_COLOR` | `yellow` | Color of Swift section |
### Go (`golang`)
Go section is shown only in directories that contain `go.mod`, `Godeps`, `glide.yaml`, any other file with `.go` extension, or when current directory is in the Go workspace defined in `$GOPATH`.
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_GOLANG_SHOW` | `true` | Shown current Go version or not |
| `SPACESHIP_GOLANG_PREFIX` | `$SPACESHIP_PROMPT_DEFAULT_PREFIX` | Prefix before the Go section |
| `SPACESHIP_GOLANG_SUFFIX` | `$SPACESHIP_PROMPT_DEFAULT_SUFFIX` | Suffix after the Go section |
| `SPACESHIP_GOLANG_SYMBOL` | `🐹·` | Character to be shown before Go version |
| `SPACESHIP_GOLANG_COLOR` | `cyan` | Color of Go section |
### PHP (`php`)
PHP section is shown only in directories that contain `composer.json` file, or any other file with `.php` extension.
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_PHP_SHOW` | true | Show PHP section |
| `SPACESHIP_PHP_PREFIX` | `$SPACESHIP_PROMPT_DEFAULT_PREFIX` | Prefix before the PHP section |
| `SPACESHIP_PHP_SUFFIX` | `$SPACESHIP_PROMPT_DEFAULT_SUFFIX` | Suffix after the PHP section |
| `SPACESHIP_PHP_SYMBOL` | `🐘·` | Character to be shown before PHP version |
| `SPACESHIP_PHP_COLOR` | `blue` | Color of PHP section |
### Rust (`rust`)
Rust section is shown only in directories that contain `Cargo.toml` or any other file with `.rs` extension.
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_RUST_SHOW` | `true` | Shown current Rust version or not |
| `SPACESHIP_RUST_PREFIX` | `$SPACESHIP_PROMPT_DEFAULT_PREFIX` | Prefix before the Rust section |
| `SPACESHIP_RUST_SUFFIX` | `$SPACESHIP_PROMPT_DEFAULT_SUFFIX` | Suffix after the Rust section |
| `SPACESHIP_RUST_SYMBOL` | `𝗥·` | Character to be shown before Rust version |
| `SPACESHIP_RUST_COLOR` | `red` | Color of Rust section |
| `SPACESHIP_RUST_VERBOSE_VERSION` | `false` | Show what branch is being used, if any. (Beta, Nightly) |
### Haskell (`haskell`)
Haskell section is shown only in directories that contain `stack.yaml` file.
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_HASKELL_SHOW` | `true` | Shown current Haskell Tool Stack version or not |
| `SPACESHIP_HASKELL_PREFIX` | `$SPACESHIP_PROMPT_DEFAULT_PREFIX` | Prefix before the Haskell section |
| `SPACESHIP_HASKELL_SUFFIX` | `$SPACESHIP_PROMPT_DEFAULT_SUFFIX` | Suffix after the Haskell section |
| `SPACESHIP_HASKELL_SYMBOL` | `λ·` | Character to be shown before Haskell Tool Stack version |
| `SPACESHIP_HASKELL_COLOR` | `red` | Color of Haskell section |
### Julia (`julia`)
Julia section is shown only in directories that contain file with `.jl` extension.
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_JULIA_SHOW` | `true` | Shown current Julia version or not |
| `SPACESHIP_JULIA_PREFIX` | `$SPACESHIP_PROMPT_DEFAULT_PREFIX` | Prefix before the Julia section |
| `SPACESHIP_JULIA_SUFFIX` | `$SPACESHIP_PROMPT_DEFAULT_SUFFIX` | Suffix after the Julia section |
| `SPACESHIP_JULIA_SYMBOL` | `ஃ·` | Character to be shown before Julia version |
| `SPACESHIP_JULIA_COLOR` | `green` | Color of Julia section |
### Docker (`docker`)
Docker section is shown only in directories that contain `Dockerfile` or it's possible to run `docker-compose`.
`docker-compose` will run only if there is docker-compose.yml, or other file(s) specified with `COMPOSE_FILE` are accessible.
The environment variable `COMPOSE_PATH_SEPARATOR` is supported too. For more information see [Compose CLI environment variables](https://docs.docker.com/compose/reference/envvars/).
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_DOCKER_SHOW` | `true` | Show current Docker version and connected docker-machine or not |
| `SPACESHIP_DOCKER_PREFIX` | `on ` | Prefix before the Docker section |
| `SPACESHIP_DOCKER_SUFFIX` | `$SPACESHIP_PROMPT_DEFAULT_SUFFIX` | Suffix after the Docker section |
| `SPACESHIP_DOCKER_SYMBOL` | `🐳·` | Character to be shown before Docker version |
| `SPACESHIP_DOCKER_COLOR` | `cyan` | Color of Docker section |
| `SPACESHIP_DOCKER_VERBOSE` | `false` | Show complete Docker version |
### Amazon Web Services (AWS) (`aws`)
Shows selected Amazon Web Services profile configured using [`AWS_PROFILE`](http://docs.aws.amazon.com/cli/latest/userguide/cli-multiple-profiles.html) variable.
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_AWS_SHOW` | `true` | Show current selected AWS-cli profile or not |
| `SPACESHIP_AWS_PREFIX` | `using·` | Prefix before the AWS section |
| `SPACESHIP_AWS_SUFFIX` | `$SPACESHIP_PROMPT_DEFAULT_SUFFIX` | Suffix after the AWS section |
| `SPACESHIP_AWS_SYMBOL` | `☁️·` | Character to be shown before AWS profile |
| `SPACESHIP_AWS_COLOR` | `208` | Color of AWS section |
### Virtualenv (`venv`)
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_VENV_SHOW` | `true` | Show current Python virtualenv or not |
| `SPACESHIP_VENV_PREFIX` | `$SPACESHIP_PROMPT_DEFAULT_PREFIX` | Prefix before the virtualenv section |
| `SPACESHIP_VENV_SUFFIX` | `$SPACESHIP_PROMPT_DEFAULT_SUFFIX` | Suffix after the virtualenv section |
| `SPACESHIP_VENV_SYMBOL` | `·` | Character to be shown before virtualenv |
| `SPACESHIP_VENV_GENERIC_NAMES` | `(virtualenv venv .venv)` | If the virtualenv folder is in this *array*, than use its parent directory as its name instead |
| `SPACESHIP_VENV_COLOR` | `blue` | Color of virtualenv environment section |
### Conda virtualenv (`conda`)
Show activated conda virtual environment. Disable native conda prompt by `conda config --set changeps1 False`.
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_CONDA_SHOW` | `true` | Show current Python conda virtualenv or not |
| `SPACESHIP_CONDA_PREFIX` | `$SPACESHIP_PROMPT_DEFAULT_PREFIX` | Prefix before the conda virtualenv section |
| `SPACESHIP_CONDA_SUFFIX` | `$SPACESHIP_PROMPT_DEFAULT_SUFFIX` | Suffix after the conda virtualenv section |
| `SPACESHIP_CONDA_SYMBOL` | `🅒·` | Character to be shown before conda virtualenv section |
| `SPACESHIP_CONDA_COLOR` | `blue` | Color of conda virtualenv environment section |
### Pyenv (`pyenv`)
pyenv section is shown only in directories that contain `requirements.txt`, `pyproject.toml` or any other file with `.py` extension.
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_PYENV_SHOW` | `true` | Show current Pyenv version or not |
| `SPACESHIP_PYENV_PREFIX` | `$SPACESHIP_PROMPT_DEFAULT_PREFIX` | Prefix before the pyenv section |
| `SPACESHIP_PYENV_SUFFIX` | `$SPACESHIP_PROMPT_DEFAULT_SUFFIX` | Suffix after the pyenv section |
| `SPACESHIP_PYENV_SYMBOL` | `🐍·` | Character to be shown before Pyenv version |
| `SPACESHIP_PYENV_COLOR` | `yellow` | Color of Pyenv section |
### .NET (`dotnet`)
.NET section is shown only in directories that contains a `project.json` or `global.json` file, or a file with one of these extensions: `.csproj`, `.xproj` or `.sln`.
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_DOTNET_SHOW` | `true` | Current .NET section |
| `SPACESHIP_DOTNET_PREFIX` | `$SPACESHIP_PROMPT_DEFAULT_PREFIX` | Prefix before .NET section |
| `SPACESHIP_DOTNET_SUFFIX` | `$SPACESHIP_PROMPT_DEFAULT_SUFFIX` | Suffix after .NET section |
| `SPACESHIP_DOTNET_SYMBOL` | `.NET·` | Character to be shown before .NET version |
| `SPACESHIP_DOTNET_COLOR` | `128` | Color of .NET section |
### Ember.js (`ember`)
Ember.js section is shown only in directories that contain a `ember-cli-build.js` file.
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_EMBER_SHOW` | `true` | Current Ember.js section |
| `SPACESHIP_EMBER_PREFIX` | `$SPACESHIP_PROMPT_DEFAULT_PREFIX` | Prefix before Ember.js section |
| `SPACESHIP_EMBER_SUFFIX` | `$SPACESHIP_PROMPT_DEFAULT_SUFFIX` | Suffix after Ember.js section |
| `SPACESHIP_EMBER_SYMBOL` | `🐹·` | Character to be shown before Ember.js version |
| `SPACESHIP_EMBER_COLOR` | `210` | Color of Ember.js section |
### Kubectl context (`kubecontext`)
Shows the active kubectl context, which consists of a cluster name and, when working in a non-default namespace, also a namespace name.
**💡 Tip:** If your cluster name (and thus context name) is too long, you can give it a shorter name using `kubectl config rename-context very_long_context_name name`.
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_KUBECONTEXT_SHOW` | `true` | Current Kubectl context section |
| `SPACESHIP_KUBECONTEXT_PREFIX` | `at·` | Prefix before Kubectl context section |
| `SPACESHIP_KUBECONTEXT_SUFFIX` | `$SPACESHIP_PROMPT_DEFAULT_SUFFIX` | Suffix after Kubectl context section |
| `SPACESHIP_KUBECONTEXT_SYMBOL` | `☸️·` | Character to be shown before Kubectl context |
| `SPACESHIP_KUBECONTEXT_COLOR` | `cyan` | Color of Kubectl context section |
| `SPACESHIP_KUBECONTEXT_NAMESPACE_SHOW` | `true` | Should namespace be also displayed |
| `SPACESHIP_KUBECONTEXT_COLOR_GROUPS` | ` ` | _Array_ of pairs of colors and match patterns, empty by default |
**Color Groups:** To set the section to a different color based on context or namespace, you can define an array of pair values in which the first value of a pair is a color name to use and the second value is a regular expression pattern to match against the section text (context name and/or namespace). The first matched pattern will determine the color, so list order can be used to prioritize patterns.
For example, add the following to your `.zshrc` file:
```zsh
SPACESHIP_KUBECONTEXT_COLOR_GROUPS=(
# red if namespace is "kube-system"
red '\(kube-system)$'
# else, green if "dev-01" is anywhere in the context or namespace
green dev-01
# else, red if context name ends with ".k8s.local" _and_ namespace is "system"
red '\.k8s\.local \(system)$'
# else, yellow if the entire content is "test-" followed by digits, and no namespace is displayed
yellow '^test-[0-9]+$'
)
```
### Terraform workspace (`terraform`)
Shows the active Terraform wokspace in directories that contain `.terraform/environment` file.
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_TERRAFORM_SHOW` | `true` | Current Terraform workspace section |
| `SPACESHIP_TERRAFORM_PREFIX` | `$SPACESHIP_PROMPT_DEFAULT_PREFIX` | Prefix before Terraform workspace section |
| `SPACESHIP_TERRAFORM_SUFFIX` | `$SPACESHIP_PROMPT_DEFAULT_SUFFIX` | Suffix after Terraform workspace section |
| `SPACESHIP_TERRAFORM_SYMBOL` | `🛠️·` | Character to be shown before Terraform workspace |
| `SPACESHIP_TERRAFORM_COLOR` | `105` | Color of Terraform workspace section |
### Execution time (`exec_time`)
Execution time of the last command. Will be displayed if it exceeds the set threshold of time.
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_EXEC_TIME_SHOW` | `true` | Show execution time |
| `SPACESHIP_EXEC_TIME_PREFIX` | `took·` | Prefix before execution time section |
| `SPACESHIP_EXEC_TIME_SUFFIX` | `$SPACESHIP_PROMPT_DEFAULT_SUFFIX` | Suffix after execution time section |
| `SPACESHIP_EXEC_TIME_COLOR` | `yellow` | Color of execution time section |
| `SPACESHIP_EXEC_TIME_ELAPSED` | `2` | The minimum number of seconds for showing execution time section |
### Battery (`battery`)
By default, Battery section is shown only if battery level is below `SPACESHIP_BATTERY_THRESHOLD` (default: 10%).
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_BATTERY_SHOW` | `true` | Show battery section or not (`true`, `false`, `always` or `charged`) |
| `SPACESHIP_BATTERY_PREFIX` | ` ` | Prefix before battery section |
| `SPACESHIP_BATTERY_SUFFIX` | `SPACESHIP_PROMPT_DEFAULT_SUFFIX` | Suffix after battery section |
| `SPACESHIP_BATTERY_SYMBOL_CHARGING` | `⇡` | Character to be shown if battery is charging |
| `SPACESHIP_BATTERY_SYMBOL_DISCHARGING` | `⇣` | Character to be shown if battery is discharging |
| `SPACESHIP_BATTERY_SYMBOL_FULL` | `•` | Character to be shown if battery is full |
| `SPACESHIP_BATTERY_THRESHOLD` | 10 | Battery level below which battery section will be shown |
`SPACESHIP_BATTERY_SHOW` defines when to show battery section. Here are possible values:
| `SPACESHIP_BATTERY_SHOW` | Below threshold | Above threshold | Fully charged |
| :----------------------: | :-------------- | :-------------- | :------------ |
| `false` | Hidden | Hidden | Hidden |
| `always` | Shown | Shown | Shown |
| `true` | Shown | Hidden | Hidden |
| `charged` | Shown | Hidden | Shown |
### Vi-mode (`vi_mode`)
This section shows mode indicator only when Vi-mode is enabled.
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_VI_MODE_SHOW` | `true` | Shown current Vi-mode or not |
| `SPACESHIP_VI_MODE_PREFIX` | ` ` | Prefix before Vi-mode section |
| `SPACESHIP_VI_MODE_SUFFIX` | `$SPACESHIP_PROMPT_DEFAULT_SUFFIX` | Suffix after Vi-mode section |
| `SPACESHIP_VI_MODE_INSERT` | `[I]` | Text to be shown when in insert mode |
| `SPACESHIP_VI_MODE_NORMAL` | `[N]` | Text to be shown when in normal mode |
| `SPACESHIP_VI_MODE_COLOR` | `white` | Color of Vi-mode section |
You can temporarily enable or disable vi-mode with handy functions (just execute them in terminal as any other regular command):
| Function | Meaning |
| :------- | ------- |
| `spaceship_vi_mode_enable` | Enable vi-mode for current terminal session |
| `spaceship_vi_mode_disable` | Disable vi-mode for current terminal session |
**Note:** For oh-my-zsh users with vi-mode plugin enabled: Add `export RPS1="%{$reset_color%}"` before `source $ZSH/oh-my-zsh.sh` in `.zshrc` to disable default `<<<` NORMAL mode indicator in right prompt.
### Jobs (`jobs`)
This section show only when there are active jobs in the background.
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_JOBS_SHOW` | `true` | Show background jobs indicator |
| `SPACESHIP_JOBS_PREFIX` | ` ` | Prefix before the jobs indicator |
| `SPACESHIP_JOBS_SUFFIX` | ` ` | Suffix after the jobs indicator |
| `SPACESHIP_JOBS_SYMBOL` | `✦` | Character to be shown when jobs are hiding |
| `SPACESHIP_JOBS_COLOR` | `blue` | Color of background jobs section |
| `SPACESHIP_JOBS_AMOUNT_PREFIX` | ` ` | Prefix before the number of jobs (between jobs indicator and jobs amount) |
| `SPACESHIP_JOBS_AMOUNT_SUFFIX` | ` ` | Suffix after the number of jobs |
| `SPACESHIP_JOBS_AMOUNT_THRESHOLD` | `1` | Number of jobs after which job count will be shown |
### Exit code (`exit_code`)
Disabled by default. Set `SPACESHIP_EXIT_CODE_SHOW` to `true` in your `.zshrc`, if you need to show exit code of last command.
| Variable | Default | Meaning |
| :------- | :-----: | ------- |
| `SPACESHIP_EXIT_CODE_SHOW` | `false` | Show exit code of last command |
| `SPACESHIP_EXIT_CODE_PREFIX` | ` ` | Prefix before exit code section |
| `SPACESHIP_EXIT_CODE_SUFFIX` | ` ` | Suffix after exit code section |
| `SPACESHIP_EXIT_CODE_SYMBOL` | `✘` | Character to be shown before exit code |
| `SPACESHIP_EXIT_CODE_COLOR` | `red` | Color of exit code section |
## Need more?
If these options are not enough to do what you want, read more about Spaceship's API on [API page](./API.md) of the documentation.

View File

@ -0,0 +1,61 @@
# Summary
* [Home](/README.md)
* [Options](/docs/Options.md)
* [Order](/docs/Options.md#order)
* [Prompt](/docs/Options.md#prompt)
* [Char (char)](/docs/Options.md#char)
* [Time (time)](/docs/Options.md#time-time)
* [Username (user)](/docs/Options.md#username-user)
* [Hostname (host)](/docs/Options.md#hostname-host)
* [Directory (dir)](/docs/Options.md#directory-dir)
* [Git (git)](/docs/Options.md#git-git)
* [Git branch (git_branch)](/docs/Options.md#git-branch-gitbranch)
* [Git status (git_status)](/docs/Options.md#git-status-gitstatus)
* [Mercurial (hg)](/docs/Options.md#mercurial-hg)
* [Mercurial branch (hg_branch)](/docs/Options.md#mercurial-branch-hg_branch)
* [Mercurial status (hg_status)](/docs/Options.md#mercurial-status-hg_status)
* [Package version (package)](/docs/Options.md#package-version-package)
* [Node (node)](/docs/Options.md#nodejs-node)
* [Ruby (ruby)](/docs/Options.md#ruby-ruby)
* [Elm (elm)](/docs/Options.md#elm-elm)
* [Elixir (elixir)](/docs/Options.md#elixir-elixir)
* [Xcode (xcode)](/docs/Options.md#xcode-xcode)
* [Swift (swift)](/docs/Options.md#swift-swift)
* [Go (go)](/docs/Options.md#go-golang)
* [PHP (php)](/docs/Options.md#php-php)
* [Rust (rust)](/docs/Options.md#rust-rust)
* [Haskell (haskell)](/docs/Options.md#haskell-haskell)
* [Julia (julia)](/docs/Options.md#julia-julia)
* [Docker (docker)](/docs/Options.md#docker-docker)
* [Amazon Web Services (aws)](/docs/Options.md#amazon-web-services-aws-aws)
* [Virtualenv (venv)](/docs/Options.md#virtualenv-venv)
* [Conda Virtualenv (conda)](/docs/Options.md#conda-virtualenv-conda)
* [Pyenv (pyenv)](/docs/Options.md#pyenv-pyenv)
* [.NET (dotnet)](/docs/Options.md#net-dotnet)
* [Ember (ember)](/docs/Options.md#emberjs-ember)
* [Kubectl context (kubecontext)](/docs/Options.md#kubectl-context-kubecontext)
* [Terraform workspace (terraform)](/docs/Options.md#terraform-workspace-terraform)
* [Execution time (exec_time)](/docs/Options.md#execution-time-exec_time)
* [Battery (battery)](/docs/Options.md#battery-battery)
* [Vi-mode (vi_mode)](/docs/Options.md#vi-mode-vi_mode)
* [Background Jobs (jobs)](/docs/Options.md#jobs-jobs)
* [Exit code (exit_code)](/docs/Options.md#exit-code-exit_code)
* [Contributing Guide](/CONTRIBUTING.md)
* [Philosophy](/CONTRIBUTING.md#philosophy)
* [Setup](/CONTRIBUTING.md#setup)
* [Sections](/CONTRIBUTING.md#sections)
* [API](/docs/API.md)
* [Typical section](/docs/API.md#typical-section)
* [SPACESHIP_VERSION](/docs/API.md#spaceshipversion)
* [SPACESHIP_ROOT](/docs/API.md#spaceshiproot)
* [spaceship::section](/docs/API.md#spaceshipsection-color-prefix-content-suffix)
* [spaceship::exists](/docs/API.md#spaceshipexists-command)
* [spaceship::defined](/docs/API.md#spaceshipdefined-function)
* [spaceship::is_git](/docs/API.md#spaceshipisgit)
* [spaceship::is_hg](/docs/API.md#spaceshipishg)
* [spaceship::deprecated](/docs/API.md#spaceshipdeprecated-option-message)
* [spaceship::displaytime](/docs/API.md#spaceshipdisplaytime-seconds)
* [spaceship::union](/docs/API.md#spaceshipunion-arr1-arr2-)
* [Troubleshooting](/docs/Troubleshooting.md)

View File

@ -0,0 +1,127 @@
# Troubleshooting
This page aimed to help you fix the common problems encountered while using Spaceship prompt.
## What's the weird symbol for `git` branch?
You need to have a powerline patched font in order to properly display `git` branch symbol.
* Install any powerline compatible font like [Fira Code](https://github.com/tonsky/FiraCode) or [others](https://github.com/powerline/fonts).
* Configure your terminal emulator to [use that font](https://powerline.readthedocs.io/en/master/troubleshooting/osx.html).
## What's the weird character in front of a section?
This is not an issue with Spaceship prompt. Spaceship uses Unicode symbols to represent `SPACESHIP_*_SYMBOL` in sections. To solve this problem:
* Verify your terminal emulator support Unicode characters with this command:
```zsh
curl http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-demo.txt
# or
wget -O - http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-demo.txt
```
* Configure your terminal emulator to use UTF-8 as character encoding.
In case Unicode symbols aren't supported, you can replace them to those that are compatible with your terminal with `SPACESHIP_*_SYMBOL` options. Check out [Options](./docs/Options.md) page for more information.
## What is the `[I]` before prompt character ?
That's [`vi_mode`](https://github.com/denysdovhan/spaceship-prompt/blob/master/docs/Options.md#vi-mode-vi_mode) section indicating `insert` mode. You can disable that with following line in your configuration,
```
SPACESHIP_VI_MODE_SHOW=false
```
## Why is my prompt slow?
Spaceship may work slower in big repositories since status checkings are quite a heavy operation. In this case, try to avoid having many uncommitted files.
Using `grep` to fetch package version wasn't returning accurate information. So now we use `jq` with fallbacks to `python` and `node`, Which might slightly affect performance. In that case install [jq](https://stedolan.github.io/jq/) (see [#439], [#441] for more information).
[#439]: https://github.com/denysdovhan/spaceship-prompt/issues/439
[#441]: https://github.com/denysdovhan/spaceship-prompt/pull/441
Prompt also may slow down because of loading of unused sections. Spaceship loads only sections mentioned in `SPACESHIP_PROMPT_ORDER` or `SPACESHIP_RPROMPT_ORDER`. If you think some sections might be useless for you, try to disable them by omitting their names in order options.
In the example below, `time`, `package`, `xcode`, `julia`, `docker`, `ember` and `vi_mode` sections are disabled so that they won't be loaded at all.
```zsh
# Just comment a section if you want to disable it
SPACESHIP_PROMPT_ORDER=(
# time # Time stamps section (Disabled)
user # Username section
dir # Current directory section
host # Hostname section
git # Git section (git_branch + git_status)
hg # Mercurial section (hg_branch + hg_status)
# package # Package version (Disabled)
node # Node.js section
ruby # Ruby section
elixir # Elixir section
# xcode # Xcode section (Disabled)
swift # Swift section
golang # Go section
php # PHP section
rust # Rust section
haskell # Haskell Stack section
# julia # Julia section (Disabled)
# docker # Docker section (Disabled)
aws # Amazon Web Services section
venv # virtualenv section
conda # conda virtualenv section
pyenv # Pyenv section
dotnet # .NET section
# ember # Ember.js section (Disabled)
kubecontext # Kubectl context section
terraform # Terraform workspace section
exec_time # Execution time
line_sep # Line break
battery # Battery level and status
# vi_mode # Vi-mode indicator (Disabled)
jobs # Background jobs indicator
exit_code # Exit code section
char # Prompt character
)
```
Disabling a lot of unused section may achieve a significant performance boost. Here's a comparison of rendering Spaceship prompt 100 times with all sections enabled and with `SPACESHIP_PROMPT_ORDER` from example above:
| | All section | With disabled sections |
| :---------------- | :---------: | :--------------------: |
| Inside Git repo* | `23.5s` | `21.3s` |
| Outside Git repo* | `8.3s` | `7.4s` |
\* — `spaceship-prompt` repo is used in this test.
## Some section icons overlap each other?
![](https://user-images.githubusercontent.com/3459374/34945188-1f6398be-fa0b-11e7-9845-a744bc3e148d.png)
This issue is related to how your terminal emulator renders Unicode 9 characters. To fix this issue:
* Make sure terminal uses _Unicode Version 9 Widths_.
* Let your terminal render ambiguous-width characters as double-width.
In _iTerm_ follow these instructions:
* Go _iTerm → Preferences… (⌘,) → Profiles → Text_
* Check _Unicode Version 9 Widths_.
* Check _Threat ambiguous-width characters as double-width_.
* Reload terminal's tab.
## Why doesn't my prompt look like the preview?
![preview](https://user-images.githubusercontent.com/10276208/36086434-5de52ace-0ff2-11e8-8299-c67f9ab4e9bd.gif)
Preview shows `spaceship` prompt setup with:
* [Hyper](https://hyper.is) as terminal emulator.
* [One Dark](https://www.npmjs.com/package/hyperterm-atom-dark) color theme from [Atom](https://atom.io/) editor.
* [Fira Code](https://github.com/tonsky/FiraCode) with with ligatures as primary font (16px size).
* [zsh-syntax-highlighting](https://github.com/zsh-users/zsh-syntax-highlighting) to have commands colorized.
* [zsh-autosuggestions](https://github.com/zsh-users/zsh-autosuggestions) to have browser-like autocompletions.
See [screenshots](https://github.com/denysdovhan/spaceship-prompt/wiki/Screenshots) wiki for more color schemes examples.
## Does not help?
If any of above does not help, please, [file an issue](https://github.com/denysdovhan/spaceship-prompt/issues/new), describe your problem and we will gladly help you.

View File

@ -0,0 +1,29 @@
# ------------------------------------------------------------------------------
# HOOKS
# Zsh hooks for advanced actions
# custom hooks for sections
# ------------------------------------------------------------------------------
# TODO: Let sections register their own hooks via `spaceship::register_hook`
# Execution time start
spaceship_exec_time_preexec_hook() {
[[ $SPACESHIP_EXEC_TIME_SHOW == false ]] && return
SPACESHIP_EXEC_TIME_start=$(date +%s)
}
# Execution time end
spaceship_exec_time_precmd_hook() {
[[ $SPACESHIP_EXEC_TIME_SHOW == false ]] && return
[[ -n $SPACESHIP_EXEC_TIME_duration ]] && unset SPACESHIP_EXEC_TIME_duration
[[ -z $SPACESHIP_EXEC_TIME_start ]] && return
local SPACESHIP_EXEC_TIME_stop=$(date +%s)
SPACESHIP_EXEC_TIME_duration=$(( $SPACESHIP_EXEC_TIME_stop - $SPACESHIP_EXEC_TIME_start ))
unset SPACESHIP_EXEC_TIME_start
}
# vcs_info hook
spaceship_exec_vcs_info_precmd_hook() {
[[ $SPACESHIP_GIT_BRANCH_SHOW == false ]] && return
vcs_info
}

View File

@ -0,0 +1,55 @@
# Internal variable for checking if prompt is opened
spaceship_prompt_opened="$SPACESHIP_PROMPT_FIRST_PREFIX_SHOW"
# Draw prompt section (bold is used as default)
# USAGE:
# spaceship::section <color> [prefix] <content> [suffix]
spaceship::section() {
local color prefix content suffix
[[ -n $1 ]] && color="%F{$1}" || color="%f"
[[ -n $2 ]] && prefix="$2" || prefix=""
[[ -n $3 ]] && content="$3" || content=""
[[ -n $4 ]] && suffix="$4" || suffix=""
[[ -z $3 && -z $4 ]] && content=$2 prefix=''
echo -n "%{%B%}" # set bold
if [[ $spaceship_prompt_opened == true ]] && [[ $SPACESHIP_PROMPT_PREFIXES_SHOW == true ]]; then
echo -n "$prefix"
fi
spaceship_prompt_opened=true
echo -n "%{%b%}" # unset bold
echo -n "%{%B$color%}" # set color
echo -n "$content" # section content
echo -n "%{%b%f%}" # unset color
echo -n "%{%B%}" # reset bold, if it was diabled before
if [[ $SPACESHIP_PROMPT_SUFFIXES_SHOW == true ]]; then
echo -n "$suffix"
fi
echo -n "%{%b%}" # unset bold
}
# Compose whole prompt from sections
# USAGE:
# spaceship::compose_prompt [section...]
spaceship::compose_prompt() {
# Option EXTENDED_GLOB is set locally to force filename generation on
# argument to conditions, i.e. allow usage of explicit glob qualifier (#q).
# See the description of filename generation in
# http://zsh.sourceforge.net/Doc/Release/Conditional-Expressions.html
setopt EXTENDED_GLOB LOCAL_OPTIONS
# Treat the first argument as list of prompt sections
# Compose whole prompt from diferent parts
# If section is a defined function then invoke it
# Otherwise render the 'not found' section
for section in $@; do
if spaceship::defined "spaceship_$section"; then
spaceship_$section
else
spaceship::section 'red' "'$section' not found"
fi
done
}

View File

@ -0,0 +1,80 @@
# ------------------------------------------------------------------------------
# UTILS
# Utils for common used actions
# ------------------------------------------------------------------------------
# Check if command exists in $PATH
# USAGE:
# spaceship::exists <command>
spaceship::exists() {
command -v $1 > /dev/null 2>&1
}
# Check if function is defined
# USAGE:
# spaceship::defined <function>
spaceship::defined() {
typeset -f + "$1" &> /dev/null
}
# Check if the current directory is in a Git repository.
# USAGE:
# spaceship::is_git
spaceship::is_git() {
# See https://git.io/fp8Pa for related discussion
[[ $(command git rev-parse --is-inside-work-tree 2>/dev/null) == true ]]
}
# Check if the current directory is in a Mercurial repository.
# USAGE:
# spaceship::is_hg
spaceship::is_hg() {
local root="$(pwd -P)"
while [ $root ] && [ ! -d $root/.hg ]; do
root="${root%/*}"
done
[[ -n "$root" ]] &>/dev/null
}
# Print message backward compatibility warning
# USAGE:
# spaceship::deprecated <deprecated> [message]
spaceship::deprecated() {
[[ -n $1 ]] || return
local deprecated=$1 message=$2
local deprecated_value=${(P)deprecated} # the value of variable name $deprecated
[[ -n $deprecated_value ]] || return
print -P "%{%B%}$deprecated%{%b%} is deprecated. $message"
}
# Display seconds in human readable fromat
# Based on http://stackoverflow.com/a/32164707/3859566
# USAGE:
# spaceship::displaytime <seconds>
spaceship::displaytime() {
local T=$1
local D=$((T/60/60/24))
local H=$((T/60/60%24))
local M=$((T/60%60))
local S=$((T%60))
[[ $D > 0 ]] && printf '%dd ' $D
[[ $H > 0 ]] && printf '%dh ' $H
[[ $M > 0 ]] && printf '%dm ' $M
printf '%ds' $S
}
# Union of two or more arrays
# USAGE:
# spaceship::union [arr1[ arr2[ ...]]]
# EXAMPLE:
# $ arr1=('a' 'b' 'c')
# $ arr2=('b' 'c' 'd')
# $ arr3=('c' 'd' 'e')
# $ spaceship::union $arr1 $arr2 $arr3
# > a b c d e
spaceship::union() {
typeset -U sections=("$@")
echo $sections
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,354 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Слой_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 1288.1 1288.1" style="enable-background:new 0 0 1288.1 1288.1;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
.st1{fill:#181A3E;stroke:#C34435;stroke-width:20;stroke-miterlimit:10;}
.st2{fill:#C34435;}
.st3{clip-path:url(#SVGID_2_);}
.st4{clip-path:url(#SVGID_4_);}
.st5{fill:#181A3E;}
.st6{fill:none;stroke:#181A3E;stroke-width:20;stroke-miterlimit:10;}
.st7{enable-background:new ;}
.st8{fill:#FFFFFF;stroke:#181A3E;stroke-width:10;stroke-miterlimit:10;}
</style>
<symbol id="Новый_символ_2" viewBox="-31.5 -31.5 62.9 62.9">
<polygon class="st0" points="0,-1.6 31.5,0 0,1.6 -31.5,0 "/>
<polygon class="st0" points="-1.6,0 0,-31.5 1.6,0 0,31.5 "/>
<polygon class="st0" points="-1.1,-1.1 -16,16 1.1,1.1 16,-16 "/>
<polygon class="st0" points="-1.1,1.1 16,16 1.1,-1.1 -16,-16 "/>
</symbol>
<title>red-blue outlined letters, stars and rays</title>
<circle class="st1" cx="644.7" cy="719.7" r="429.3"/>
<path class="st2" d="M644.5,150.9c0.3,0,5.7,0.1,5.7,8.7c0,1.4,0.8,9.4,1.4,10c17.8,23,51.7,74.4,51.7,143.9v111.1l6.2,14v6.5h-1.1
v5l10.3,15.4c0,0,8.3,1.1,11.9,6.5s27.6,41.2,29,43s1.3,4.8,0,5.5c-0.9,0.5-1.8,1.1-2.7,1.8l11.2,14.6l3.4,22.3V633l-9.7,15.4v144
l2.8,7.3h7.9c3.8,0,4.1,10-0.2,10h-2.7l8.5,10.5v7l36.8,36.8c4,4,10.3,17.4,10.3,33.3v30.7l-53.5,9.9v71.4l-9.1,12.4h-10
c0,0,4.7,8.9,4.7,17.7h-63.1c-0.1-6.2,1.5-12.4,4.4-17.9H691c0-4.7,2.1-6.3,2.1-6.3l-0.8-0.6V987c0,0-2.1,12.7-12.3,18.1
c0,0,5.2,12.7,6.5,21.4c1.2,8.7,1.3,12.5,2.8,12.5h-40.9c1.3,0,3.2-7.5,3.8-12.6c0.8-6.4,6.3-21.6,6.3-21.6
c-4.9-2.1-8.7-6.3-10.1-11.5c0,0-1.2,48-2.5,48h-3.5c-1.3,0-2.5-48-2.5-48c-1.5,5.2-5.2,9.4-10.1,11.5c0,0,5.5,15.2,6.3,21.6
c0.6,5.1,2.5,12.6,3.8,12.6h-40.8c1.5,0,1.6-3.8,2.8-12.5s6.5-21.4,6.5-21.4c-10.2-5.4-12.3-18.1-12.3-18.1v27.2l-0.8,0.6
c0,0,2.1,1.6,2.1,6.3h-7.7c2.9,5.5,4.5,11.7,4.4,17.9h-63.1c0-8.7,4.7-17.7,4.7-17.7h-10l-9.1-12.4v-71.4l-53.5-9.9v-30.7
c0-16,6.3-29.3,10.3-33.3l36.8-36.8v-7l8.5-10.5h-2.8c-4.3,0-4-10-0.2-10h7.9l2.8-7.3v-144l-9.6-15.3v-73.8l3.4-22.3l11.2-14.6
c-0.9-0.6-1.8-1.2-2.7-1.8c-1.3-0.7-1.4-3.7,0-5.5s25.4-37.6,29-43s11.9-6.5,11.9-6.5l10.3-15.4v-5.1h-1.1v-6.5l6.2-14v-111
c0-69.4,33.4-119.4,49.2-142.9c0,0-0.6-0.3-0.6-1.7s1.2-4,2.6-6.3s1.3-7.2,2.3-8.8c1.2-1.8,3.3-2.9,5.4-2.9L644.5,150.9
M639.8,1039.1L639.8,1039.1 M644.5,130.9h-0.9c-9.1,0-17.6,4.7-22.5,12.4c-2,3.4-3.2,7.2-3.7,11.1v0.1c-1.9,3.2-3.2,6.8-3.9,10.5
c-11.1,16.4-20.6,33.8-28.5,51.9c-13.5,31.4-20.3,63.9-20.3,96.5v106.9l-4.5,10.1l-1.7,3.9v11.3l-1.8,2.7
c-6.4,2.5-11.9,6.8-15.9,12.4l-5.5,8.1c-6.9,10.3-21.3,31.7-23.1,34.2c-3.6,4.9-5.3,11-4.8,17.1l-3.4,4.5l-3.1,4.1l-0.8,5.1
l-3.4,22.3l-0.2,1.5v81.1l3.1,4.9l6.6,10.5v127.6c-4.6,2.2-8.3,5.8-10.6,10.2c-2,3.9-3,8.3-3,12.7c0,1.6,0.1,3.2,0.4,4.7l-3,3.6v5.7
l-31,30.9c-7.8,7.8-16.2,26-16.2,47.5v47.4l16.4,3l37.1,6.8v61.3l3.9,5.3l9.1,12.4l1.6,2.1c-0.1,1.2-0.1,2.4-0.1,3.7v20H633
c2.9,1.5,6,2.3,9.3,2.3h3.5c3.2,0,6.4-0.8,9.3-2.3h122.3v-20c0-1.2,0-2.5-0.2-3.7l1.6-2.1l9.1-12.4l3.9-5.3v-61.3l37.2-6.8l16.4-3
v-47.3c0-21.5-8.4-39.7-16.2-47.5l-31-30.9V813l-2.9-3.6c0.3-1.6,0.4-3.1,0.4-4.7c0-4.4-1-8.8-3-12.7c-2.3-4.5-6.1-8.1-10.6-10.2
V654.1l6.6-10.5l3.1-4.9v-81.1l-0.2-1.5l-3.4-22.3l-0.8-5.1l-3.1-4.1l-3.4-4.5c0.5-6.1-1.2-12.2-4.8-17.1
c-1.8-2.5-16.8-24.8-23.2-34.4l-5.4-8c-3.9-5.6-9.5-10-15.9-12.4l-1.8-2.7v-11.3l-1.7-3.9l-4.5-10.1V313.4
c-0.1-33.6-7.2-66.8-20.8-97.4c-8.5-19.4-19.3-37.8-32.1-54.8c-0.1-0.8-0.2-1.5-0.2-2C670,140.8,656.9,130.8,644.5,130.9
L644.5,130.9z"/>
<g>
<defs>
<circle id="SVGID_1_" cx="644.7" cy="719.7" r="429.3"/>
</defs>
<clipPath id="SVGID_2_">
<use xlink:href="#SVGID_1_" style="overflow:visible;"/>
</clipPath>
<g class="st3">
<polygon class="st2" points="643.4,869.7 657.8,526.6 657.8,870.3 686.5,529.3 672.1,872.3 715,534.7 686.3,875.7 743.2,542.8
700.3,880.4 771.1,553.5 714.1,886.5 798.4,566.8 727.6,893.8 825.1,582.7 740.8,902.3 851.1,601.1 753.6,912.1 876.3,621.9
766,923.1 900.5,645 777.9,935.2 923.8,670.4 789.2,948.5 945.9,697.9 800,962.7 966.9,727.4 810.2,978 986.6,758.8 819.7,994.2
1004.9,792.1 828.5,1011.2 1021.8,827 836.5,1029.1 1037.2,863.4 843.9,1047.6 1051,901.2 850.4,1066.8 1063.2,940.3
856.1,1086.6 1073.8,980.4 861,1106.9 1082.7,1021.4 865,1127.7 1089.8,1063.2 868.1,1148.7 1095.2,1105.6 870.3,1170
1098.8,1148.4 871.7,1191.5 1100.6,1191.5 872.2,1213.1 1100.6,1234.6 871.7,1234.6 1098.8,1277.7 870.3,1256.1 1095.2,1320.5
868.1,1277.4 1089.8,1362.9 865,1298.5 1082.7,1404.7 861,1319.2 1073.8,1445.7 856.1,1339.5 1063.2,1485.8 850.4,1359.3
1051,1524.9 843.9,1378.5 1037.2,1562.7 836.5,1397.1 1021.8,1599.1 828.5,1414.9 1004.9,1634 819.7,1432 986.6,1667.3
810.2,1448.2 966.9,1698.7 800,1463.4 945.9,1728.3 789.2,1477.7 923.8,1755.8 777.9,1490.9 900.5,1781.1 766,1503 876.3,1804.2
753.6,1514 851.1,1825 740.8,1523.8 825.1,1843.4 727.6,1532.4 798.4,1859.3 714.1,1539.7 771.1,1872.6 700.3,1545.7
743.2,1883.4 686.3,1550.4 715,1891.4 672.1,1553.8 686.5,1896.8 657.8,1555.8 657.8,1899.6 643.4,1556.5 629.1,1899.6
629.1,1555.8 600.4,1896.8 614.8,1553.8 571.9,1891.4 600.6,1550.4 543.7,1883.4 586.6,1545.7 515.8,1872.6 572.8,1539.7
488.5,1859.3 559.2,1532.4 461.8,1843.4 546.1,1523.8 435.8,1825 533.3,1514 410.6,1804.2 520.9,1503 386.3,1781.1 509,1490.9
363.1,1755.8 497.6,1477.7 340.9,1728.3 486.9,1463.4 320,1698.7 476.7,1448.2 300.3,1667.3 467.2,1432 282,1634 458.4,1414.9
265.1,1599.1 450.3,1397.1 249.7,1562.7 443,1378.5 235.9,1524.9 436.5,1359.3 223.6,1485.8 430.8,1339.5 213.1,1445.7
425.9,1319.2 204.2,1404.7 421.9,1298.5 197,1362.9 418.8,1277.4 191.6,1320.5 416.5,1256.1 188.1,1277.7 415.2,1234.6
186.2,1234.6 414.7,1213.1 186.2,1191.5 415.2,1191.5 188.1,1148.4 416.5,1170 191.6,1105.6 418.8,1148.7 197,1063.2
421.9,1127.7 204.2,1021.4 425.9,1106.9 213.1,980.4 430.8,1086.6 223.6,940.3 436.5,1066.8 235.9,901.2 443,1047.6 249.7,863.4
450.3,1029.1 265.1,827 458.4,1011.2 282,792.1 467.2,994.2 300.3,758.8 476.7,978 320,727.4 486.9,962.7 340.9,697.9
497.6,948.5 363.1,670.4 509,935.2 386.3,645 520.9,923.1 410.6,621.9 533.3,912.1 435.8,601.1 546.1,902.3 461.8,582.7
559.2,893.8 488.5,566.8 572.8,886.5 515.8,553.5 586.6,880.4 543.7,542.8 600.6,875.7 571.9,534.7 614.8,872.3 600.4,529.3
629.1,870.3 629.1,526.6 "/>
</g>
</g>
<g>
<defs>
<circle id="SVGID_3_" cx="644.7" cy="719.7" r="429.3"/>
</defs>
<clipPath id="SVGID_4_">
<use xlink:href="#SVGID_3_" style="overflow:visible;"/>
</clipPath>
<g class="st4">
<path class="st5" d="M449.2,1173.8c-28.8,0-53.9-16.9-63.8-43.1c-11.3-29.9,0.8-63.3,27.2-80.7l3.1-11.2
c4.4-15.9,14.9-28,28.7-33.2c5-1.9,10.2-2.8,15.5-2.8c5.5,0,10.9,1,16.1,2.8c6.1-13.5,17.2-24,31-29.3c6.2-2.4,12.8-3.6,19.5-3.6
c25.8,0,49.8,17.7,59.8,44c12.9,34-1.7,71.1-32.5,82.8c-6.2,2.4-12.8,3.6-19.5,3.6l0,0c-4.7,0-9.4-0.6-14-1.8
c1.4,29.2-16.9,56.8-45.6,67.8C466.5,1172.2,457.9,1173.8,449.2,1173.8z M441.9,1038.7c-4.1,0-8.2,0.7-12,2.2
c-2.1,0.8-4,1.8-5.9,3c0.9-0.4,1.8-0.8,2.8-1.1c5.1-1.9,10.3-3.3,15.7-4L441.9,1038.7z"/>
<path class="st2" d="M526.5,977.7c23.1,0,45.7,15.8,55.1,40.8c11.9,31.5-1.3,65.7-29.7,76.4c-5.7,2.1-11.7,3.2-17.7,3.2
c-6.8,0-13.5-1.3-19.8-3.9c5,29.1-12,59-41.6,70.2c-7.6,2.9-15.6,4.4-23.8,4.4c-25.8,0-49.8-15.1-59.1-39.9
c-12.2-32.3,5-68.8,38.5-81.5c7.6-2.9,15.6-4.4,23.7-4.4c7.4,0,14.7,1.2,21.6,3.7c-9.4-8.3-20.8-13-32-13c-7.6,0-15,2.2-21.4,6.4
c3.9-13.9,12.8-25,25.6-29.9c4.4-1.7,9-2.5,13.7-2.5c6.5,0.1,12.9,1.5,18.8,4.3c5.3-14.2,15.8-25.7,30.2-31.1
C514.4,978.8,520.4,977.7,526.5,977.7 M526.5,967.7c-7.3,0-14.5,1.3-21.2,3.9c-13.6,5.2-25,15.1-31.9,28
c-4.4-1.2-8.9-1.8-13.5-1.8c-5.9,0-11.8,1.1-17.3,3.2c-15.3,5.8-26.8,19.1-31.7,36.6l-2.6,9.4c-27.3,19-39.6,54.1-27.6,85.6
c5.3,13.9,14.8,25.8,27.3,34c12.2,8.1,26.6,12.4,41.2,12.3c9.3,0,18.6-1.7,27.3-5c28.7-10.9,47.6-37.4,48.9-66.3
c3,0.4,6,0.7,9,0.7c7.3,0,14.5-1.3,21.2-3.9c33.4-12.7,49.3-52.7,35.5-89.3C580.3,986.7,554.4,967.7,526.5,967.7L526.5,967.7z"/>
<path class="st5" d="M839,1173.8c-8.7,0-17.4-1.6-25.5-4.7c-28.8-10.9-47-38.6-45.6-67.8c-4.6,1.2-9.3,1.7-14,1.8
c-6.7,0-13.3-1.2-19.5-3.6c-30.8-11.7-45.4-48.8-32.5-82.8c10-26.3,34-44,59.8-44c6.7,0,13.3,1.2,19.5,3.6
c13.8,5.3,25,15.8,31.1,29.3c5.2-1.8,10.6-2.8,16.1-2.8c5.3,0,10.5,0.9,15.5,2.8c13.8,5.2,24.2,17.3,28.7,33.2l3.1,11.2
c10.8,7.1,19.5,17,25,28.7c7.8,16.3,8.7,35.1,2.2,52C892.8,1156.9,867.8,1173.8,839,1173.8z M845.7,1038.7
c5.4,0.7,10.6,2.1,15.7,4c0.9,0.4,1.8,0.7,2.8,1.1c-5.3-3.4-11.5-5.2-17.9-5.1L845.7,1038.7z"/>
<path class="st2" d="M761.6,977.7c6,0,12,1.1,17.7,3.2c14.4,5.5,24.9,17,30.2,31.1c5.9-2.8,12.3-4.3,18.8-4.3
c4.7,0,9.3,0.8,13.7,2.5c12.8,4.9,21.8,16,25.6,29.9c-6.3-4.2-13.8-6.5-21.4-6.4c-11.2,0-22.5,4.7-32,13
c6.9-2.4,14.2-3.7,21.6-3.7c8.1,0,16.1,1.5,23.7,4.4c33.5,12.7,50.8,49.2,38.5,81.5c-9.4,24.8-33.4,39.9-59.2,39.9
c-8.1,0-16.2-1.5-23.8-4.4c-29.7-11.2-46.6-41.1-41.6-70.2c-6.3,2.5-13,3.8-19.8,3.9c-6,0-12-1.1-17.7-3.2
c-28.3-10.7-41.6-44.9-29.7-76.4C715.9,993.4,738.5,977.7,761.6,977.7 M761.6,967.7L761.6,967.7L761.6,967.7
c-27.9,0-53.8,19-64.5,47.2c-6.6,17.1-6.7,36-0.2,53.1c6.6,17.1,19.3,29.9,35.7,36.2c6.8,2.6,14,3.9,21.2,3.9c3,0,6-0.2,9-0.7
c1.2,28.9,20.1,55.4,48.9,66.3c8.7,3.3,18,5,27.3,5c14.7,0,29-4.2,41.2-12.3c29.7-19.5,40.3-58,24.8-90
c-5.6-11.9-14.3-22.2-25.2-29.7l-2.6-9.4c-4.9-17.4-16.4-30.8-31.7-36.6c-5.5-2.1-11.4-3.2-17.3-3.2c-4.6,0-9.1,0.6-13.5,1.8
c-6.9-12.9-18.2-22.8-31.9-28c-6.8-2.6-14-3.9-21.2-3.9L761.6,967.7z"/>
<rect x="500.8" y="1015.4" class="st5" width="286.4" height="153.9"/>
<path class="st2" d="M595,1030.7c0,0-17.8,32.3,31.5,104.4c0,0-1-19.2,5.3-31.1c0,0,16.5,42,17.8,56.8c0,0,23.2-48.3,18.6-80.7
c0,0,14.7,14.4,9.7,31.6c0,0,31.2-26.5,21.4-80.7L595,1030.7z"/>
<path class="st2" d="M690.9,1030.8c0,0-11.4,20.7,20.3,67.1c0,0-0.7-12.3,3.4-20c0,0,10.6,27,11.4,36.5c0,0,14.9-31.1,12-51.8
c0,0,9.5,9.2,6.2,20.3c0,0,20.1-17,13.8-51.9L690.9,1030.8z"/>
<path class="st2" d="M529.7,1030.8c0,0-11.4,20.7,20.3,67.1c0,0-0.7-12.3,3.4-20c0,0,10.6,27,11.4,36.5c0,0,14.9-31.1,12-51.8
c0,0,9.5,9.2,6.2,20.3c0,0,20.1-17,13.8-51.9L529.7,1030.8z"/>
</g>
</g>
<path class="st6" d="M366.4,921.8c-2.9,2.2-3.3,4.3,0.4,13c3.5,8.3,4.6,14.8-1.5,19.5s-14.2,2.3-20.8-6.3c-4.5-5.9-6-11.5-6.1-16.4
l7.1-0.4c0.2,4.5,1.8,8.8,4.5,12.3c3.6,4.8,6.6,5.5,8.9,3.7c2.6-2,2.2-4.7-1.2-13.2c-3.4-8.2-4.4-14.6,2.2-19.7
c7.6-5.8,16.6-0.9,22.7,7.1c5,6.5,6.4,12.8,6.1,18.2l-7.5-0.5c0.2-4.8-1.3-9.5-4.2-13.4C373.3,921.1,369.3,919.5,366.4,921.8z"/>
<path class="st6" d="M315.8,852.8c12.1-5.8,23.5-4.7,28.3,5.4c2,3.8,2.1,8.3,0.4,12.2l18.7-8.9l5,8l-56.1,26.6l-3.5-7.3l4.9-3
c-5.1-0.8-9.4-4.1-11.7-8.7C296.8,866.7,303.1,858.8,315.8,852.8z M319.2,882.4l18.6-8.8c2-3,2.3-6.8,0.7-10
c-2.7-5.7-8.5-6.7-18.5-2c-10.3,4.9-13.2,9.5-10.7,14.8C311.2,880.2,315.2,881.9,319.2,882.4z"/>
<path class="st6" d="M311.5,776.5l6.7,0.7c0.5,4.3-0.5,7.8-3.9,10.2c4.7,2.2,7.8,6.8,9.1,12.3c2,8.8-2.1,15.4-10.1,17.2
c-9,2.1-15.8-4.1-18.8-17.2l-1.4-6.1l-2.8,0.6c-5.6,1.3-7,5.3-5.6,11.3c1,3.9,2.6,7.5,4.8,10.9l-5.9,3.8c-3-4.4-5.1-9.2-6.4-14.4
c-2.7-11.5,1.4-18.4,10.4-20.5l19.2-4.5C310.2,780.3,311.2,779,311.5,776.5z M308.3,790.2l-9.5,2.2l1.2,5c2,8.5,5.8,11.2,10.8,10
c4.5-1.1,6.4-4.1,5.3-8.9C315.1,794.6,312.1,791.5,308.3,790.2L308.3,790.2z"/>
<path class="st6" d="M301.9,711.7l5.9-4.4c3.6,4.3,5.6,9.7,5.7,15.3c0.2,13.6-8.7,21.6-22.5,21.9c-13.4,0.2-23.6-7.6-23.8-21.2
c-0.2-5.6,1.6-11,5.1-15.4l5.9,4.2c-2.2,3.2-3.5,7-3.5,10.8c0.1,7,5.1,11.8,16.2,11.6s15.1-5.3,15-12.1
C305.8,718.3,304.2,714.9,301.9,711.7z"/>
<path class="st6" d="M312.7,654.5c0.7-4.1,0.2-8.3-1.6-12.1l6.3-2.9c2.7,5.2,3.5,11.1,2.4,16.8c-2.6,13.5-13.2,19.2-26.7,16.6
c-13-2.5-21.4-11.8-19.1-24.1c2.2-11.5,11.8-17.2,25.2-14.6c1.4,0.2,2.7,0.6,4.1,1l-5.5,28.8C306.8,665.1,311.5,660.8,312.7,654.5z
M291.6,662.9l3.8-20.1c-8.2-1.4-13.4,1.1-14.5,7.3C279.8,655.8,283,660.7,291.6,662.9z"/>
<path class="st6" d="M330.5,579.2c-3.3-1.4-5.4-0.7-11.1,6.8c-5.5,7.2-10.5,11.3-17.6,8.4s-9.1-11.2-4.9-21.2
c2.9-6.8,7-10.9,11.2-13.5l3.9,6c-3.8,2.4-6.7,5.9-8.5,10c-2.3,5.5-1.5,8.4,1.2,9.6c3.1,1.3,5.2-0.5,10.8-7.6s10.5-11.1,18.2-7.9
c8.9,3.7,9,13.9,5.1,23.2c-3.2,7.5-7.9,11.9-12.7,14.3l-3.3-6.7c4.2-2.3,7.6-5.9,9.5-10.3C334.5,584.9,333.9,580.7,330.5,579.2z"/>
<path class="st6" d="M335.6,514.9c-1.5-5.1-0.6-10.6,2.4-15c4.7-6.8,11-7.3,17.8-2.5l26.4,18.4l-5.4,7.7l-25.2-17.6
c-4.3-3-7.1-2.6-9.7,1c-2.4,3.4-2,8.3-0.5,12.2l25.9,18.1l-5.4,7.7l-50.6-35.4l4.5-8.2L335.6,514.9z"/>
<path class="st6" d="M380,431.1c2.4,2.4,2.4,6.2,0,8.6c-2.4,2.4-6.2,2.4-8.6,0c-2.4-2.4-2.4-6.2,0-8.6c0,0,0.1-0.1,0.1-0.1
c2.3-2.3,5.9-2.4,8.3-0.1C379.8,430.9,379.9,431,380,431.1z M416.5,469.4l8.8-8.2l4.7,5l-25.1,23.6l-4.7-5l9.5-9l-20.8-22.1
l-9.2,8.7l-4.7-5l16-15.1L416.5,469.4z"/>
<path class="st6" d="M477.2,407.6c7,11.5,7.1,22.9-2.5,28.7c-3.6,2.4-8,3-12.1,1.7l10.8,17.7l-7.4,5.8l-32.3-53.1l6.9-4.2l3.4,4.6
c0.3-5.1,3.1-9.8,7.4-12.5C461.4,390.1,469.9,395.6,477.2,407.6z M448.1,414.1l10.7,17.6c3.2,1.7,7,1.6,10-0.3
c5.4-3.3,5.8-9.2,0-18.6c-5.9-9.7-10.8-12.2-15.8-9.1C449.4,405.8,448.2,410,448.1,414.1z"/>
<path class="st6" d="M855.9,435.6l-38,10.7l-2.8-9.1l15.3-4.2c3.4-1,6.9-1.6,10.5-1.8l-32.2-20.5l4.7-7.4l32.2,20.5
c-1.5-3.3-2.4-6.8-2.9-10.3l-2.7-15.6l9.5-1.4L855.9,435.6z"/>
<path class="st6" d="M901.2,479.7c2.6,2.6,6.7,2.4,11.6,1l2.3,6.9c-7,2.3-14.5,3.7-20.2-2.2c-6.2-6.3-2-15.3-6-19.4
c-2.7-2.8-6.7-2.4-11.6-1l-2.4-6.9c6.7-2.1,14.4-3.7,20.2,2.2C901.7,466.9,897.2,475.6,901.2,479.7z"/>
<path class="st6" d="M964.1,583.3c-13.3,6.7-26,5.8-31.5-5.3c-2.3-4.2-2.6-9.1-0.8-13.5l-20.6,10.4l-5.8-8.7l61.6-31.1l4,8l-5.3,3.4
c6.2,1.1,10.8,4.5,13.2,9.3C984.8,567.3,978,576.2,964.1,583.3z M959.5,550.5L939,560.8c-2.1,3.3-2.3,7.5-0.5,11.1
c3.2,6.3,9.7,7.2,20.6,1.7c11.3-5.7,14.5-10.9,11.5-16.7C968.5,552.7,964,550.9,959.5,550.5z"/>
<path class="st6" d="M1009.8,649.8l-18,2.8l-1.8-7.2l9.7-2.5c-1.9-6.6-8.5-10.3-18.5-10.6l-17.6,4.5l2.4,9.5l-7.2,1.8l-6.8-26.6
l7.2-1.8l1.8,7l33.1-8.4l-1.8-7l7.2-1.8l3.7,14.7l-10.5,4.6c8.8,1.6,14.3,5.5,16.4,13.6C1009.7,644.8,1010,647.3,1009.8,649.8z"/>
<path class="st6" d="M991.7,732.9c-15.6,0.4-26-7.3-26.3-21.5s9.3-22.4,25.2-22.8c15.3-0.4,26,7.3,26.3,21.6
S1007.2,732.5,991.7,732.9z M990.8,699.5c-12.2,0.3-17.6,4.2-17.4,11.7s5.8,11.1,18.1,10.8c12.1-0.3,17.5-4.1,17.3-11.6
S1002.9,699.2,990.8,699.5z"/>
<path class="st6" d="M990.5,816.7l-35.6-7.4l1.9-9l34.3,7.1c5,1,7.2,1.1,7.8-1.7c0.5-2.4-0.4-5-3.3-8.1l-36.5-7.6l1.7-8.3l34.2,7.1
c5,1,7.2,1.1,7.8-1.7c0.5-2.5-0.4-5-3.3-8.1l-36.5-7.6l1.9-9.1l48,10l-1.6,7.6l-5.3-0.3c3.2,3.5,5.3,7,4.3,11.6
c-0.8,3.6-3,6.5-7.8,6.9c3.1,3.5,4.9,7.2,3.9,11.8C1004.9,815.4,1001.1,818.9,990.5,816.7z"/>
<path class="st6" d="M949.2,887c-13.5-6.3-20.6-16.8-15.4-28.1c1.8-4.4,5.6-7.7,10.1-9l-20.8-9.7l3.3-9.9l62.6,29.2l-3.8,8.2l-6-2.1
c3,5.5,3.2,11.2,0.8,16.2C974.5,893.4,963.3,893.6,949.2,887z M972.1,863.1l-20.8-9.7c-3.9,0.4-7.3,2.9-9,6.4
c-3,6.4,0.3,12,11.4,17.2c11.4,5.3,17.5,4.6,20.3-1.3C976,871.5,974.5,866.9,972.1,863.1L972.1,863.1z"/>
<path class="st6" d="M894,922.1c7-9,15.7-9.9,23.4-4l21,16.2l6.7-8.6l6,4.7l-6.7,8.6l8.7,6.7l-5.4,9l-9.6-7.5l-10.2,13.1l-5.3-5.6
l9.4-12.2l-21-16.2c-4.2-3.2-7.7-2.8-11.4,2c-2,2.5-3.2,5.5-3.7,8.6l-7.7-1.3C888.8,930.7,890.8,926,894,922.1z"/>
<g class="st7">
<path class="st0" d="M366.4,921.9c-2.8,2.2-3.3,4.3,0.4,13c3.6,8.3,4.6,14.7-1.4,19.4c-6,4.6-14.2,2.4-20.8-6.2
c-4.5-5.9-6.1-11.4-6.2-16.4l7.1-0.5c0.3,4.1,1.4,8.2,4.5,12.3c3.7,4.8,6.6,5.4,8.9,3.6c2.6-2,2.2-4.7-1.3-13.1
c-3.4-8.2-4.5-14.5,2.1-19.6c7.6-5.9,16.5-1,22.7,7c5,6.5,6.4,12.7,6.2,18.1l-7.5-0.4c0.1-4.4-1.1-9.2-4.3-13.3
C373.3,921.2,369.3,919.7,366.4,921.9z"/>
</g>
<g class="st7">
<path class="st0" d="M315.8,852.9c12.1-5.8,23.4-4.7,28.2,5.3c2,4.1,2.2,8.2,0.5,12.2l18.6-8.9l5,8l-55.9,26.7l-3.5-7.3l4.9-3
c-5.5-1.1-9.6-4.2-11.7-8.6C296.9,866.9,303.2,859,315.8,852.9z M319.3,882.5l18.6-8.9c2-3.2,2.2-6.7,0.7-9.9
c-2.7-5.7-8.5-6.6-18.4-1.9c-10.2,4.9-13.2,9.5-10.7,14.8C311.3,880.3,315.3,882,319.3,882.5z"/>
</g>
<g class="st7">
<path class="st0" d="M311.5,776.5l6.7,0.7c0.5,4.3-0.5,7.8-3.9,10.2c4.7,2.2,7.8,6.8,9.1,12.3c2,8.8-2.1,15.4-10.1,17.2
c-8.9,2.1-15.8-4.1-18.8-17.2l-1.4-6.1l-2.8,0.6c-5.6,1.3-7,5.3-5.6,11.3c0.7,2.8,2.3,6.9,4.8,10.9l-5.9,3.8
c-3.3-4.9-5.4-10-6.4-14.4c-2.7-11.6,1.4-18.4,10.4-20.5l19.2-4.5C310.2,780.3,311.3,779,311.5,776.5z M308.3,790.2l-9.5,2.2l1.2,5
c2,8.5,5.8,11.2,10.8,10c4.6-1.1,6.4-4.1,5.3-8.9C315.2,794.9,312.3,791.5,308.3,790.2z"/>
</g>
<g class="st7">
<path class="st0" d="M301.9,711.6l5.9-4.4c3.3,3.8,5.6,9.5,5.7,15.4c0.2,13.6-8.7,21.6-22.5,21.9c-13.4,0.2-23.6-7.6-23.8-21.2
c-0.1-6,1.6-11.1,5.1-15.4l5.9,4.2c-2.3,3.5-3.6,7.1-3.5,10.8c0.1,7,5.1,11.8,16.2,11.6s15.1-5.3,15-12.1
C305.8,718.3,304.2,714.9,301.9,711.6z"/>
</g>
<g class="st7">
<path class="st0" d="M312.8,654.6c0.8-4.2,0.2-7.9-1.6-12.1l6.3-2.8c2.5,4.6,3.4,10.7,2.3,16.7c-2.6,13.5-13.2,19.1-26.7,16.5
c-12.9-2.5-21.3-11.9-18.9-24.1c2.2-11.5,11.8-17.1,25.2-14.5c1.5,0.3,3,0.7,4,1l-5.6,28.6C306.9,665.1,311.6,660.8,312.8,654.6z
M291.7,662.8l3.9-20c-8.2-1.4-13.4,1.1-14.6,7.2C279.9,655.7,283.2,660.6,291.7,662.8z"/>
</g>
<g class="st7">
<path class="st0" d="M330.5,579.2c-3.3-1.4-5.4-0.7-11.1,6.8c-5.5,7.2-10.6,11.3-17.6,8.4c-7-2.9-9.1-11.2-4.9-21.2
c2.9-6.9,6.9-10.9,11.2-13.5l3.9,6c-3.4,2.3-6.5,5.3-8.5,10c-2.3,5.5-1.5,8.4,1.2,9.6c3.1,1.3,5.2-0.5,10.8-7.6
c5.5-7,10.5-11.1,18.2-7.9c8.9,3.7,9,13.9,5.1,23.2c-3.2,7.5-7.9,11.9-12.7,14.3l-3.3-6.7c3.9-2.1,7.5-5.5,9.5-10.3
C334.5,584.9,333.9,580.7,330.5,579.2z"/>
</g>
<g class="st7">
<path class="st0" d="M335.6,514.9c-1.5-5.4-0.5-10.8,2.4-15c4.7-6.8,11-7.3,17.8-2.5l26.4,18.4l-5.4,7.7l-25.2-17.6
c-4.3-3-7.1-2.6-9.7,1c-2.4,3.4-1.9,8.3-0.5,12.2l25.9,18.1l-5.4,7.7l-50.6-35.4l4.5-8.2L335.6,514.9z"/>
</g>
<g class="st7">
<path class="st0" d="M379.8,430.8c2.3,2.4,2.2,6-0.4,8.5c-2.7,2.5-6.2,2.4-8.5-0.1s-2.3-6,0.4-8.5
C373.9,428.2,377.5,428.4,379.8,430.8z M416.5,469.2l8.8-8.3l4.7,5l-25.2,23.8l-4.7-5l9.6-9l-21-22.2l-9.3,8.8l-4.7-5l16.1-15.2
L416.5,469.2z"/>
</g>
<g class="st7">
<path class="st0" d="M477.2,407.6c7,11.5,7.1,22.9-2.5,28.7c-3.9,2.4-8,3-12.1,1.7l10.8,17.7l-7.4,5.8l-32.3-53.1l6.9-4.2l3.4,4.5
c0.5-5.6,3.2-10,7.4-12.5C461.4,390.1,469.9,395.6,477.2,407.6z M448.1,414.1l10.7,17.6c3.4,1.6,6.9,1.6,10-0.3
c5.4-3.3,5.8-9.2,0-18.6c-5.9-9.7-10.8-12.2-15.8-9.1C449.4,405.8,448.2,410,448.1,414.1z"/>
</g>
<g class="st7">
<path class="st0" d="M855.9,435.6l-38,10.7l-2.8-9.1l15.3-4.1c3.7-1,7.1-1.6,10.5-1.8l-32.2-20.5l4.7-7.4l32.2,20.6
c-1.6-3.4-2.1-5.9-2.9-10.3l-2.7-15.6l9.4-1.4L855.9,435.6z"/>
</g>
<g class="st7">
<path class="st0" d="M901.2,479.7c2.6,2.7,6.7,2.4,11.6,1l2.4,6.9c-7,2.3-14.5,3.7-20.2-2.2c-6.2-6.3-2-15.3-6-19.4
c-2.7-2.8-6.7-2.4-11.6-1l-2.4-6.9c6.6-2.1,14.4-3.7,20.2,2.2C901.7,466.9,897.2,475.6,901.2,479.7z"/>
</g>
<g class="st7">
<path class="st0" d="M964.1,583.3c-13.3,6.7-26,5.8-31.6-5.3c-2.3-4.6-2.6-9.1-0.8-13.5l-20.5,10.4l-5.8-8.7l61.6-31.1l4.1,8
l-5.3,3.4c6.1,1.1,10.8,4.4,13.2,9.3C984.8,567.3,978,576.2,964.1,583.3z M959.5,550.4L939,560.8c-2.1,3.7-2.3,7.5-0.5,11.1
c3.2,6.3,9.7,7.2,20.6,1.7c11.3-5.7,14.4-10.9,11.5-16.7C968.5,552.7,964,550.9,959.5,550.4z"/>
</g>
<g class="st7">
<path class="st0" d="M1010,649.7l-18,2.8l-1.9-7.2l9.7-2.5c-1.9-6.6-8.6-10.3-18.6-10.6l-17.6,4.5l2.5,9.5l-7.2,1.9l-6.9-26.6
l7.2-1.9l1.8,7l33.1-8.5l-1.8-7l7.2-1.9l3.8,14.7l-10.5,4.6c8.8,1.6,14.4,5.4,16.5,13.6C1010,645.1,1010.1,647.4,1010,649.7z"/>
</g>
<g class="st7">
<path class="st0" d="M991.4,733c-15.6,0.3-26-7.5-26.2-21.7c-0.3-14.3,9.4-22.4,25.3-22.7c15.3-0.3,26,7.5,26.2,21.8
C1017,724.7,1007,732.7,991.4,733z M990.7,699.6c-12.2,0.2-17.6,4.1-17.5,11.6s5.8,11.1,18,10.9c12.1-0.2,17.6-4.1,17.4-11.5
C1008.5,703,1002.8,699.4,990.7,699.6z"/>
</g>
<g class="st7">
<path class="st0" d="M990.5,816.7l-35.6-7.4l1.9-9l34.2,7.1c5,1,7.2,1.1,7.7-1.7c0.5-2.4-0.4-5-3.3-8.1l-36.5-7.6l1.7-8.3l34.2,7.1
c5,1,7.2,1.1,7.7-1.7c0.5-2.5-0.4-5-3.3-8.1l-36.5-7.6l1.9-9.1l48,10l-1.6,7.6l-5.3-0.4c3.2,3.5,5.3,7,4.3,11.6
c-0.8,3.6-3,6.5-7.8,6.9c3.1,3.5,4.9,7.2,3.9,11.8C1004.9,815.4,1001.1,818.9,990.5,816.7z"/>
</g>
<g class="st7">
<path class="st0" d="M949.2,887c-13.5-6.3-20.6-16.8-15.4-28.1c2.2-4.6,5.5-7.7,10.1-9l-20.9-9.7l3.3-9.9l62.6,29.2l-3.8,8.2
l-6-2.1c3,5.5,3.2,11.2,0.9,16.2C974.5,893.4,963.3,893.6,949.2,887z M972.1,863.1l-20.8-9.7c-4.2,0.6-7.4,2.8-9,6.4
c-3,6.4,0.3,12,11.4,17.2c11.4,5.3,17.5,4.6,20.3-1.3C975.9,871.6,974.5,866.9,972.1,863.1z"/>
</g>
<g class="st7">
<path class="st0" d="M894,922.1c7-9,15.7-9.9,23.3-4l21,16.2l6.6-8.6l6,4.6l-6.6,8.6l8.7,6.7l-5.4,8.9l-9.6-7.4l-10.1,13.1
l-5.3-5.6l9.4-12.2l-20.9-16.1c-4.2-3.2-7.7-2.8-11.4,2c-2.2,2.8-3.3,5.8-3.7,8.6l-7.7-1.3C888.7,931.4,890.7,926.4,894,922.1z"/>
</g>
<path class="st5" d="M639.8,988.8c0,0,1.2,52.6,2.5,52.6h3.5c1.3,0,2.5-52.6,2.5-52.6"/>
<path class="st8" d="M585.1,940.4V444.9h2.7v-24.5l-8.7,18.1v6.5h1.1v5.1l-10.3,15.4c0,0-8.3,1.1-11.9,6.5s-27.6,41.2-29,43
s-1.3,4.8,0,5.5c0.9,0.5,1.8,1.1,2.7,1.8l-11.2,14.6l-3.4,22.3V633l9.7,15.4v144l-2.8,7.3H516c-3.8,0-4.1,10,0.2,10h2.7l-8.5,10.5v7
l-36.8,36.8c-4,4-10.3,17.4-10.3,33.3v30.7l53.5,9.9v71.4l9.1,12.4h10c0,0-4.7,8.9-4.7,17.7h63.1c0.1-6.2-1.5-12.4-4.4-17.9h7.7
c0-4.7-2.1-6.3-2.1-6.3l0.8-0.6V987c0,0-3-3.9-3-19.6c-1.6-2-4.1-3.2-6.7-3.1V956c0,0-19.6-6.5-26.6-6.9s-15.6-2.6-18-3.1
s-7.7-1.2-7.7-1.2v-6.7H532v6.7h-13.5v-11.5"/>
<path class="st8" d="M703.1,940.4V444.9h-2.7v-24.5l8.7,18.1v6.5H708v5.1l10.3,15.4c0,0,8.3,1.1,11.9,6.5s27.6,41.2,29,43
s1.3,4.8,0,5.5c-0.9,0.5-1.8,1.1-2.7,1.8l11.2,14.6l3.4,22.3V633l-9.7,15.4v144l2.8,7.3h7.9c3.8,0,4.1,10-0.2,10h-2.7l8.5,10.5v7
l36.8,36.8c4,4,10.3,17.4,10.3,33.3v30.7l-53.5,9.9v71.4l-9.1,12.4h-10c0,0,4.7,8.9,4.7,17.7h-63.1c-0.1-6.2,1.5-12.4,4.4-17.9h-7.7
c0-4.7,2.1-6.3,2.1-6.3l-0.8-0.6V987c0,0,3-3.9,3-19.6c1.6-2,4.1-3.2,6.7-3.1V956c0,0,19.6-6.5,26.6-6.9s15.6-2.6,18-3.1
s7.7-1.2,7.7-1.2v-6.7h2.2v6.7h13.4v-11.5"/>
<path class="st0" d="M648.4,1044.1v-10l0,0V1044.1L648.4,1044.1v-10c-1.4,0-2.7,0.6-3.5,1.8c0.6-1,1.8-5.7,2.3-10
c0.6-4.9,3.4-13.6,5.2-18.8c-3.2-2.3-5.7-5.3-7.4-8.8h-1.8c-1.7,3.5-4.2,6.5-7.4,8.8c1.8,5.2,4.6,13.9,5.2,18.8
c0.5,4.3,1.8,8.9,2.3,10c-0.8-1.1-2.1-1.8-3.5-1.8v10h-40.8v-10c-1.5,0-3,0.8-3.7,2.2c0.4-1.9,0.7-3.8,0.9-5.7
c0.2-1.4,0.4-2.9,0.6-4.7c0.9-6.2,3.6-14.1,5.3-18.8c-7.7-6.1-10.3-15.3-10.9-18.3l-13.6-24.2l-65.1-13.3l0.3-16.3l7.8-58.4
l59.3-71.8V313.4c0-69,31.9-118.6,48.6-143.5c0-0.3-0.1-0.7-0.1-1c0-2.9,1.8-6.4,3.3-8.9c0.3-1,0.6-2.1,0.7-3.2
c0.2-2,0.7-3.9,1.6-5.6c2.1-3.3,5.8-5.3,9.7-5.3h0.9c3.7,0,10.7,2.9,10.7,13.7c0.1,2.5,0.4,5.1,0.8,7.6c24,31,52.2,81.4,52.2,146.3
v494.6l57.6,56.8l9.6,70.7l0.3,15.1l-79.1,39.7c-1.1,3.9-4,11.5-10.5,16.7c1.7,4.6,4.4,12.5,5.3,18.8c0.2,1.8,0.5,3.3,0.6,4.7
c0.2,1.9,0.5,3.8,0.9,5.7c-0.7-1.4-2.1-2.2-3.7-2.2v10L648.4,1044.1z M639.7,1044.1v-10V1044.1z"/>
<path class="st5" d="M644.5,150.9c0.3,0,5.7,0.1,5.7,8.7c0,1.4,0.8,9.4,1.4,10c17.8,23,51.7,74.4,51.7,143.9v21.1h-83.1v1.1h83.1
v474.5l57.9,57.1l9.3,68.8l0.2,11.7L692.3,987c0,0-2.1,12.7-12.3,18.1c0,0,5.2,12.7,6.5,21.4c1.2,8.7,1.3,12.5,2.8,12.5h-40.8
c1.3,0,3.2-7.5,3.8-12.6c0.8-6.4,6.3-21.6,6.3-21.6c-4.9-2.1-8.7-6.3-10.1-11.5h-8.6c-1.5,5.2-5.2,9.4-10.1,11.5
c0,0,5.5,15.2,6.3,21.6c0.6,5.1,2.5,12.6,3.8,12.6h-40.8c1.5,0,1.6-3.8,2.8-12.5s6.5-21.4,6.5-21.4c-10.2-5.4-12.3-18.1-12.3-18.1
l-15.1-26.8l-63.2-12.9l0.2-11.9l7.6-56.7l59.5-72.1V313.4c0-69.4,33.5-119.4,49.2-142.9c0,0-0.6-0.3-0.6-1.7s1.2-4,2.6-6.3
s1.3-7.2,2.3-8.8c1.2-1.8,3.3-2.9,5.4-2.9L644.5,150.9 M639.8,1039.1L639.8,1039.1 M644.5,140.9h-0.9c-5.7,0-11,2.9-14,7.7
c-1.3,2.3-2.1,4.8-2.3,7.5c-0.1,0.6-0.2,1.4-0.3,1.9c-2.3,4-3.6,7.5-3.7,10.5c-8.1,12.2-19.3,29.7-29,52.4
c-12.9,30.2-19.5,61.3-19.5,92.5V803l-57.2,69.4l-1.8,2.2l-0.4,2.8l-7.6,56.7l-0.1,0.6v0.6l-0.2,11.9l-0.1,8.3l8.1,1.7l58.8,12
l12.1,21.5c1.6,6.8,5,13,9.8,18c-2,5.4-3.4,10.9-4.4,16.6c-0.2,1.8-0.5,3.3-0.6,4.7c-0.3,2-0.5,4.2-0.7,4.9c0.6-2.3,3.7-5.8,8.5-5.8
v20h40.8l0,0v-20c0.6,0,1.2,0.1,1.8,0.2c-0.3,1.5-0.7,2.9-1.2,4.3c0.8-1.5,2.1-2.7,3.7-3.5c1.6,0.8,2.8,2,3.7,3.5
c-0.5-1.4-0.9-2.9-1.2-4.3c0.6-0.1,1.2-0.2,1.8-0.2v20v-20v20h40.8v-20c4.7,0,7.8,3.4,8.5,5.8c-0.2-0.7-0.5-2.9-0.7-4.9
c-0.2-1.4-0.4-3-0.6-4.7c-1-5.7-2.4-11.2-4.4-16.6c4-4.1,7.1-9.1,8.9-14.6l74.4-37.3l5.6-2.8l-0.1-6.3l-0.2-11.7v-0.6l-0.1-0.6
l-9.3-68.7l-0.5-3.4l-2.4-2.4L713.3,806V313.4c-0.1-32.2-6.9-64-20-93.4c-8.6-19.6-19.5-38-32.5-54.9c-0.3-1.8-0.5-4.6-0.6-5.6
C660.2,145.8,650.8,140.9,644.5,140.9L644.5,140.9z M641.6,1008.8c0.9-0.8,1.7-1.7,2.5-2.7c0.8,0.9,1.6,1.8,2.5,2.7
c-0.8,2.5-1.7,5.4-2.5,8.2C643.3,1014.2,642.4,1011.3,641.6,1008.8z"/>
<path class="st5" d="M644.5,150.9c0.3,0,5.7,0.1,5.7,8.7c0,1.4,0.8,9.4,1.4,10c17.8,23,51.7,74.4,51.7,143.9v21.1h-83.1v1.1h83.1
v474.5l57.9,57.1l9.3,68.8l0.2,11.7L692.3,987c0,0-2.1,12.7-12.3,18.1c0,0,5.2,12.7,6.5,21.4c1.2,8.7,1.3,12.5,2.8,12.5h-40.8
c1.3,0,3.2-7.5,3.8-12.6c0.8-6.4,6.3-21.6,6.3-21.6c-4.9-2.1-8.7-6.3-10.1-11.5h-8.6c-1.5,5.2-5.2,9.4-10.1,11.5
c0,0,5.5,15.2,6.3,21.6c0.6,5.1,2.5,12.6,3.8,12.6h-40.8c1.5,0,1.6-3.8,2.8-12.5s6.5-21.4,6.5-21.4c-10.2-5.4-12.3-18.1-12.3-18.1
l-15.1-26.8l-63.2-12.9l0.2-11.9l7.6-56.7l59.5-72.1V313.4c0-69.4,33.5-119.4,49.2-142.9c0,0-0.6-0.3-0.6-1.7s1.2-4,2.6-6.3
s1.3-7.2,2.3-8.8c1.2-1.8,3.3-2.9,5.4-2.9L644.5,150.9 M639.8,1039.1L639.8,1039.1 M644.5,140.9h-0.9c-5.7,0-11,2.9-14,7.7
c-1.3,2.3-2.1,4.8-2.3,7.5c-0.1,0.6-0.2,1.4-0.3,1.9c-2.3,4-3.6,7.5-3.7,10.5c-8.1,12.2-19.3,29.7-29,52.4
c-12.9,30.2-19.5,61.3-19.5,92.5V803l-57.2,69.4l-1.8,2.2l-0.4,2.8l-7.6,56.7l-0.1,0.6v0.6l-0.2,11.9l-0.1,8.3l8.1,1.7l58.8,12
l12.1,21.5c1.6,6.8,5,13,9.8,18c-2,5.4-3.4,10.9-4.4,16.6c-0.2,1.8-0.5,3.3-0.6,4.7c-0.3,2-0.5,4.2-0.7,4.9c0.6-2.3,3.7-5.8,8.5-5.8
v20h40.8l0,0v-20c0.6,0,1.2,0.1,1.8,0.2c-0.3,1.5-0.7,2.9-1.2,4.3c0.8-1.5,2.1-2.7,3.7-3.5c1.6,0.8,2.8,2,3.7,3.5
c-0.5-1.4-0.9-2.9-1.2-4.3c0.6-0.1,1.2-0.2,1.8-0.2v20v-20v20h40.8v-20c4.7,0,7.8,3.4,8.5,5.8c-0.2-0.7-0.5-2.9-0.7-4.9
c-0.2-1.4-0.4-3-0.6-4.7c-1-5.7-2.4-11.2-4.4-16.6c4-4.1,7.1-9.1,8.9-14.6l74.4-37.3l5.6-2.8l-0.1-6.3l-0.2-11.7v-0.6l-0.1-0.6
l-9.3-68.7l-0.5-3.4l-2.4-2.4L713.3,806V313.4c-0.1-32.2-6.9-64-20-93.4c-8.6-19.6-19.5-38-32.5-54.9c-0.3-1.8-0.5-4.6-0.6-5.6
C660.2,145.8,650.8,140.9,644.5,140.9L644.5,140.9z M641.6,1008.8c0.9-0.8,1.7-1.7,2.5-2.7c0.8,0.9,1.6,1.8,2.5,2.7
c-0.8,2.5-1.7,5.4-2.5,8.2C643.3,1014.2,642.4,1011.3,641.6,1008.8z"/>
<path class="st5" d="M816.4,866.8c-7-9.8-50.3-52.5-68.2-69.3s-25.5-27.5-29-37s-11.1-48.6-14-65.1s-9.2-45.3-10.5-49.2
s-5.4-26.4-7-35.9s-7.6-41.6-9.2-46.2s-5.9-21.1-10.2-33.5s-10.2-28.7-12-33.5s-6.7-8.7-12-8.7s-10.2,3.9-12,8.7s-7.8,21.1-12,33.5
s-8.5,28.8-10.2,33.5s-7.6,36.8-9.2,46.2s-5.7,32-7,35.9S586,679,583,695.4s-10.5,55.7-14,65.1s-11.1,20.2-29,37
s-61.3,59.5-68.3,69.3s-9.2,22-8.7,31.4s0.5,9.4,0.5,11.1v18.3c0,0,54.3,9.4,63.2,10.6s23.6,4.6,25.2,5.5s18.1,2.3,27.3,4.1
s20.2,3.7,22.9,4.6v34.8l5.3,0.9l0.9,1.8h71.5l0.9-1.8l5.3-0.9v-34.8c2.7-0.9,13.7-2.8,22.9-4.6s25.7-3.2,27.3-4.1
s16.3-4.3,25.2-5.5s63.2-10.6,63.2-10.6v-18.3c0-1.7,0-1.7,0.5-11.1S823.4,876.7,816.4,866.8z"/>
<path class="st0" d="M678.6,587c-6-28.4-18.5-67.8-18.5-67.8l-9-16.9H637l-9,16.9c0,0-12.5,39.4-18.4,67.8s-6.7,35.8-6.7,38.2v288.9
c0,10.8,9.7,42.5,9.7,42.5h26.3v-52.4c0-2.2,3.2-2.6,5.3-2.6s5.3,0.4,5.3,2.6v52.5h26.3c0,0,9.7-31.7,9.7-42.5V625.2
C685.3,622.8,684.5,615.5,678.6,587z M635.7,519.6c0.4-2.2,1.7-3.8,2.9-3.5s1.7,2.2,1.3,4.4s-1.7,3.8-2.9,3.6
S635.3,521.8,635.7,519.6L635.7,519.6z M640,537.7c-0.5,1-1.7,1.4-2.7,0.9c-1-0.5-1.4-1.7-0.9-2.7c0.4-0.9,1.4-1.3,2.4-1
C639.9,535.3,640.4,536.6,640,537.7z M644,539.5c-1.3,0.3-2.6-0.6-2.8-1.9c-0.3-1.3,0.6-2.6,1.9-2.8c1.3-0.3,2.6,0.6,2.8,1.9
c0,0.2,0,0.3,0,0.5C646,538.3,645.2,539.4,644,539.5L644,539.5z M644,524c-1.2,0-2.1-1.8-2.1-4s0.9-4,2.1-4s2.1,1.8,2.1,4
S645.2,524,644,524L644,524z M650.5,539.5c-1.2,0.6-2.6,0.1-3.2-1.1s-0.1-2.6,1.1-3.2s2.6-0.1,3.2,1.1c0.1,0.1,0.1,0.3,0.2,0.4
C652.2,537.8,651.7,539,650.5,539.5L650.5,539.5z M651.1,524c-1.1,0.2-2.4-1.3-2.9-3.5s0.1-4.1,1.3-4.4s2.4,1.3,2.9,3.5
S652.3,523.7,651.1,524L651.1,524z"/>
<polygon class="st5" points="623.1,597 625.4,590.2 632.6,582.9 640,580.5 641.6,570.2 629,575.9 618.1,584.7 615.7,597.9 "/>
<rect x="633.2" y="606.4" class="st5" width="9.8" height="8.8"/>
<path class="st0" d="M601.4,645.1v257.1h-65.2v8.2h-2v-8.1h-69.1v-2.6c0-2.1,3.2-7.8,4.7-11.7s3.7-8,4.4-10.8s7.6-9.2,11.3-12.7
s91.5-95.7,91.5-95.7S592.2,677.8,601.4,645.1z"/>
<path class="st0" d="M601.4,913.4v37.9c0,0-17.8-4-23.1-4.8s-23-2.9-25.4-3.7s-15.1-4.2-16.9-4.4v-28L601.4,913.4z"/>
<path class="st0" d="M534.2,910.4v27.8c0,0-24.9-3.4-37.5-5.8s-30.1-5.6-32.3-5.8v-20.3L534.2,910.4z"/>
<polygon class="st5" points="665,597 662.8,590.2 655.5,582.9 648.2,580.5 646.5,570.2 659.1,575.9 670,584.7 672.5,597.9 "/>
<rect x="645.1" y="606.4" class="st5" width="9.8" height="8.8"/>
<path class="st0" d="M686.7,645.1v257.1h65.2v8.2h2v-8.1H823v-2.6c0-2.1-3.2-7.8-4.7-11.7s-3.7-8-4.4-10.8s-7.6-9.2-11.3-12.7
s-91.5-95.7-91.5-95.7S695.9,677.8,686.7,645.1z"/>
<path class="st0" d="M686.7,913.4v37.9c0,0,17.8-4,23.1-4.8s23-2.9,25.4-3.7s15.1-4.2,16.9-4.4v-28L686.7,913.4z"/>
<path class="st0" d="M753.9,910.4v27.8c0,0,24.9-3.4,37.5-5.8s30.1-5.6,32.3-5.8v-20.3L753.9,910.4z"/>
<path class="st0" d="M612.2,958.3c-3.9-12.3-7-24.7-9.4-37.4v65.2h20.6V959L612.2,958.3z M607,958.5c0.9,0,1.7,0.8,1.7,1.7
s-0.8,1.7-1.7,1.7s-1.7-0.8-1.7-1.7v0C605.3,959.3,606,958.5,607,958.5C607,958.5,607,958.5,607,958.5L607,958.5z M607,965
c0.9,0,1.7,0.8,1.7,1.7s-0.8,1.7-1.7,1.7s-1.7-0.8-1.7-1.7v0C605.3,965.8,606,965,607,965C607,965,607,965,607,965L607,965z
M604.9,982.8c-0.6,0-1-0.4-1-1s0.4-1,1-1s1,0.4,1,1C605.9,982.3,605.5,982.8,604.9,982.8C604.9,982.8,604.9,982.8,604.9,982.8
L604.9,982.8z M605.3,973.2c0-0.9,0.8-1.7,1.8-1.7c0.9,0,1.7,0.8,1.7,1.8c0,0.9-0.8,1.6-1.7,1.7C606.1,975,605.3,974.3,605.3,973.2
C605.2,973.3,605.2,973.3,605.3,973.2L605.3,973.2z M609.1,982.3c-0.6,0-1-0.4-1-1s0.4-1,1-1s1,0.4,1,1
C610.1,981.9,609.7,982.3,609.1,982.3C609.1,982.3,609.1,982.3,609.1,982.3L609.1,982.3z"/>
<path class="st0" d="M676,958.3l-11.3,0.7v27.1h20.6v-65.2C683,933.6,679.8,946,676,958.3z M681.2,958.5c0.9,0,1.7,0.8,1.7,1.7
s-0.8,1.7-1.7,1.7s-1.7-0.8-1.7-1.7v0C679.4,959.3,680.2,958.5,681.2,958.5L681.2,958.5z M681.2,965c0.9,0,1.7,0.8,1.7,1.7
s-0.8,1.7-1.7,1.7s-1.7-0.8-1.7-1.7v0C679.4,965.8,680.2,965,681.2,965L681.2,965z M679,982.3c-0.6,0-1-0.4-1-1s0.4-1,1-1s1,0.4,1,1
S679.6,982.3,679,982.3z M679.4,973.2c0-0.9,0.8-1.7,1.7-1.7s1.7,0.8,1.7,1.7s-0.8,1.7-1.7,1.7h0
C680.2,974.9,679.4,974.2,679.4,973.2L679.4,973.2z M683.2,982.8c-0.6,0-1-0.4-1-1s0.4-1,1-1s1,0.4,1,1S683.8,982.8,683.2,982.8z"/>
<ellipse transform="matrix(0.9778 -0.2096 0.2096 0.9778 -192.2354 155.6226)" class="st0" cx="638" cy="984.7" rx="0.8" ry="1.2"/>
<polygon class="st0" points="624.7,986.1 635.1,986.1 635.1,983.5 624.7,977.7 "/>
<path class="st0" d="M640.2,905.5c0,0,0.7,1.3,1.6,1.3v83.1h-1.2L640.2,905.5z"/>
<ellipse transform="matrix(0.2096 -0.9778 0.9778 0.2096 -449.0005 1413.9041)" class="st0" cx="650.1" cy="984.7" rx="1.2" ry="0.8"/>
<polygon class="st0" points="663.4,986.1 653,986.1 653,983.5 663.4,977.7 "/>
<path class="st0" d="M648,905.5c0,0-0.7,1.3-1.6,1.3v83.1h1.2L648,905.5z"/>
<use xlink:href="#Новый_символ_2" width="62.9" height="62.9" id="Новый_символ_2-3" x="-31.5" y="-31.5" transform="matrix(1.11 0 0 1.11 844.4562 528.0062)" style="overflow:visible;"/>
<use xlink:href="#Новый_символ_2" width="62.9" height="62.9" x="-31.5" y="-31.5" transform="matrix(0.56 0 0 0.56 375.4704 602.7504)" style="overflow:visible;"/>
<use xlink:href="#Новый_символ_2" width="62.9" height="62.9" x="-31.5" y="-31.5" transform="matrix(0.45 0 0 0.45 259.4293 771.7092)" style="overflow:visible;"/>
<use xlink:href="#Новый_символ_2" width="62.9" height="62.9" x="-31.5" y="-31.5" transform="matrix(0.56 0 0 0.56 516.5604 383.0404)" style="overflow:visible;"/>
<use xlink:href="#Новый_символ_2" width="62.9" height="62.9" x="-31.5" y="-31.5" transform="matrix(0.56 0 0 0.56 1036.5304 753.7004)" style="overflow:visible;"/>
<use xlink:href="#Новый_символ_2" width="62.9" height="62.9" x="-31.5" y="-31.5" transform="matrix(0.69 0 0 0.69 915.0109 620.1509)" style="overflow:visible;"/>
<use xlink:href="#Новый_символ_2" width="62.9" height="62.9" x="-31.5" y="-31.5" transform="matrix(0.69 0 0 0.69 770.5309 361.0009)" style="overflow:visible;"/>
<use xlink:href="#Новый_символ_2" width="62.9" height="62.9" x="-31.5" y="-31.5" transform="matrix(1.08 0 0 1.08 452.7222 522.8922)" style="overflow:visible;"/>
</svg>

After

Width:  |  Height:  |  Size: 32 KiB

View File

@ -0,0 +1,312 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Слой_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 1288.1 1288.1" style="enable-background:new 0 0 1288.1 1288.1;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
.st1{fill:#181A3E;stroke:#C34435;stroke-width:20;stroke-miterlimit:10;}
.st2{fill:#C34435;}
.st3{clip-path:url(#SVGID_2_);}
.st4{clip-path:url(#SVGID_4_);}
.st5{fill:#181A3E;}
.st6{fill:#FFFFFF;stroke:#181A3E;stroke-width:10;stroke-miterlimit:10;}
.st7{enable-background:new ;}
</style>
<symbol id="Новый_символ_2" viewBox="-31.5 -31.5 62.9 62.9">
<polygon class="st0" points="0,-1.6 31.5,0 0,1.6 -31.5,0 "/>
<polygon class="st0" points="-1.6,0 0,-31.5 1.6,0 0,31.5 "/>
<polygon class="st0" points="-1.1,-1.1 -16,16 1.1,1.1 16,-16 "/>
<polygon class="st0" points="-1.1,1.1 16,16 1.1,-1.1 -16,-16 "/>
</symbol>
<title>red-blue letters outside, stars placement from example, rays small</title>
<circle class="st1" cx="644.7" cy="719.7" r="429.3"/>
<path class="st2" d="M644.5,150.9c0.3,0,5.7,0.1,5.7,8.7c0,1.4,0.8,9.4,1.4,10c17.8,23,51.7,74.4,51.7,143.9v111.1l6.2,14v6.5h-1.1
v5l10.3,15.4c0,0,8.3,1.1,11.9,6.5s27.6,41.2,29,43s1.3,4.8,0,5.5c-0.9,0.5-1.8,1.1-2.7,1.8l11.2,14.6l3.4,22.3V633l-9.7,15.4v144
l2.8,7.3h7.9c3.8,0,4.1,10-0.2,10h-2.8l8.5,10.5v7l36.8,36.8c4,4,10.3,17.4,10.3,33.3v30.7l-53.5,9.9v71.4l-9.1,12.4h-10
c0,0,4.7,8.9,4.7,17.7h-63.1c-0.1-6.2,1.5-12.4,4.4-17.9H691c0-4.7,2.1-6.3,2.1-6.3l-0.8-0.6V987c0,0-2.1,12.7-12.3,18.1
c0,0,5.2,12.7,6.5,21.4c1.2,8.7,1.3,12.5,2.8,12.5h-40.9c1.3,0,3.2-7.5,3.8-12.6c0.8-6.4,6.3-21.6,6.3-21.6
c-4.9-2.1-8.7-6.3-10.1-11.5c0,0-1.2,48-2.5,48h-3.5c-1.3,0-2.5-48-2.5-48c-1.5,5.2-5.2,9.4-10.1,11.5c0,0,5.5,15.2,6.3,21.6
c0.6,5.1,2.5,12.6,3.8,12.6h-40.8c1.5,0,1.6-3.8,2.8-12.5s6.5-21.4,6.5-21.4c-10.2-5.4-12.3-18.1-12.3-18.1v27.2l-0.8,0.6
c0,0,2.1,1.6,2.1,6.3h-7.7c2.9,5.5,4.4,11.7,4.4,17.9h-63.1c0-8.7,4.7-17.7,4.7-17.7h-10l-9.1-12.4v-71.4l-53.5-9.9v-30.7
c0-16,6.3-29.3,10.3-33.3l36.8-36.8v-7l8.5-10.5h-2.7c-4.3,0-4-10-0.2-10h7.9l2.8-7.3v-144l-9.6-15.3v-73.8l3.4-22.3l11.2-14.6
c-0.9-0.6-1.8-1.2-2.7-1.8c-1.3-0.7-1.4-3.7,0-5.5s25.4-37.6,29-43s11.9-6.5,11.9-6.5l10.3-15.4v-5.1h-1.1v-6.5l6.2-14v-111
c0-69.4,33.4-119.4,49.2-142.9c0,0-0.6-0.3-0.6-1.7s1.2-4,2.6-6.3s1.3-7.2,2.3-8.8c1.2-1.8,3.3-2.9,5.4-2.9L644.5,150.9
M639.8,1039.1L639.8,1039.1 M644.5,130.9h-0.9c-9.1,0-17.6,4.7-22.5,12.4c-2,3.4-3.2,7.2-3.7,11.1v0.1c-1.9,3.2-3.2,6.8-3.9,10.5
c-11.1,16.4-20.6,33.8-28.5,51.9c-13.5,31.4-20.3,63.9-20.3,96.5v106.9l-4.5,10.1l-1.7,3.9v11.3l-1.8,2.7
c-6.4,2.5-11.9,6.8-15.9,12.4l-5.4,8c-7,10.4-21.4,31.8-23.2,34.4c-3.6,4.9-5.3,11-4.8,17.1l-3.4,4.5l-3.1,4.1l-0.8,5.1l-3.4,22.3
l-0.2,1.5v81.1l3.1,4.9l6.6,10.5v127.6c-4.6,2.2-8.3,5.8-10.6,10.2c-2,3.9-3,8.3-3,12.7c0,1.6,0.1,3.2,0.4,4.7l-3,3.6v5.7l-31,30.9
c-7.8,7.8-16.2,26-16.2,47.5v47.4l16.4,3l37.1,6.8v61.3l3.9,5.3l9.1,12.4l1.6,2.1c-0.1,1.2-0.1,2.4-0.1,3.7v20H633
c2.9,1.5,6,2.3,9.3,2.3h3.5c3.2,0,6.4-0.8,9.3-2.3h122.3v-20c0-1.2,0-2.5-0.2-3.7l1.6-2.1l9.1-12.4l3.9-5.3v-61.3l37.2-6.8l16.4-3
v-47.3c0-21.5-8.4-39.7-16.2-47.5l-31-30.9V813l-2.9-3.6c0.3-1.6,0.4-3.1,0.4-4.7c0-4.4-1-8.8-3-12.7c-2.3-4.5-6.1-8.1-10.6-10.2
V654.1l6.6-10.5l3.1-4.9v-81.1l-0.2-1.5l-3.4-22.3l-0.8-5.1l-3.1-4.1l-3.4-4.5c0.5-6.1-1.2-12.2-4.8-17.1
c-1.8-2.5-16.1-23.9-23.1-34.2l-5.5-8.2c-3.9-5.6-9.5-10-15.9-12.4l-1.8-2.7v-11.3l-1.7-3.9l-4.5-10.1V313.4
c-0.1-33.6-7.2-66.8-20.8-97.4c-8.5-19.4-19.3-37.8-32.1-54.8c-0.1-0.8-0.2-1.5-0.2-2C670,140.8,656.9,130.8,644.5,130.9
L644.5,130.9z"/>
<g>
<defs>
<circle id="SVGID_1_" cx="644.7" cy="719.7" r="429.3"/>
</defs>
<clipPath id="SVGID_2_">
<use xlink:href="#SVGID_1_" style="overflow:visible;"/>
</clipPath>
<g class="st3">
<polygon class="st2" points="643.4,931.1 657.8,667.8 657.8,931.7 686.5,669.9 672.1,933.2 715,674 686.3,935.8 743.2,680.2
700.3,939.4 771.1,688.5 714.1,944 798.4,698.7 727.6,949.7 825.1,710.9 740.8,956.2 851.1,725 753.6,963.8 876.3,741 766,972.2
900.5,758.7 777.9,981.5 923.8,778.2 789.2,991.6 945.9,799.3 800,1002.6 966.9,822 810.2,1014.3 986.6,846.1 819.7,1026.7
1004.9,871.6 828.5,1039.8 1021.8,898.4 836.5,1053.5 1037.2,926.4 843.9,1067.8 1051,955.4 850.4,1082.5 1063.2,985.4
856.1,1097.7 1073.8,1016.2 861,1113.3 1082.7,1047.7 865,1129.2 1089.8,1079.7 868.1,1145.3 1095.2,1112.3 870.3,1161.7
1098.8,1145.1 871.7,1178.2 1100.6,1178.2 872.2,1194.7 1100.6,1211.3 871.7,1211.3 1098.8,1244.3 870.3,1227.8 1095.2,1277.2
868.1,1244.1 1089.8,1309.7 865,1260.3 1082.7,1341.8 861,1276.2 1073.8,1373.3 856.1,1291.8 1063.2,1404.1 850.4,1307
1051,1434.1 843.9,1321.7 1037.2,1463.1 836.5,1336 1021.8,1491.1 828.5,1349.7 1004.9,1517.8 819.7,1362.8 986.6,1543.4
810.2,1375.2 966.9,1567.5 800,1386.9 945.9,1590.2 789.2,1397.8 923.8,1611.3 777.9,1408 900.5,1630.8 766,1417.3 876.3,1648.5
753.6,1425.7 851.1,1664.5 740.8,1433.2 825.1,1678.6 727.6,1439.8 798.4,1690.8 714.1,1445.4 771.1,1701 700.3,1450.1
743.2,1709.2 686.3,1453.7 715,1715.4 672.1,1456.2 686.5,1719.6 657.8,1457.8 657.8,1721.7 643.4,1458.3 629.1,1721.7
629.1,1457.8 600.4,1719.6 614.8,1456.2 571.9,1715.4 600.6,1453.7 543.7,1709.2 586.6,1450.1 515.8,1701 572.8,1445.4
488.5,1690.8 559.2,1439.8 461.8,1678.6 546.1,1433.2 435.8,1664.5 533.3,1425.7 410.6,1648.5 520.9,1417.3 386.3,1630.8
509,1408 363.1,1611.3 497.6,1397.8 340.9,1590.2 486.9,1386.9 320,1567.5 476.7,1375.2 300.3,1543.4 467.2,1362.8 282,1517.8
458.4,1349.7 265.1,1491.1 450.3,1336 249.7,1463.1 443,1321.7 235.9,1434.1 436.5,1307 223.6,1404.1 430.8,1291.8 213.1,1373.3
425.9,1276.2 204.2,1341.8 421.9,1260.3 197,1309.7 418.8,1244.1 191.6,1277.2 416.5,1227.8 188.1,1244.3 415.2,1211.3
186.2,1211.3 414.7,1194.7 186.2,1178.2 415.2,1178.2 188.1,1145.1 416.5,1161.7 191.6,1112.3 418.8,1145.3 197,1079.7
421.9,1129.2 204.2,1047.7 425.9,1113.3 213.1,1016.2 430.8,1097.7 223.6,985.4 436.5,1082.5 235.9,955.4 443,1067.8 249.7,926.4
450.3,1053.5 265.1,898.4 458.4,1039.8 282,871.6 467.2,1026.7 300.3,846.1 476.7,1014.3 320,822 486.9,1002.6 340.9,799.3
497.6,991.6 363.1,778.2 509,981.5 386.3,758.7 520.9,972.2 410.6,741 533.3,963.8 435.8,725 546.1,956.2 461.8,710.9
559.2,949.7 488.5,698.7 572.8,944 515.8,688.5 586.6,939.4 543.7,680.2 600.6,935.8 571.9,674 614.8,933.2 600.4,669.9
629.1,931.7 629.1,667.8 "/>
</g>
</g>
<g>
<defs>
<circle id="SVGID_3_" cx="644.7" cy="719.7" r="429.3"/>
</defs>
<clipPath id="SVGID_4_">
<use xlink:href="#SVGID_3_" style="overflow:visible;"/>
</clipPath>
<g class="st4">
<path class="st5" d="M449.2,1173.8c-28.9,0-53.9-16.9-63.8-43.1c-6.4-16.9-5.6-35.7,2.2-52c5.5-11.7,14.2-21.6,25-28.7l3.1-11.2
c4.4-15.9,14.9-28,28.7-33.2c5-1.9,10.2-2.8,15.5-2.8c5.5,0,10.9,1,16.1,2.8c6.1-13.5,17.2-24,31.1-29.4
c6.2-2.4,12.8-3.6,19.5-3.6c25.8,0,49.8,17.7,59.8,44c12.9,34-1.7,71.1-32.5,82.8c-6.2,2.4-12.8,3.6-19.5,3.6l0,0
c-4.7,0-9.4-0.6-14-1.8c1.4,29.2-16.9,56.8-45.6,67.8C466.5,1172.2,457.9,1173.8,449.2,1173.8z M441.9,1038.7
c-6.3,0-12.5,1.8-17.9,5.1c0.9-0.4,1.8-0.8,2.8-1.1c5.1-1.9,10.3-3.3,15.7-4L441.9,1038.7z"/>
<path class="st2" d="M526.5,977.7c23.1,0,45.7,15.8,55.1,40.8c11.9,31.5-1.3,65.7-29.7,76.4c-5.7,2.1-11.7,3.2-17.7,3.2
c-6.8,0-13.5-1.3-19.8-3.9c5,29.1-12,59-41.6,70.2c-7.6,2.9-15.6,4.4-23.8,4.4c-25.8,0-49.8-15.1-59.1-39.9
c-12.2-32.3,5-68.8,38.5-81.5c7.6-2.9,15.6-4.4,23.7-4.4c7.4,0,14.7,1.2,21.6,3.7c-9.4-8.3-20.8-13-32-13c-7.6,0-15,2.2-21.4,6.4
c3.9-13.9,12.8-25,25.6-29.9c4.4-1.7,9-2.5,13.7-2.5c6.5,0.1,12.9,1.5,18.8,4.3c5.3-14.2,15.8-25.7,30.2-31.1
C514.5,978.8,520.5,977.7,526.5,977.7 M526.5,967.7c-7.3,0-14.5,1.3-21.2,3.9c-13.6,5.2-25,15.1-31.9,28
c-4.4-1.2-8.9-1.8-13.5-1.8c-5.9,0-11.8,1.1-17.3,3.2c-15.3,5.8-26.8,19.1-31.7,36.6l-2.6,9.4c-27.3,19-39.6,54.1-27.6,85.6
c5.3,13.9,14.8,25.8,27.3,34c12.2,8.1,26.6,12.4,41.2,12.3c9.3,0,18.6-1.7,27.3-5c28.7-10.9,47.6-37.4,48.9-66.3
c3,0.4,6,0.7,9,0.7c7.3,0,14.5-1.3,21.2-3.9c16.4-6.2,29-19,35.7-36.2c6.5-17.1,6.4-36.1-0.2-53.1
C580.3,986.7,554.4,967.7,526.5,967.7L526.5,967.7z"/>
<path class="st5" d="M838.9,1173.8c-8.7,0-17.4-1.6-25.5-4.7c-28.8-10.9-47-38.6-45.6-67.8c-4.6,1.2-9.3,1.7-14,1.8
c-6.7,0-13.3-1.2-19.5-3.6c-30.8-11.7-45.4-48.8-32.5-82.8c10-26.3,34-44,59.8-44c6.7,0,13.3,1.2,19.5,3.6
c13.8,5.3,25,15.8,31.1,29.3c5.2-1.8,10.6-2.8,16.1-2.8c5.3,0,10.5,0.9,15.5,2.8c13.8,5.2,24.2,17.3,28.7,33.2l3.1,11.2
c26.5,17.5,38.6,50.8,27.2,80.7C892.8,1156.9,867.8,1173.8,838.9,1173.8z M845.7,1038.7c5.4,0.7,10.6,2.1,15.7,4
c0.9,0.4,1.9,0.7,2.8,1.1c-5.3-3.4-11.5-5.2-17.9-5.1L845.7,1038.7z"/>
<path class="st2" d="M761.6,977.7c6,0,12,1.1,17.7,3.2c14.4,5.5,24.9,17,30.2,31.1c5.9-2.8,12.3-4.3,18.8-4.3
c4.7,0,9.3,0.8,13.7,2.5c12.8,4.9,21.8,16,25.6,29.9c-6.3-4.2-13.8-6.5-21.4-6.4c-11.2,0-22.5,4.7-32,13
c6.9-2.4,14.2-3.7,21.6-3.7c8.1,0,16.1,1.5,23.7,4.4c33.5,12.7,50.8,49.2,38.5,81.5c-9.4,24.8-33.4,39.9-59.2,39.9
c-8.1,0-16.2-1.5-23.8-4.4c-29.7-11.2-46.6-41.1-41.6-70.2c-6.3,2.5-13,3.8-19.8,3.9c-6,0-12-1.1-17.7-3.2
c-28.3-10.7-41.6-44.9-29.7-76.4C715.9,993.4,738.5,977.7,761.6,977.7 M761.6,967.7L761.6,967.7L761.6,967.7
c-27.9,0-53.8,19-64.5,47.2c-13.9,36.6,2,76.6,35.5,89.3c6.8,2.6,14,3.9,21.2,3.9c3,0,6-0.2,9-0.7c1.2,28.9,20.1,55.4,48.9,66.3
c8.7,3.3,18,5,27.3,5c14.7,0,29-4.2,41.2-12.3c12.4-8.2,22-20.1,27.3-34c12-31.6-0.3-66.6-27.6-85.6l-2.6-9.4
c-4.9-17.4-16.4-30.8-31.7-36.6c-5.5-2.1-11.4-3.2-17.3-3.2c-4.6,0-9.1,0.6-13.5,1.8c-6.9-12.9-18.2-22.8-31.9-28
C776.1,968.9,768.9,967.6,761.6,967.7L761.6,967.7z"/>
<rect x="500.8" y="1015.4" class="st5" width="286.4" height="153.9"/>
<path class="st2" d="M595,1030.7c0,0-17.8,32.3,31.5,104.4c0,0-1-19.2,5.3-31.1c0,0,16.5,42,17.8,56.8c0,0,23.2-48.3,18.6-80.7
c0,0,14.7,14.4,9.7,31.6c0,0,31.2-26.5,21.4-80.7L595,1030.7z"/>
<path class="st2" d="M690.9,1030.8c0,0-11.4,20.7,20.3,67.1c0,0-0.7-12.3,3.4-20c0,0,10.6,27,11.4,36.5c0,0,14.9-31.1,12-51.8
c0,0,9.5,9.2,6.2,20.3c0,0,20.1-17,13.8-51.9L690.9,1030.8z"/>
<path class="st2" d="M529.7,1030.8c0,0-11.4,20.7,20.3,67.1c0,0-0.7-12.3,3.4-20c0,0,10.6,27,11.4,36.5c0,0,14.9-31.1,12-51.8
c0,0,9.5,9.2,6.2,20.3c0,0,20.1-17,13.8-51.9L529.7,1030.8z"/>
</g>
</g>
<path class="st5" d="M639.8,988.8c0,0,1.2,52.6,2.5,52.6h3.5c1.3,0,2.5-52.6,2.5-52.6"/>
<path class="st6" d="M585.1,940.4V444.9h2.7v-24.5l-8.7,18.1v6.5h1.1v5.1l-10.3,15.4c0,0-8.3,1.1-11.9,6.5s-27.6,41.2-29,43
s-1.3,4.8,0,5.5c0.9,0.5,1.8,1.1,2.7,1.8l-11.2,14.6l-3.4,22.3V633l9.7,15.4v144l-2.8,7.3H516c-3.8,0-4.1,10,0.2,10h2.7l-8.5,10.5v7
l-36.8,36.8c-4,4-10.3,17.4-10.3,33.3v30.7l53.5,9.9v71.4l9.1,12.4h10c0,0-4.7,8.9-4.7,17.7h63.1c0.1-6.2-1.5-12.4-4.4-17.9h7.7
c0-4.7-2.1-6.3-2.1-6.3l0.8-0.6V987c0,0-3-3.9-3-19.6c-1.6-2-4.1-3.2-6.7-3.1V956c0,0-19.6-6.5-26.6-6.9s-15.6-2.6-18-3.1
s-7.7-1.2-7.7-1.2v-6.7H532v6.7h-13.5v-11.5"/>
<path class="st6" d="M703.1,940.4V444.9h-2.7v-24.5l8.7,18.1v6.5H708v5.1l10.3,15.4c0,0,8.3,1.1,11.9,6.5s27.6,41.2,29,43
s1.3,4.8,0,5.5c-0.9,0.5-1.8,1.1-2.7,1.8l11.2,14.6l3.4,22.3V633l-9.7,15.4v144l2.8,7.3h7.9c3.8,0,4.1,10-0.2,10h-2.7l8.5,10.5v7
l36.8,36.8c4,4,10.3,17.4,10.3,33.3v30.7l-53.5,9.9v71.4l-9.1,12.4h-10c0,0,4.7,8.9,4.7,17.7h-63.1c-0.1-6.2,1.5-12.4,4.4-17.9h-7.7
c0-4.7,2.1-6.3,2.1-6.3l-0.8-0.6V987c0,0,3-3.9,3-19.6c1.6-2,4.1-3.2,6.7-3.1V956c0,0,19.6-6.5,26.6-6.9s15.6-2.6,18-3.1
s7.7-1.2,7.7-1.2v-6.7h2.2v6.7h13.4v-11.5"/>
<path class="st0" d="M648.4,1044.1v-10l0,0V1044.1L648.4,1044.1v-10c-1.4,0-2.7,0.6-3.5,1.8c0.6-1,1.8-5.7,2.3-10
c0.6-4.9,3.4-13.6,5.2-18.8c-3.2-2.3-5.7-5.3-7.4-8.8h-1.8c-1.7,3.5-4.2,6.5-7.4,8.8c1.8,5.2,4.6,13.9,5.2,18.8
c0.5,4.3,1.8,8.9,2.3,10c-0.8-1.1-2.1-1.8-3.5-1.8v10h-40.9v-10c-1.5,0-3,0.8-3.7,2.2c0.4-1.9,0.7-3.8,0.9-5.7
c0.2-1.4,0.4-2.9,0.6-4.7c0.9-6.2,3.6-14.1,5.3-18.8c-7.7-6.1-10.3-15.3-10.9-18.3l-13.6-24.2l-65.1-13.3l0.3-16.3l7.8-58.4
l59.3-71.8V313.4c0-69,31.9-118.6,48.6-143.5c0-0.3-0.1-0.7-0.1-1c0-2.9,1.8-6.4,3.3-8.9c0.3-1,0.6-2.1,0.7-3.2
c0.2-2,0.7-3.9,1.6-5.6c2.1-3.3,5.8-5.3,9.7-5.3h0.9c3.7,0,10.7,2.9,10.7,13.7c0.2,2.5,0.4,5.1,0.8,7.6c24,31,52.2,81.4,52.2,146.3
v494.7l57.6,56.8l9.6,70.7l0.3,15.1l-79.1,39.7c-1.1,3.9-4,11.5-10.5,16.7c1.7,4.6,4.4,12.5,5.3,18.8c0.2,1.8,0.5,3.3,0.6,4.7
c0.2,1.9,0.5,3.8,0.9,5.7c-0.7-1.4-2.1-2.2-3.7-2.2v10L648.4,1044.1z M639.7,1044.1v-10V1044.1z"/>
<path class="st5" d="M644.5,150.9c0.3,0,5.7,0.1,5.7,8.7c0,1.4,0.8,9.4,1.4,10c17.8,23,51.7,74.4,51.7,143.9v21.1h-83.1v1.1h83.1
v474.5l57.9,57.1l9.3,68.8l0.2,11.7L692.3,987c0,0-2.1,12.7-12.3,18.1c0,0,5.2,12.7,6.5,21.4c1.2,8.7,1.3,12.5,2.8,12.5h-40.8
c1.3,0,3.2-7.5,3.8-12.6c0.8-6.4,6.3-21.6,6.3-21.6c-4.9-2.1-8.7-6.3-10.1-11.5h-8.6c-1.5,5.2-5.2,9.4-10.1,11.5
c0,0,5.5,15.2,6.3,21.6c0.6,5.1,2.5,12.6,3.8,12.6h-40.8c1.5,0,1.6-3.8,2.8-12.5s6.5-21.4,6.5-21.4c-10.2-5.4-12.3-18.1-12.3-18.1
l-15.1-26.8l-63.2-12.9l0.2-11.9l7.6-56.7l59.5-72.1V313.4c0-69.4,33.5-119.4,49.2-142.9c0,0-0.6-0.3-0.6-1.7s1.2-4,2.6-6.3
s1.3-7.2,2.3-8.8c1.2-1.8,3.3-2.9,5.4-2.9L644.5,150.9 M639.8,1039.1L639.8,1039.1 M644.5,140.9h-0.9c-5.7,0-11,2.9-14,7.7
c-1.3,2.3-2.1,4.8-2.3,7.5c-0.1,0.6-0.2,1.4-0.3,1.9c-2.3,4-3.6,7.5-3.7,10.5c-8.1,12.2-19.3,29.7-29,52.4
c-12.9,30.2-19.5,61.3-19.5,92.5V803l-57.2,69.4l-1.8,2.2l-0.4,2.8l-7.6,56.7l-0.1,0.6v0.6l-0.2,11.9l-0.1,8.3l8.1,1.7l58.8,12
l12.1,21.5c1.6,6.8,5,13,9.8,18c-2,5.4-3.4,10.9-4.4,16.6c-0.2,1.8-0.5,3.3-0.6,4.7c-0.3,2-0.5,4.2-0.7,4.9c0.6-2.3,3.7-5.8,8.5-5.8
v20h40.8l0,0v-20c0.6,0,1.2,0.1,1.8,0.2c-0.3,1.5-0.7,2.9-1.2,4.3c0.8-1.5,2.1-2.7,3.7-3.5c1.6,0.8,2.8,2,3.7,3.5
c-0.5-1.4-0.9-2.9-1.2-4.3c0.6-0.1,1.2-0.2,1.8-0.2v20v-20v20h40.8v-20c4.7,0,7.8,3.4,8.5,5.8c-0.2-0.7-0.5-2.9-0.7-4.9
c-0.2-1.4-0.4-3-0.6-4.7c-1-5.7-2.4-11.2-4.4-16.6c4-4.1,7.1-9.2,8.9-14.6l74.4-37.3l5.6-2.8l-0.1-6.3l-0.2-11.7v-0.6l-0.1-0.6
l-9.3-68.7l-0.5-3.4l-2.4-2.4L713.3,806V313.4c-0.1-32.2-6.9-64-20-93.4c-8.6-19.6-19.5-38-32.5-54.9c-0.3-1.8-0.5-4.6-0.6-5.6
C660.2,145.8,650.8,140.9,644.5,140.9L644.5,140.9z M641.6,1008.8c0.9-0.8,1.7-1.7,2.5-2.7c0.8,0.9,1.6,1.8,2.5,2.7
c-0.8,2.5-1.7,5.4-2.5,8.2C643.3,1014.2,642.4,1011.3,641.6,1008.8z"/>
<path class="st5" d="M644.5,150.9c0.3,0,5.7,0.1,5.7,8.7c0,1.4,0.8,9.4,1.4,10c17.8,23,51.7,74.4,51.7,143.9v21.1h-83.1v1.1h83.1
v474.5l57.9,57.1l9.3,68.8l0.2,11.7L692.3,987c0,0-2.1,12.7-12.3,18.1c0,0,5.2,12.7,6.5,21.4c1.2,8.7,1.3,12.5,2.8,12.5h-40.8
c1.3,0,3.2-7.5,3.8-12.6c0.8-6.4,6.3-21.6,6.3-21.6c-4.9-2.1-8.7-6.3-10.1-11.5h-8.6c-1.5,5.2-5.2,9.4-10.1,11.5
c0,0,5.5,15.2,6.3,21.6c0.6,5.1,2.5,12.6,3.8,12.6h-40.8c1.5,0,1.6-3.8,2.8-12.5s6.5-21.4,6.5-21.4c-10.2-5.4-12.3-18.1-12.3-18.1
l-15.1-26.8l-63.2-12.9l0.2-11.9l7.6-56.7l59.5-72.1V313.4c0-69.4,33.5-119.4,49.2-142.9c0,0-0.6-0.3-0.6-1.7s1.2-4,2.6-6.3
s1.3-7.2,2.3-8.8c1.2-1.8,3.3-2.9,5.4-2.9L644.5,150.9 M639.8,1039.1L639.8,1039.1 M644.5,140.9h-0.9c-5.7,0-11,2.9-14,7.7
c-1.3,2.3-2.1,4.8-2.3,7.5c-0.1,0.6-0.2,1.4-0.3,1.9c-2.3,4-3.6,7.5-3.7,10.5c-8.1,12.2-19.3,29.7-29,52.4
c-12.9,30.2-19.5,61.3-19.5,92.5V803l-57.2,69.4l-1.8,2.2l-0.4,2.8l-7.6,56.7l-0.1,0.6v0.6l-0.2,11.9l-0.1,8.3l8.1,1.7l58.8,12
l12.1,21.5c1.6,6.8,5,13,9.8,18c-2,5.4-3.4,10.9-4.4,16.6c-0.2,1.8-0.5,3.3-0.6,4.7c-0.3,2-0.5,4.2-0.7,4.9c0.6-2.3,3.7-5.8,8.5-5.8
v20h40.8l0,0v-20c0.6,0,1.2,0.1,1.8,0.2c-0.3,1.5-0.7,2.9-1.2,4.3c0.8-1.5,2.1-2.7,3.7-3.5c1.6,0.8,2.8,2,3.7,3.5
c-0.5-1.4-0.9-2.9-1.2-4.3c0.6-0.1,1.2-0.2,1.8-0.2v20v-20v20h40.8v-20c4.7,0,7.8,3.4,8.5,5.8c-0.2-0.7-0.5-2.9-0.7-4.9
c-0.2-1.4-0.4-3-0.6-4.7c-1-5.7-2.4-11.2-4.4-16.6c4-4.1,7.1-9.2,8.9-14.6l74.4-37.3l5.6-2.8l-0.1-6.3l-0.2-11.7v-0.6l-0.1-0.6
l-9.3-68.7l-0.5-3.4l-2.4-2.4L713.3,806V313.4c-0.1-32.2-6.9-64-20-93.4c-8.6-19.6-19.5-38-32.5-54.9c-0.3-1.8-0.5-4.6-0.6-5.6
C660.2,145.8,650.8,140.9,644.5,140.9L644.5,140.9z M641.6,1008.8c0.9-0.8,1.7-1.7,2.5-2.7c0.8,0.9,1.6,1.8,2.5,2.7
c-0.8,2.5-1.7,5.4-2.5,8.2C643.3,1014.2,642.4,1011.3,641.6,1008.8z"/>
<path class="st5" d="M816.4,866.8c-7-9.8-50.3-52.5-68.2-69.3s-25.5-27.5-29-37s-11.1-48.6-14-65.1s-9.2-45.3-10.5-49.2
s-5.4-26.4-7-35.9s-7.6-41.6-9.2-46.2s-5.9-21.1-10.2-33.5s-10.2-28.7-12-33.5s-6.7-8.7-12-8.7s-10.2,3.9-12,8.7s-7.8,21.1-12,33.5
s-8.5,28.8-10.2,33.5s-7.6,36.8-9.2,46.2s-5.7,32-7,35.9S586,679,583,695.4s-10.5,55.7-14,65.1s-11.1,20.2-29,37
s-61.3,59.5-68.3,69.3s-9.2,22-8.7,31.4s0.5,9.4,0.5,11.1v18.3c0,0,54.3,9.4,63.2,10.6s23.6,4.6,25.2,5.5s18.1,2.3,27.3,4.1
s20.2,3.7,22.9,4.6v34.8l5.3,0.9l0.9,1.8h71.5l0.9-1.8l5.3-0.9v-34.8c2.7-0.9,13.7-2.8,22.9-4.6s25.7-3.2,27.3-4.1
s16.3-4.3,25.2-5.5s63.2-10.6,63.2-10.6v-18.3c0-1.7,0-1.7,0.5-11.1S823.4,876.7,816.4,866.8z"/>
<path class="st0" d="M678.6,587c-6-28.4-18.5-67.8-18.5-67.8l-9-16.9H637l-9,16.9c0,0-12.5,39.4-18.4,67.8s-6.7,35.8-6.7,38.2v288.9
c0,10.8,9.7,42.5,9.7,42.5h26.3v-52.4c0-2.2,3.2-2.6,5.3-2.6s5.3,0.4,5.3,2.6v52.5h26.3c0,0,9.7-31.7,9.7-42.5V625.2
C685.3,622.8,684.5,615.5,678.6,587z M635.7,519.6c0.4-2.2,1.7-3.8,2.9-3.5s1.7,2.2,1.3,4.4s-1.7,3.8-2.9,3.6
S635.3,521.8,635.7,519.6L635.7,519.6z M640,537.7c-0.5,1-1.7,1.4-2.7,0.9c-1-0.5-1.4-1.7-0.9-2.7c0.4-0.9,1.4-1.3,2.4-1
C639.9,535.3,640.4,536.6,640,537.7z M644,539.5c-1.3,0.3-2.6-0.6-2.8-1.9c-0.3-1.3,0.6-2.6,1.9-2.8c1.3-0.3,2.6,0.6,2.8,1.9
c0,0.2,0,0.3,0,0.5C646,538.3,645.2,539.4,644,539.5L644,539.5z M644,524c-1.2,0-2.1-1.8-2.1-4s0.9-4,2.1-4s2.1,1.8,2.1,4
S645.2,524,644,524L644,524z M650.5,539.5c-1.2,0.6-2.6,0.1-3.2-1.1s-0.1-2.6,1.1-3.2s2.6-0.1,3.2,1.1c0.1,0.1,0.1,0.3,0.2,0.4
C652.2,537.8,651.7,539,650.5,539.5L650.5,539.5z M651.1,524c-1.1,0.2-2.4-1.3-2.9-3.5s0.1-4.1,1.3-4.4s2.4,1.3,2.9,3.5
S652.3,523.7,651.1,524L651.1,524z"/>
<polygon class="st5" points="623.1,597 625.4,590.2 632.6,582.9 640,580.5 641.6,570.2 629,575.9 618.1,584.7 615.7,597.9 "/>
<rect x="633.2" y="606.4" class="st5" width="9.8" height="8.8"/>
<path class="st0" d="M601.4,645.1v257.1h-65.2v8.2h-2v-8.1h-69.1v-2.6c0-2.1,3.2-7.8,4.7-11.7s3.7-8,4.4-10.8s7.6-9.2,11.3-12.7
s91.5-95.7,91.5-95.7S592.2,677.8,601.4,645.1z"/>
<path class="st0" d="M601.4,913.4v37.9c0,0-17.8-4-23.1-4.8s-23-2.9-25.4-3.7s-15.1-4.2-16.9-4.4v-28L601.4,913.4z"/>
<path class="st0" d="M534.2,910.4v27.8c0,0-24.9-3.4-37.5-5.8s-30.1-5.6-32.3-5.8v-20.3L534.2,910.4z"/>
<polygon class="st5" points="665,597 662.8,590.2 655.5,582.9 648.2,580.5 646.5,570.2 659.1,575.9 670,584.7 672.5,597.9 "/>
<rect x="645.1" y="606.4" class="st5" width="9.8" height="8.8"/>
<path class="st0" d="M686.7,645.1v257.1h65.2v8.2h2v-8.1H823v-2.6c0-2.1-3.2-7.8-4.7-11.7s-3.7-8-4.4-10.8s-7.6-9.2-11.3-12.7
s-91.5-95.7-91.5-95.7S695.9,677.8,686.7,645.1z"/>
<path class="st0" d="M686.7,913.4v37.9c0,0,17.8-4,23.1-4.8s23-2.9,25.4-3.7s15.1-4.2,16.9-4.4v-28L686.7,913.4z"/>
<path class="st0" d="M753.9,910.4v27.8c0,0,24.9-3.4,37.5-5.8s30.1-5.6,32.3-5.8v-20.3L753.9,910.4z"/>
<path class="st0" d="M612.2,958.3c-3.9-12.3-7-24.7-9.4-37.4v65.2h20.6V959L612.2,958.3z M607,958.5c0.9,0,1.7,0.8,1.7,1.7
s-0.8,1.7-1.7,1.7s-1.7-0.8-1.7-1.7v0C605.3,959.3,606,958.5,607,958.5C607,958.5,607,958.5,607,958.5L607,958.5z M607,965
c0.9,0,1.7,0.8,1.7,1.7s-0.8,1.7-1.7,1.7s-1.7-0.8-1.7-1.7v0C605.3,965.8,606,965,607,965C607,965,607,965,607,965L607,965z
M604.9,982.8c-0.6,0-1-0.4-1-1s0.4-1,1-1s1,0.4,1,1C605.9,982.3,605.5,982.8,604.9,982.8C604.9,982.8,604.9,982.8,604.9,982.8
L604.9,982.8z M605.3,973.2c0-0.9,0.8-1.7,1.8-1.7c0.9,0,1.7,0.8,1.7,1.8c0,0.9-0.8,1.6-1.7,1.7C606.1,975,605.3,974.3,605.3,973.2
C605.2,973.3,605.2,973.3,605.3,973.2L605.3,973.2z M609.1,982.3c-0.6,0-1-0.4-1-1s0.4-1,1-1s1,0.4,1,1
C610.1,981.9,609.7,982.3,609.1,982.3C609.1,982.3,609.1,982.3,609.1,982.3L609.1,982.3z"/>
<path class="st0" d="M676,958.3l-11.3,0.7v27.1h20.6v-65.2C683,933.6,679.8,946,676,958.3z M681.2,958.5c0.9,0,1.7,0.8,1.7,1.7
s-0.8,1.7-1.7,1.7s-1.7-0.8-1.7-1.7v0C679.4,959.3,680.2,958.5,681.2,958.5L681.2,958.5z M681.2,965c0.9,0,1.7,0.8,1.7,1.7
s-0.8,1.7-1.7,1.7s-1.7-0.8-1.7-1.7v0C679.4,965.8,680.2,965,681.2,965L681.2,965z M679,982.3c-0.6,0-1-0.4-1-1s0.4-1,1-1s1,0.4,1,1
S679.6,982.3,679,982.3z M679.4,973.2c0-0.9,0.8-1.7,1.7-1.7s1.7,0.8,1.7,1.7s-0.8,1.7-1.7,1.7h0
C680.2,974.9,679.4,974.2,679.4,973.2L679.4,973.2z M683.2,982.8c-0.6,0-1-0.4-1-1s0.4-1,1-1s1,0.4,1,1S683.8,982.8,683.2,982.8z"/>
<ellipse transform="matrix(0.9778 -0.2096 0.2096 0.9778 -192.2354 155.6226)" class="st0" cx="638" cy="984.7" rx="0.8" ry="1.2"/>
<polygon class="st0" points="624.7,986.1 635.1,986.1 635.1,983.5 624.7,977.7 "/>
<path class="st0" d="M640.2,905.5c0,0,0.7,1.3,1.6,1.3v83.1h-1.2L640.2,905.5z"/>
<ellipse transform="matrix(0.2096 -0.9778 0.9778 0.2096 -449.0005 1413.9041)" class="st0" cx="650.1" cy="984.7" rx="1.2" ry="0.8"/>
<polygon class="st0" points="663.4,986.1 653,986.1 653,983.5 663.4,977.7 "/>
<path class="st0" d="M648,905.5c0,0-0.7,1.3-1.6,1.3v83.1h1.2L648,905.5z"/>
<use xlink:href="#Новый_символ_2" width="62.9" height="62.9" x="-31.5" y="-31.5" transform="matrix(1.62 0 0 1.62 869.8933 593.9933)" style="overflow:visible;"/>
<use xlink:href="#Новый_символ_2" width="62.9" height="62.9" x="-31.5" y="-31.5" transform="matrix(1.62 0 0 1.62 318.0233 674.3633)" style="overflow:visible;"/>
<use xlink:href="#Новый_символ_2" width="62.9" height="62.9" x="-31.5" y="-31.5" transform="matrix(0.57 0 0 0.57 869.5251 694.095)" style="overflow:visible;"/>
<use xlink:href="#Новый_символ_2" width="62.9" height="62.9" x="-31.5" y="-31.5" transform="matrix(0.57 0 0 0.57 447.0251 641.7651)" style="overflow:visible;"/>
<use xlink:href="#Новый_символ_2" width="62.9" height="62.9" x="-31.5" y="-31.5" transform="matrix(0.46 0 0 0.46 273.0939 788.4239)" style="overflow:visible;"/>
<use xlink:href="#Новый_символ_2" width="62.9" height="62.9" x="-31.5" y="-31.5" transform="matrix(0.57 0 0 0.57 342.9951 547.545)" style="overflow:visible;"/>
<use xlink:href="#Новый_символ_2" width="62.9" height="62.9" x="-31.5" y="-31.5" transform="matrix(0.57 0 0 0.57 412.2851 436.9151)" style="overflow:visible;"/>
<use xlink:href="#Новый_символ_2" width="62.9" height="62.9" x="-31.5" y="-31.5" transform="matrix(0.57 0 0 0.57 995.9951 746.4551)" style="overflow:visible;"/>
<use xlink:href="#Новый_символ_2" width="62.9" height="62.9" x="-31.5" y="-31.5" transform="matrix(0.71 0 0 0.71 998.3502 658.5701)" style="overflow:visible;"/>
<use xlink:href="#Новый_символ_2" width="62.9" height="62.9" x="-31.5" y="-31.5" transform="matrix(0.71 0 0 0.71 922.8602 489.4901)" style="overflow:visible;"/>
<use xlink:href="#Новый_символ_2" width="62.9" height="62.9" x="-31.5" y="-31.5" transform="matrix(1.11 0 0 1.11 832.0261 422.8661)" style="overflow:visible;"/>
<use xlink:href="#Новый_символ_2" width="62.9" height="62.9" x="-31.5" y="-31.5" transform="matrix(1.11 0 0 1.11 448.2261 539.5862)" style="overflow:visible;"/>
<g class="st7">
<path class="st5" d="M808.7,224.4l-35.3,23.1l-5.8-8.4l14.3-9.1c3.5-2.3,6.7-4,10.1-5.2l-39.4-10.6l2.4-9l39.5,10.6
c-2.7-3-4-5.3-6.3-9.6l-7.8-15l9.2-4.4L808.7,224.4z"/>
</g>
<g class="st7">
<path class="st5" d="M855.8,245.5c3.6,1.5,7.5-0.3,11.8-3.8l5.2,5.8c-5.9,5.1-12.7,9.5-20.7,6.1c-8.6-3.7-8.3-14.2-13.9-16.6
c-3.8-1.6-7.6,0.4-11.8,3.8l-5.2-5.8c5.7-4.8,12.6-9.6,20.7-6.1C851,232.7,850.3,243.1,855.8,245.5z"/>
</g>
<g class="st7">
<path class="st5" d="M964.1,316.1c-9.3,12.9-21.7,18.2-32.4,10.5c-4.4-3.2-6.9-7.3-7.4-12.4L910,334l-9.7-5.4l43-59.6l7.8,5.6
l-3.4,5.9c6.3-2,12.4-1.1,17.1,2.3C975.9,290.8,973.8,302.6,964.1,316.1z M943.7,287.3l-14.3,19.8c-0.2,4.5,1.5,8.3,4.9,10.7
c6.1,4.4,12.6,2.1,20.3-8.5c7.9-10.9,8.3-17.4,2.7-21.5C953.3,285,948.1,285.5,943.7,287.3z"/>
</g>
<g class="st7">
<path class="st5" d="M1030.2,340.8l-14.5,12.8l-5.8-5.4l7.3-7.8c-5.5-4.8-13.5-4.3-22.6,1.2l-13.2,14.1l7.6,7.1l-5.4,5.8
l-21.3-19.9l5.4-5.8l5.6,5.2l24.7-26.5l-5.6-5.2l5.4-5.8l11.8,11l-6.8,10.1c8.8-3.7,15.9-3.4,22.5,2.8
C1027.7,336.7,1029,338.6,1030.2,340.8z"/>
</g>
<g class="st7">
<path class="st5" d="M1056.2,410.9c-12.8,10.5-26.6,10.9-36.2-0.8c-9.7-11.8-6.9-24.9,6.1-35.6c12.6-10.4,26.6-10.9,36.3,0.9
C1072.1,387.1,1069.1,400.4,1056.2,410.9z M1033.6,383.5c-10,8.2-12.1,15-7,21.2c5.1,6.2,12.2,5.5,22.2-2.8c9.9-8.2,12-15,7-21.1
C1050.7,374.7,1043.6,375.3,1033.6,383.5z"/>
</g>
<g class="st7">
<path class="st5" d="M1106.4,465.5l-33,20.3l-5.1-8.3l31.7-19.5c4.6-2.8,6.4-4.4,4.8-7c-1.3-2.2-4-3.6-8.5-3.8l-33.8,20.8l-4.7-7.7
l31.7-19.5c4.6-2.8,6.4-4.4,4.8-7c-1.4-2.3-4-3.6-8.5-3.8l-33.8,20.8l-5.2-8.4l44.4-27.3l4.3,7.1l-4.4,3.6
c5.1,0.4,9.2,1.5,11.8,5.8c2.1,3.4,2.5,7.2-1,11c4.9,0.5,9,2,11.6,6.3C1116.7,453.9,1116.3,459.4,1106.4,465.5z"/>
</g>
<g class="st7">
<path class="st5" d="M1124.6,534.7c-14.6,6.4-28,4.6-33.3-7.6c-2.2-5-2.2-9.8,0-14.5l-22.5,9.8l-5.6-9.7l67.6-29.4l3.8,8.8
l-5.9,3.3c6.5,1.5,11.2,5.4,13.5,10.8C1147.7,519,1139.9,528.1,1124.6,534.7z M1121.7,499.5l-22.5,9.8c-2.5,3.8-3,7.9-1.3,11.8
c3,6.9,9.9,8.3,21.9,3c12.4-5.4,16.1-10.8,13.3-17.1C1131.2,502.4,1126.5,500.2,1121.7,499.5z"/>
</g>
<g class="st7">
<path class="st5" d="M1113.7,590.2c-3.4-11.7,1.3-19.7,11.2-22.6l27.1-8l-3.3-11.1l7.8-2.3l3.3,11.1l11.2-3.3l4.3,10.3l-12.4,3.6
l5,17l-8.1,1l-4.6-15.7l-27,7.9c-5.4,1.6-7.2,4.9-5.4,11.1c1.1,3.6,2.9,6.5,5.1,8.6l-5.9,5.9
C1118.4,600.6,1115.4,595.8,1113.7,590.2z"/>
</g>
<g class="st7">
<path class="st5" d="M164.5,569.5c-4.1-1.2-6.4-0.1-12.1,9.4c-5.5,9.2-10.9,14.7-19.6,12.2c-8.6-2.5-12.2-11.9-8.6-24.2
c2.5-8.4,6.7-13.8,11.3-17.4l5.4,6.5c-3.7,3.1-6.9,7-8.6,12.9c-2,6.8-0.6,10.1,2.7,11.1c3.8,1.1,6-1.2,11.7-10.4
c5.5-9,10.8-14.4,20.3-11.7c10.9,3.2,12.5,15.2,9.1,26.6c-2.7,9.3-7.7,15-13,18.5l-4.8-7.5c4.3-3,8.1-7.5,9.8-13.4
C170,575.7,168.6,570.7,164.5,569.5z"/>
</g>
<g class="st7">
<path class="st5" d="M182.4,491c14.6,6.4,22.4,17.4,17.1,29.5c-2.2,5-5.7,8.3-10.6,9.8l22.4,9.8l-3.3,10.7l-67.3-29.5l3.8-8.8
l6.4,2.1c-3.3-5.8-3.7-11.8-1.3-17.2C155.3,484.8,167.2,484.4,182.4,491z M158.6,517.1l22.4,9.8c4.4-0.8,7.8-3.2,9.5-7.1
c3-6.9-0.6-12.8-12.6-18c-12.3-5.4-18.8-4.4-21.5,1.9C154.3,508.2,155.9,513.1,158.6,517.1z"/>
</g>
<g class="st7">
<path class="st5" d="M233.5,442.8l5.1,6.1c-3.1,4-6.9,6.2-11.8,5.4c2.1,5.8,1,12.3-2.5,17.9c-5.6,9.1-14.5,11.3-22.8,6.3
c-9.3-5.7-10-16.5-1.7-30.1l3.9-6.3l-2.9-1.7c-5.8-3.5-10.3-1.3-14.1,4.9c-1.8,3-3.8,7.8-4.9,13.2l-8.1-1.7
c1.3-6.9,3.7-12.9,6.5-17.5c7.3-12,16.4-14.4,25.8-8.7l19.9,12.1C229.3,444.9,231.3,444.7,233.5,442.8z M219.5,451.7l-9.9-6
l-3.2,5.2c-5.4,8.9-4.4,14.2,0.8,17.4c4.7,2.9,8.8,1.9,11.8-3.1C221.5,461.4,221.8,456.2,219.5,451.7z"/>
</g>
<g class="st7">
<path class="st5" d="M263.4,393.9l8.7,0.5c0.2,5.9-2,12.8-6.3,18.2c-10,12.6-24.1,13.1-36.9,3c-12.4-9.9-15.8-24.6-5.8-37.2
c4.4-5.5,9.8-8.8,16.1-10.2l2.2,8.3c-4.7,1.4-8.5,3.8-11.3,7.2c-5.1,6.5-4.2,14.6,6,22.6c10.2,8.1,17.7,6.5,22.7,0.2
C261.9,402.9,263.1,398.5,263.4,393.9z"/>
</g>
<g class="st7">
<path class="st5" d="M300.3,362.6c3.6-3.5,5.6-7.6,6.7-12.8l8.1,1.5c-0.7,6.2-3.9,12.7-9.1,17.8c-11.7,11.4-25.8,9.6-37.1-2.1
c-10.9-11.2-12.7-26-2.1-36.3c9.9-9.6,23-8.6,34.3,3c1.2,1.3,2.5,2.7,3.2,3.8l-24.8,24.1C287.4,368.8,294.9,367.9,300.3,362.6z
M274.2,356.3l17.4-16.9c-7-7-13.7-8-19-2.9C267.5,341.4,267.4,348.3,274.2,356.3z"/>
</g>
<g class="st7">
<path class="st5" d="M350.7,311.6c-2.5-3.4-5.1-4-15.4,0.3c-9.9,4.1-17.5,5.3-23-2c-5.4-7.2-2.6-16.8,7.7-24.5
c7-5.3,13.6-7,19.5-7.1l0.4,8.5c-4.8,0.3-9.7,1.5-14.6,5.2c-5.7,4.3-6.5,7.7-4.5,10.5c2.4,3.2,5.6,2.6,15.6-1.3
c9.8-3.9,17.3-5.1,23.2,2.8c6.8,9.1,0.9,19.6-8.7,26.8c-7.7,5.8-15.2,7.4-21.5,7l0.6-8.9c5.2,0.2,11-1.2,15.9-4.9
C351.5,319.8,353.3,315.1,350.7,311.6z"/>
</g>
<g class="st7">
<path class="st5" d="M373.7,259c1.2-6.6,4.9-11.7,10.3-14.8c8.5-4.8,15.5-2.1,20.3,6.4l18.7,33.1l-9.6,5.4l-17.8-31.7
c-3.1-5.4-6.2-6.5-10.8-3.9c-4.3,2.4-6.3,7.9-6.8,12.7l18.3,32.5l-9.6,5.4l-35.8-63.6l9.1-6.5L373.7,259z"/>
</g>
<g class="st7">
<path class="st5" d="M463.7,257.1l13.2-5.4l3.1,7.5L442,274.7l-3.1-7.5l14.4-5.9l-13.7-33.4l-14,5.7l-3.1-7.5l24.3-9.9L463.7,257.1
z M439.5,199c1.5,3.7-0.1,7.6-4.1,9.2c-4,1.7-7.8,0-9.3-3.7c-1.5-3.7,0-7.6,4-9.3C434.1,193.6,438,195.3,439.5,199z"/>
</g>
<g class="st7">
<path class="st5" d="M534.8,216.2c4.1,15.4,0.4,28.3-12.4,31.7c-5.3,1.4-10,0.7-14.3-2.1l6.3,23.7l-10.4,4.1l-18.9-71l9.3-2.5
l2.4,6.3c2.4-6.2,7-10.2,12.6-11.7C522.7,191.1,530.5,200.2,534.8,216.2z M499.6,213.9l6.3,23.6c3.4,3,7.3,4.1,11.4,3
c7.3-1.9,9.6-8.5,6.2-21.1c-3.5-13-8.2-17.4-14.9-15.7C503.9,204.9,501.1,209.3,499.6,213.9z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -0,0 +1,259 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Слой_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 1288.1 1288.1" style="enable-background:new 0 0 1288.1 1288.1;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
.st1{clip-path:url(#SVGID_2_);}
.st2{fill:#C34435;}
.st3{fill:#181A3E;stroke:#C34435;stroke-width:20;stroke-miterlimit:10;}
.st4{clip-path:url(#SVGID_4_);}
.st5{clip-path:url(#SVGID_6_);}
.st6{fill:#181A3E;}
.st7{fill:#FFFFFF;stroke:#181A3E;stroke-width:10;stroke-miterlimit:10;}
</style>
<symbol id="Новый_символ_2" viewBox="-31.5 -31.5 62.9 62.9">
<polygon class="st0" points="0,-1.6 31.5,0 0,1.6 -31.5,0 "/>
<polygon class="st0" points="-1.6,0 0,-31.5 1.6,0 0,31.5 "/>
<polygon class="st0" points="-1.1,-1.1 -16,16 1.1,1.1 16,-16 "/>
<polygon class="st0" points="-1.1,1.1 16,16 1.1,-1.1 -16,-16 "/>
</symbol>
<title>red-blue no letters, stars placement from example, rays small</title>
<g>
<defs>
<circle id="SVGID_1_" cx="644.7" cy="-624.7" r="429.3"/>
</defs>
<clipPath id="SVGID_2_">
<use xlink:href="#SVGID_1_" style="overflow:visible;"/>
</clipPath>
<g class="st1">
<polygon class="st2" points="643.4,-474.8 657.8,-817.8 657.8,-474.1 686.5,-815.1 672.1,-472 715,-809.7 686.3,-468.7
743.2,-801.6 700.3,-464 771.1,-790.9 714.1,-457.9 798.4,-777.6 727.6,-450.6 825.1,-761.7 740.8,-442.1 851.1,-743.3
753.6,-432.3 876.3,-722.5 766,-421.3 900.5,-699.4 777.9,-409.2 923.8,-674 789.2,-395.9 945.9,-646.5 800,-381.7 966.9,-617
810.2,-366.4 986.6,-585.5 819.7,-350.2 1004.9,-552.3 828.5,-333.2 1021.8,-517.4 836.5,-315.3 1037.2,-481 843.9,-296.8
1051,-443.1 850.4,-277.5 1063.2,-404.1 856.1,-257.8 1073.8,-364 861,-237.4 1082.7,-323 865,-216.7 1089.8,-281.2 868.1,-195.7
1095.2,-238.8 870.3,-174.4 1098.8,-196 871.7,-152.9 1100.6,-152.9 872.2,-131.3 1100.6,-109.8 871.7,-109.8 1098.8,-66.7
870.3,-88.3 1095.2,-23.9 868.1,-67 1089.8,18.5 865,-45.9 1082.7,60.3 861,-25.2 1073.8,101.3 856.1,-4.9 1063.2,141.4
850.4,14.9 1051,180.5 843.9,34.1 1037.2,218.3 836.5,52.7 1021.8,254.7 828.5,70.5 1004.9,289.6 819.7,87.6 986.6,322.9
810.2,103.8 966.9,354.3 800,119 945.9,383.9 789.2,133.3 923.8,411.4 777.9,146.5 900.5,436.7 766,158.6 876.3,459.9
753.6,169.6 851.1,480.6 740.8,179.4 825.1,499 727.6,188 798.4,514.9 714.1,195.3 771.1,528.2 700.3,201.3 743.2,539 686.3,206
715,547 672.1,209.4 686.5,552.5 657.8,211.4 657.8,555.2 643.4,212.1 629.1,555.2 629.1,211.4 600.4,552.5 614.8,209.4
571.9,547 600.6,206 543.7,539 586.6,201.3 515.8,528.2 572.8,195.3 488.5,514.9 559.2,188 461.8,499 546.1,179.4 435.8,480.6
533.3,169.6 410.6,459.9 520.9,158.6 386.3,436.7 509,146.5 363.1,411.4 497.6,133.3 340.9,383.9 486.9,119 320,354.3
476.7,103.8 300.3,322.9 467.2,87.6 282,289.6 458.4,70.5 265.1,254.7 450.3,52.7 249.7,218.3 443,34.1 235.9,180.5 436.5,14.9
223.6,141.4 430.8,-4.9 213.1,101.3 425.9,-25.2 204.2,60.3 421.9,-45.9 197,18.5 418.8,-67 191.6,-23.9 416.5,-88.3 188.1,-66.7
415.2,-109.8 186.2,-109.8 414.7,-131.3 186.2,-152.9 415.2,-152.9 188.1,-196 416.5,-174.4 191.6,-238.8 418.8,-195.7
197,-281.2 421.9,-216.7 204.2,-323 425.9,-237.4 213.1,-364 430.8,-257.8 223.6,-404.1 436.5,-277.5 235.9,-443.1 443,-296.8
249.7,-481 450.3,-315.3 265.1,-517.4 458.4,-333.2 282,-552.3 467.2,-350.2 300.3,-585.5 476.7,-366.4 320,-617 486.9,-381.7
340.9,-646.5 497.6,-395.9 363.1,-674 509,-409.2 386.3,-699.4 520.9,-421.3 410.6,-722.5 533.3,-432.3 435.8,-743.3
546.1,-442.1 461.8,-761.7 559.2,-450.6 488.5,-777.6 572.8,-457.9 515.8,-790.9 586.6,-464 543.7,-801.6 600.6,-468.7
571.9,-809.7 614.8,-472 600.4,-815.1 629.1,-474.1 629.1,-817.8 "/>
</g>
</g>
<circle class="st3" cx="644.7" cy="719.7" r="429.3"/>
<path class="st2" d="M644.5,150.9c0.3,0,5.7,0.1,5.7,8.7c0,1.4,0.8,9.4,1.4,10c17.8,23,51.7,74.4,51.7,143.9v111.1l6.2,14v6.5h-1.1
v5l10.3,15.4c0,0,8.3,1.1,11.9,6.5s27.6,41.2,29,43s1.3,4.8,0,5.5c-0.9,0.5-1.8,1.1-2.7,1.8l11.2,14.6l3.4,22.3V633l-9.7,15.4v144
l2.8,7.3h7.9c3.8,0,4.1,10-0.2,10h-2.8l8.5,10.5v7l36.8,36.8c4,4,10.3,17.4,10.3,33.3v30.7l-53.5,9.9v71.4l-9.1,12.4h-10
c0,0,4.7,8.9,4.7,17.7h-63.1c-0.1-6.2,1.5-12.4,4.4-17.9H691c0-4.7,2.1-6.3,2.1-6.3l-0.8-0.6V987c0,0-2.1,12.7-12.3,18.1
c0,0,5.2,12.7,6.5,21.4c1.2,8.7,1.3,12.5,2.8,12.5h-40.9c1.3,0,3.2-7.5,3.8-12.6c0.8-6.4,6.3-21.6,6.3-21.6
c-4.9-2.1-8.7-6.3-10.1-11.5c0,0-1.2,48-2.5,48h-3.5c-1.3,0-2.5-48-2.5-48c-1.5,5.2-5.2,9.4-10.1,11.5c0,0,5.5,15.2,6.3,21.6
c0.6,5.1,2.5,12.6,3.8,12.6h-40.8c1.5,0,1.6-3.8,2.8-12.5s6.5-21.4,6.5-21.4c-10.2-5.4-12.3-18.1-12.3-18.1v27.2l-0.8,0.6
c0,0,2.1,1.6,2.1,6.3h-7.7c2.9,5.5,4.4,11.7,4.4,17.9h-63.1c0-8.7,4.7-17.7,4.7-17.7h-10l-9.1-12.4v-71.4l-53.5-9.9v-30.7
c0-16,6.3-29.3,10.3-33.3l36.8-36.8v-7l8.5-10.5h-2.7c-4.3,0-4-10-0.2-10h7.9l2.8-7.3v-144l-9.6-15.3v-73.8l3.4-22.3l11.2-14.6
c-0.9-0.6-1.8-1.2-2.7-1.8c-1.3-0.7-1.4-3.7,0-5.5s25.4-37.6,29-43s11.9-6.5,11.9-6.5l10.3-15.4v-5.1h-1.1v-6.5l6.2-14v-111
c0-69.4,33.4-119.4,49.2-142.9c0,0-0.6-0.3-0.6-1.7s1.2-4,2.6-6.3s1.3-7.2,2.3-8.8c1.2-1.8,3.3-2.9,5.4-2.9L644.5,150.9
M639.8,1039.1L639.8,1039.1 M644.5,130.9h-0.9c-9.1,0-17.6,4.7-22.5,12.4c-2,3.4-3.2,7.2-3.7,11.1v0.1c-1.9,3.2-3.2,6.8-3.9,10.5
c-11.1,16.4-20.6,33.8-28.5,51.9c-13.5,31.4-20.3,63.9-20.3,96.5v106.9l-4.5,10.1l-1.7,3.9v11.3l-1.8,2.7
c-6.4,2.5-11.9,6.8-15.9,12.4l-5.4,8c-7,10.4-21.4,31.8-23.2,34.4c-3.6,4.9-5.3,11-4.8,17.1l-3.4,4.5l-3.1,4.1l-0.8,5.1l-3.4,22.3
l-0.2,1.5v81.1l3.1,4.9l6.6,10.5v127.6c-4.6,2.2-8.3,5.8-10.6,10.2c-2,3.9-3,8.3-3,12.7c0,1.6,0.1,3.2,0.4,4.7l-3,3.6v5.7l-31,30.9
c-7.8,7.8-16.2,26-16.2,47.5v47.4l16.4,3l37.1,6.8v61.3l3.9,5.3l9.1,12.4l1.6,2.1c-0.1,1.2-0.1,2.4-0.1,3.7v20H633
c2.9,1.5,6,2.3,9.3,2.3h3.5c3.2,0,6.4-0.8,9.3-2.3h122.3v-20c0-1.2,0-2.5-0.2-3.7l1.6-2.1l9.1-12.4l3.9-5.3v-61.3l37.2-6.8l16.4-3
v-47.3c0-21.5-8.4-39.7-16.2-47.5l-31-30.9V813l-2.9-3.6c0.3-1.6,0.4-3.1,0.4-4.7c0-4.4-1-8.8-3-12.7c-2.3-4.5-6.1-8.1-10.6-10.2
V654.1l6.6-10.5l3.1-4.9v-81.1l-0.2-1.5l-3.4-22.3l-0.8-5.1l-3.1-4.1l-3.4-4.5c0.5-6.1-1.2-12.2-4.8-17.1
c-1.8-2.5-16.1-23.9-23.1-34.2l-5.5-8.2c-3.9-5.6-9.5-10-15.9-12.4l-1.8-2.7v-11.3l-1.7-3.9l-4.5-10.1V313.4
c-0.1-33.6-7.2-66.8-20.8-97.4c-8.5-19.4-19.3-37.8-32.1-54.8c-0.1-0.8-0.2-1.5-0.2-2C670,140.8,656.9,130.8,644.5,130.9
L644.5,130.9z"/>
<g>
<defs>
<circle id="SVGID_3_" cx="644.7" cy="719.7" r="429.3"/>
</defs>
<clipPath id="SVGID_4_">
<use xlink:href="#SVGID_3_" style="overflow:visible;"/>
</clipPath>
<g class="st4">
<polygon class="st2" points="643.4,931.1 657.8,667.8 657.8,931.7 686.5,669.9 672.1,933.2 715,674 686.3,935.8 743.2,680.2
700.3,939.4 771.1,688.5 714.1,944 798.4,698.7 727.6,949.7 825.1,710.9 740.8,956.2 851.1,725 753.6,963.8 876.3,741 766,972.2
900.5,758.7 777.9,981.5 923.8,778.2 789.2,991.6 945.9,799.3 800,1002.6 966.9,822 810.2,1014.3 986.6,846.1 819.7,1026.7
1004.9,871.6 828.5,1039.8 1021.8,898.4 836.5,1053.5 1037.2,926.4 843.9,1067.8 1051,955.4 850.4,1082.5 1063.2,985.4
856.1,1097.7 1073.8,1016.2 861,1113.3 1082.7,1047.7 865,1129.2 1089.8,1079.7 868.1,1145.3 1095.2,1112.3 870.3,1161.7
1098.8,1145.1 871.7,1178.2 1100.6,1178.2 872.2,1194.7 1100.6,1211.3 871.7,1211.3 1098.8,1244.3 870.3,1227.8 1095.2,1277.2
868.1,1244.1 1089.8,1309.7 865,1260.3 1082.7,1341.8 861,1276.2 1073.8,1373.3 856.1,1291.8 1063.2,1404.1 850.4,1307
1051,1434.1 843.9,1321.7 1037.2,1463.1 836.5,1336 1021.8,1491.1 828.5,1349.7 1004.9,1517.8 819.7,1362.8 986.6,1543.4
810.2,1375.2 966.9,1567.5 800,1386.9 945.9,1590.2 789.2,1397.8 923.8,1611.3 777.9,1408 900.5,1630.8 766,1417.3 876.3,1648.5
753.6,1425.7 851.1,1664.5 740.8,1433.2 825.1,1678.6 727.6,1439.8 798.4,1690.8 714.1,1445.4 771.1,1701 700.3,1450.1
743.2,1709.2 686.3,1453.7 715,1715.4 672.1,1456.2 686.5,1719.6 657.8,1457.8 657.8,1721.7 643.4,1458.3 629.1,1721.7
629.1,1457.8 600.4,1719.6 614.8,1456.2 571.9,1715.4 600.6,1453.7 543.7,1709.2 586.6,1450.1 515.8,1701 572.8,1445.4
488.5,1690.8 559.2,1439.8 461.8,1678.6 546.1,1433.2 435.8,1664.5 533.3,1425.7 410.6,1648.5 520.9,1417.3 386.3,1630.8
509,1408 363.1,1611.3 497.6,1397.8 340.9,1590.2 486.9,1386.9 320,1567.5 476.7,1375.2 300.3,1543.4 467.2,1362.8 282,1517.8
458.4,1349.7 265.1,1491.1 450.3,1336 249.7,1463.1 443,1321.7 235.9,1434.1 436.5,1307 223.6,1404.1 430.8,1291.8 213.1,1373.3
425.9,1276.2 204.2,1341.8 421.9,1260.3 197,1309.7 418.8,1244.1 191.6,1277.2 416.5,1227.8 188.1,1244.3 415.2,1211.3
186.2,1211.3 414.7,1194.7 186.2,1178.2 415.2,1178.2 188.1,1145.1 416.5,1161.7 191.6,1112.3 418.8,1145.3 197,1079.7
421.9,1129.2 204.2,1047.7 425.9,1113.3 213.1,1016.2 430.8,1097.7 223.6,985.4 436.5,1082.5 235.9,955.4 443,1067.8 249.7,926.4
450.3,1053.5 265.1,898.4 458.4,1039.8 282,871.6 467.2,1026.7 300.3,846.1 476.7,1014.3 320,822 486.9,1002.6 340.9,799.3
497.6,991.6 363.1,778.2 509,981.5 386.3,758.7 520.9,972.2 410.6,741 533.3,963.8 435.8,725 546.1,956.2 461.8,710.9
559.2,949.7 488.5,698.7 572.8,944 515.8,688.5 586.6,939.4 543.7,680.2 600.6,935.8 571.9,674 614.8,933.2 600.4,669.9
629.1,931.7 629.1,667.8 "/>
</g>
</g>
<g>
<defs>
<circle id="SVGID_5_" cx="644.7" cy="719.7" r="429.3"/>
</defs>
<clipPath id="SVGID_6_">
<use xlink:href="#SVGID_5_" style="overflow:visible;"/>
</clipPath>
<g class="st5">
<path class="st6" d="M449.2,1173.8c-28.9,0-53.9-16.9-63.8-43.1c-6.4-16.9-5.6-35.7,2.2-52c5.5-11.7,14.2-21.6,25-28.7l3.1-11.2
c4.4-15.9,14.9-28,28.7-33.2c5-1.9,10.2-2.8,15.5-2.8c5.5,0,10.9,1,16.1,2.8c6.1-13.5,17.2-24,31.1-29.4
c6.2-2.4,12.8-3.6,19.5-3.6c25.8,0,49.8,17.7,59.8,44c12.9,34-1.7,71.1-32.5,82.8c-6.2,2.4-12.8,3.6-19.5,3.6l0,0
c-4.7,0-9.4-0.6-14-1.8c1.4,29.2-16.9,56.8-45.6,67.8C466.5,1172.2,457.9,1173.8,449.2,1173.8z M441.9,1038.7
c-6.3,0-12.5,1.8-17.9,5.1c0.9-0.4,1.8-0.8,2.8-1.1c5.1-1.9,10.3-3.3,15.7-4L441.9,1038.7z"/>
<path class="st2" d="M526.5,977.7c23.1,0,45.7,15.8,55.1,40.8c11.9,31.5-1.3,65.7-29.7,76.4c-5.7,2.1-11.7,3.2-17.7,3.2
c-6.8,0-13.5-1.3-19.8-3.9c5,29.1-12,59-41.6,70.2c-7.6,2.9-15.6,4.4-23.8,4.4c-25.8,0-49.8-15.1-59.1-39.9
c-12.2-32.3,5-68.8,38.5-81.5c7.6-2.9,15.6-4.4,23.7-4.4c7.4,0,14.7,1.2,21.6,3.7c-9.4-8.3-20.8-13-32-13c-7.6,0-15,2.2-21.4,6.4
c3.9-13.9,12.8-25,25.6-29.9c4.4-1.7,9-2.5,13.7-2.5c6.5,0.1,12.9,1.5,18.8,4.3c5.3-14.2,15.8-25.7,30.2-31.1
C514.5,978.8,520.5,977.7,526.5,977.7 M526.5,967.7c-7.3,0-14.5,1.3-21.2,3.9c-13.6,5.2-25,15.1-31.9,28
c-4.4-1.2-8.9-1.8-13.5-1.8c-5.9,0-11.8,1.1-17.3,3.2c-15.3,5.8-26.8,19.1-31.7,36.6l-2.6,9.4c-27.3,19-39.6,54.1-27.6,85.6
c5.3,13.9,14.8,25.8,27.3,34c12.2,8.1,26.6,12.4,41.2,12.3c9.3,0,18.6-1.7,27.3-5c28.7-10.9,47.6-37.4,48.9-66.3
c3,0.4,6,0.7,9,0.7c7.3,0,14.5-1.3,21.2-3.9c16.4-6.2,29-19,35.7-36.2c6.5-17.1,6.4-36.1-0.2-53.1
C580.3,986.7,554.4,967.7,526.5,967.7L526.5,967.7z"/>
<path class="st6" d="M838.9,1173.8c-8.7,0-17.4-1.6-25.5-4.7c-28.8-10.9-47-38.6-45.6-67.8c-4.6,1.2-9.3,1.7-14,1.8
c-6.7,0-13.3-1.2-19.5-3.6c-30.8-11.7-45.4-48.8-32.5-82.8c10-26.3,34-44,59.8-44c6.7,0,13.3,1.2,19.5,3.6
c13.8,5.3,25,15.8,31.1,29.3c5.2-1.8,10.6-2.8,16.1-2.8c5.3,0,10.5,0.9,15.5,2.8c13.8,5.2,24.2,17.3,28.7,33.2l3.1,11.2
c26.5,17.5,38.6,50.8,27.2,80.7C892.8,1156.9,867.8,1173.8,838.9,1173.8z M845.7,1038.7c5.4,0.7,10.6,2.1,15.7,4
c0.9,0.4,1.9,0.7,2.8,1.1c-5.3-3.4-11.5-5.2-17.9-5.1L845.7,1038.7z"/>
<path class="st2" d="M761.6,977.7c6,0,12,1.1,17.7,3.2c14.4,5.5,24.9,17,30.2,31.1c5.9-2.8,12.3-4.3,18.8-4.3
c4.7,0,9.3,0.8,13.7,2.5c12.8,4.9,21.8,16,25.6,29.9c-6.3-4.2-13.8-6.5-21.4-6.4c-11.2,0-22.5,4.7-32,13
c6.9-2.4,14.2-3.7,21.6-3.7c8.1,0,16.1,1.5,23.7,4.4c33.5,12.7,50.8,49.2,38.5,81.5c-9.4,24.8-33.4,39.9-59.2,39.9
c-8.1,0-16.2-1.5-23.8-4.4c-29.7-11.2-46.6-41.1-41.6-70.2c-6.3,2.5-13,3.8-19.8,3.9c-6,0-12-1.1-17.7-3.2
c-28.3-10.7-41.6-44.9-29.7-76.4C715.9,993.4,738.5,977.7,761.6,977.7 M761.6,967.7L761.6,967.7L761.6,967.7
c-27.9,0-53.8,19-64.5,47.2c-13.9,36.6,2,76.6,35.5,89.3c6.8,2.6,14,3.9,21.2,3.9c3,0,6-0.2,9-0.7c1.2,28.9,20.1,55.4,48.9,66.3
c8.7,3.3,18,5,27.3,5c14.7,0,29-4.2,41.2-12.3c12.4-8.2,22-20.1,27.3-34c12-31.6-0.3-66.6-27.6-85.6l-2.6-9.4
c-4.9-17.4-16.4-30.8-31.7-36.6c-5.5-2.1-11.4-3.2-17.3-3.2c-4.6,0-9.1,0.6-13.5,1.8c-6.9-12.9-18.2-22.8-31.9-28
C776.1,968.9,768.9,967.6,761.6,967.7L761.6,967.7z"/>
<rect x="500.8" y="1015.4" class="st6" width="286.4" height="153.9"/>
<path class="st2" d="M595,1030.7c0,0-17.8,32.3,31.5,104.4c0,0-1-19.2,5.3-31.1c0,0,16.5,42,17.8,56.8c0,0,23.2-48.3,18.6-80.7
c0,0,14.7,14.4,9.7,31.6c0,0,31.2-26.5,21.4-80.7L595,1030.7z"/>
<path class="st2" d="M690.9,1030.8c0,0-11.4,20.7,20.3,67.1c0,0-0.7-12.3,3.4-20c0,0,10.6,27,11.4,36.5c0,0,14.9-31.1,12-51.8
c0,0,9.5,9.2,6.2,20.3c0,0,20.1-17,13.8-51.9L690.9,1030.8z"/>
<path class="st2" d="M529.7,1030.8c0,0-11.4,20.7,20.3,67.1c0,0-0.7-12.3,3.4-20c0,0,10.6,27,11.4,36.5c0,0,14.9-31.1,12-51.8
c0,0,9.5,9.2,6.2,20.3c0,0,20.1-17,13.8-51.9L529.7,1030.8z"/>
</g>
</g>
<path class="st6" d="M639.8,988.8c0,0,1.2,52.6,2.5,52.6h3.5c1.3,0,2.5-52.6,2.5-52.6"/>
<path class="st7" d="M585.1,940.4V444.9h2.7v-24.5l-8.7,18.1v6.5h1.1v5.1l-10.3,15.4c0,0-8.3,1.1-11.9,6.5s-27.6,41.2-29,43
s-1.3,4.8,0,5.5c0.9,0.5,1.8,1.1,2.7,1.8l-11.2,14.6l-3.4,22.3V633l9.7,15.4v144l-2.8,7.3H516c-3.8,0-4.1,10,0.2,10h2.7l-8.5,10.5v7
l-36.8,36.8c-4,4-10.3,17.4-10.3,33.3v30.7l53.5,9.9v71.4l9.1,12.4h10c0,0-4.7,8.9-4.7,17.7h63.1c0.1-6.2-1.5-12.4-4.4-17.9h7.7
c0-4.7-2.1-6.3-2.1-6.3l0.8-0.6V987c0,0-3-3.9-3-19.6c-1.6-2-4.1-3.2-6.7-3.1V956c0,0-19.6-6.5-26.6-6.9s-15.6-2.6-18-3.1
s-7.7-1.2-7.7-1.2v-6.7H532v6.7h-13.5v-11.5"/>
<path class="st7" d="M703.1,940.4V444.9h-2.7v-24.5l8.7,18.1v6.5H708v5.1l10.3,15.4c0,0,8.3,1.1,11.9,6.5s27.6,41.2,29,43
s1.3,4.8,0,5.5c-0.9,0.5-1.8,1.1-2.7,1.8l11.2,14.6l3.4,22.3V633l-9.7,15.4v144l2.8,7.3h7.9c3.8,0,4.1,10-0.2,10h-2.7l8.5,10.5v7
l36.8,36.8c4,4,10.3,17.4,10.3,33.3v30.7l-53.5,9.9v71.4l-9.1,12.4h-10c0,0,4.7,8.9,4.7,17.7h-63.1c-0.1-6.2,1.5-12.4,4.4-17.9h-7.7
c0-4.7,2.1-6.3,2.1-6.3l-0.8-0.6V987c0,0,3-3.9,3-19.6c1.6-2,4.1-3.2,6.7-3.1V956c0,0,19.6-6.5,26.6-6.9s15.6-2.6,18-3.1
s7.7-1.2,7.7-1.2v-6.7h2.2v6.7h13.4v-11.5"/>
<path class="st0" d="M648.4,1044.1v-10l0,0V1044.1L648.4,1044.1v-10c-1.4,0-2.7,0.6-3.5,1.8c0.6-1,1.8-5.7,2.3-10
c0.6-4.9,3.4-13.6,5.2-18.8c-3.2-2.3-5.7-5.3-7.4-8.8h-1.8c-1.7,3.5-4.2,6.5-7.4,8.8c1.8,5.2,4.6,13.9,5.2,18.8
c0.5,4.3,1.8,8.9,2.3,10c-0.8-1.1-2.1-1.8-3.5-1.8v10h-40.9v-10c-1.5,0-3,0.8-3.7,2.2c0.4-1.9,0.7-3.8,0.9-5.7
c0.2-1.4,0.4-2.9,0.6-4.7c0.9-6.2,3.6-14.1,5.3-18.8c-7.7-6.1-10.3-15.3-10.9-18.3l-13.6-24.2l-65.1-13.3l0.3-16.3l7.8-58.4
l59.3-71.8V313.4c0-69,31.9-118.6,48.6-143.5c0-0.3-0.1-0.7-0.1-1c0-2.9,1.8-6.4,3.3-8.9c0.3-1,0.6-2.1,0.7-3.2
c0.2-2,0.7-3.9,1.6-5.6c2.1-3.3,5.8-5.3,9.7-5.3h0.9c3.7,0,10.7,2.9,10.7,13.7c0.2,2.5,0.4,5.1,0.8,7.6c24,31,52.2,81.4,52.2,146.3
v494.7l57.6,56.8l9.6,70.7l0.3,15.1l-79.1,39.7c-1.1,3.9-4,11.5-10.5,16.7c1.7,4.6,4.4,12.5,5.3,18.8c0.2,1.8,0.5,3.3,0.6,4.7
c0.2,1.9,0.5,3.8,0.9,5.7c-0.7-1.4-2.1-2.2-3.7-2.2v10L648.4,1044.1z M639.7,1044.1v-10V1044.1z"/>
<path class="st6" d="M644.5,150.9c0.3,0,5.7,0.1,5.7,8.7c0,1.4,0.8,9.4,1.4,10c17.8,23,51.7,74.4,51.7,143.9v21.1h-83.1v1.1h83.1
v474.5l57.9,57.1l9.3,68.8l0.2,11.7L692.3,987c0,0-2.1,12.7-12.3,18.1c0,0,5.2,12.7,6.5,21.4c1.2,8.7,1.3,12.5,2.8,12.5h-40.8
c1.3,0,3.2-7.5,3.8-12.6c0.8-6.4,6.3-21.6,6.3-21.6c-4.9-2.1-8.7-6.3-10.1-11.5h-8.6c-1.5,5.2-5.2,9.4-10.1,11.5
c0,0,5.5,15.2,6.3,21.6c0.6,5.1,2.5,12.6,3.8,12.6h-40.8c1.5,0,1.6-3.8,2.8-12.5s6.5-21.4,6.5-21.4c-10.2-5.4-12.3-18.1-12.3-18.1
l-15.1-26.8l-63.2-12.9l0.2-11.9l7.6-56.7l59.5-72.1V313.4c0-69.4,33.5-119.4,49.2-142.9c0,0-0.6-0.3-0.6-1.7s1.2-4,2.6-6.3
s1.3-7.2,2.3-8.8c1.2-1.8,3.3-2.9,5.4-2.9L644.5,150.9 M639.8,1039.1L639.8,1039.1 M644.5,140.9h-0.9c-5.7,0-11,2.9-14,7.7
c-1.3,2.3-2.1,4.8-2.3,7.5c-0.1,0.6-0.2,1.4-0.3,1.9c-2.3,4-3.6,7.5-3.7,10.5c-8.1,12.2-19.3,29.7-29,52.4
c-12.9,30.2-19.5,61.3-19.5,92.5V803l-57.2,69.4l-1.8,2.2l-0.4,2.8l-7.6,56.7l-0.1,0.6v0.6l-0.2,11.9l-0.1,8.3l8.1,1.7l58.8,12
l12.1,21.5c1.6,6.8,5,13,9.8,18c-2,5.4-3.4,10.9-4.4,16.6c-0.2,1.8-0.5,3.3-0.6,4.7c-0.3,2-0.5,4.2-0.7,4.9c0.6-2.3,3.7-5.8,8.5-5.8
v20h40.8l0,0v-20c0.6,0,1.2,0.1,1.8,0.2c-0.3,1.5-0.7,2.9-1.2,4.3c0.8-1.5,2.1-2.7,3.7-3.5c1.6,0.8,2.8,2,3.7,3.5
c-0.5-1.4-0.9-2.9-1.2-4.3c0.6-0.1,1.2-0.2,1.8-0.2v20v-20v20h40.8v-20c4.7,0,7.8,3.4,8.5,5.8c-0.2-0.7-0.5-2.9-0.7-4.9
c-0.2-1.4-0.4-3-0.6-4.7c-1-5.7-2.4-11.2-4.4-16.6c4-4.1,7.1-9.2,8.9-14.6l74.4-37.3l5.6-2.8l-0.1-6.3l-0.2-11.7v-0.6l-0.1-0.6
l-9.3-68.7l-0.5-3.4l-2.4-2.4L713.3,806V313.4c-0.1-32.2-6.9-64-20-93.4c-8.6-19.6-19.5-38-32.5-54.9c-0.3-1.8-0.5-4.6-0.6-5.6
C660.2,145.8,650.8,140.9,644.5,140.9L644.5,140.9z M641.6,1008.8c0.9-0.8,1.7-1.7,2.5-2.7c0.8,0.9,1.6,1.8,2.5,2.7
c-0.8,2.5-1.7,5.4-2.5,8.2C643.3,1014.2,642.4,1011.3,641.6,1008.8z"/>
<path class="st6" d="M644.5,150.9c0.3,0,5.7,0.1,5.7,8.7c0,1.4,0.8,9.4,1.4,10c17.8,23,51.7,74.4,51.7,143.9v21.1h-83.1v1.1h83.1
v474.5l57.9,57.1l9.3,68.8l0.2,11.7L692.3,987c0,0-2.1,12.7-12.3,18.1c0,0,5.2,12.7,6.5,21.4c1.2,8.7,1.3,12.5,2.8,12.5h-40.8
c1.3,0,3.2-7.5,3.8-12.6c0.8-6.4,6.3-21.6,6.3-21.6c-4.9-2.1-8.7-6.3-10.1-11.5h-8.6c-1.5,5.2-5.2,9.4-10.1,11.5
c0,0,5.5,15.2,6.3,21.6c0.6,5.1,2.5,12.6,3.8,12.6h-40.8c1.5,0,1.6-3.8,2.8-12.5s6.5-21.4,6.5-21.4c-10.2-5.4-12.3-18.1-12.3-18.1
l-15.1-26.8l-63.2-12.9l0.2-11.9l7.6-56.7l59.5-72.1V313.4c0-69.4,33.5-119.4,49.2-142.9c0,0-0.6-0.3-0.6-1.7s1.2-4,2.6-6.3
s1.3-7.2,2.3-8.8c1.2-1.8,3.3-2.9,5.4-2.9L644.5,150.9 M639.8,1039.1L639.8,1039.1 M644.5,140.9h-0.9c-5.7,0-11,2.9-14,7.7
c-1.3,2.3-2.1,4.8-2.3,7.5c-0.1,0.6-0.2,1.4-0.3,1.9c-2.3,4-3.6,7.5-3.7,10.5c-8.1,12.2-19.3,29.7-29,52.4
c-12.9,30.2-19.5,61.3-19.5,92.5V803l-57.2,69.4l-1.8,2.2l-0.4,2.8l-7.6,56.7l-0.1,0.6v0.6l-0.2,11.9l-0.1,8.3l8.1,1.7l58.8,12
l12.1,21.5c1.6,6.8,5,13,9.8,18c-2,5.4-3.4,10.9-4.4,16.6c-0.2,1.8-0.5,3.3-0.6,4.7c-0.3,2-0.5,4.2-0.7,4.9c0.6-2.3,3.7-5.8,8.5-5.8
v20h40.8l0,0v-20c0.6,0,1.2,0.1,1.8,0.2c-0.3,1.5-0.7,2.9-1.2,4.3c0.8-1.5,2.1-2.7,3.7-3.5c1.6,0.8,2.8,2,3.7,3.5
c-0.5-1.4-0.9-2.9-1.2-4.3c0.6-0.1,1.2-0.2,1.8-0.2v20v-20v20h40.8v-20c4.7,0,7.8,3.4,8.5,5.8c-0.2-0.7-0.5-2.9-0.7-4.9
c-0.2-1.4-0.4-3-0.6-4.7c-1-5.7-2.4-11.2-4.4-16.6c4-4.1,7.1-9.2,8.9-14.6l74.4-37.3l5.6-2.8l-0.1-6.3l-0.2-11.7v-0.6l-0.1-0.6
l-9.3-68.7l-0.5-3.4l-2.4-2.4L713.3,806V313.4c-0.1-32.2-6.9-64-20-93.4c-8.6-19.6-19.5-38-32.5-54.9c-0.3-1.8-0.5-4.6-0.6-5.6
C660.2,145.8,650.8,140.9,644.5,140.9L644.5,140.9z M641.6,1008.8c0.9-0.8,1.7-1.7,2.5-2.7c0.8,0.9,1.6,1.8,2.5,2.7
c-0.8,2.5-1.7,5.4-2.5,8.2C643.3,1014.2,642.4,1011.3,641.6,1008.8z"/>
<path class="st6" d="M816.4,866.8c-7-9.8-50.3-52.5-68.2-69.3s-25.5-27.5-29-37s-11.1-48.6-14-65.1s-9.2-45.3-10.5-49.2
s-5.4-26.4-7-35.9s-7.6-41.6-9.2-46.2s-5.9-21.1-10.2-33.5s-10.2-28.7-12-33.5s-6.7-8.7-12-8.7s-10.2,3.9-12,8.7s-7.8,21.1-12,33.5
s-8.5,28.8-10.2,33.5s-7.6,36.8-9.2,46.2s-5.7,32-7,35.9S586,679,583,695.4s-10.5,55.7-14,65.1s-11.1,20.2-29,37
s-61.3,59.5-68.3,69.3s-9.2,22-8.7,31.4s0.5,9.4,0.5,11.1v18.3c0,0,54.3,9.4,63.2,10.6s23.6,4.6,25.2,5.5s18.1,2.3,27.3,4.1
s20.2,3.7,22.9,4.6v34.8l5.3,0.9l0.9,1.8h71.5l0.9-1.8l5.3-0.9v-34.8c2.7-0.9,13.7-2.8,22.9-4.6s25.7-3.2,27.3-4.1
s16.3-4.3,25.2-5.5s63.2-10.6,63.2-10.6v-18.3c0-1.7,0-1.7,0.5-11.1S823.4,876.7,816.4,866.8z"/>
<path class="st0" d="M678.6,587c-6-28.4-18.5-67.8-18.5-67.8l-9-16.9H637l-9,16.9c0,0-12.5,39.4-18.4,67.8s-6.7,35.8-6.7,38.2v288.9
c0,10.8,9.7,42.5,9.7,42.5h26.3v-52.4c0-2.2,3.2-2.6,5.3-2.6s5.3,0.4,5.3,2.6v52.5h26.3c0,0,9.7-31.7,9.7-42.5V625.2
C685.3,622.8,684.5,615.5,678.6,587z M635.7,519.6c0.4-2.2,1.7-3.8,2.9-3.5s1.7,2.2,1.3,4.4s-1.7,3.8-2.9,3.6
S635.3,521.8,635.7,519.6L635.7,519.6z M640,537.7c-0.5,1-1.7,1.4-2.7,0.9c-1-0.5-1.4-1.7-0.9-2.7c0.4-0.9,1.4-1.3,2.4-1
C639.9,535.3,640.4,536.6,640,537.7z M644,539.5c-1.3,0.3-2.6-0.6-2.8-1.9c-0.3-1.3,0.6-2.6,1.9-2.8c1.3-0.3,2.6,0.6,2.8,1.9
c0,0.2,0,0.3,0,0.5C646,538.3,645.2,539.4,644,539.5L644,539.5z M644,524c-1.2,0-2.1-1.8-2.1-4s0.9-4,2.1-4s2.1,1.8,2.1,4
S645.2,524,644,524L644,524z M650.5,539.5c-1.2,0.6-2.6,0.1-3.2-1.1s-0.1-2.6,1.1-3.2s2.6-0.1,3.2,1.1c0.1,0.1,0.1,0.3,0.2,0.4
C652.2,537.8,651.7,539,650.5,539.5L650.5,539.5z M651.1,524c-1.1,0.2-2.4-1.3-2.9-3.5s0.1-4.1,1.3-4.4s2.4,1.3,2.9,3.5
S652.3,523.7,651.1,524L651.1,524z"/>
<polygon class="st6" points="623.1,597 625.4,590.2 632.6,582.9 640,580.5 641.6,570.2 629,575.9 618.1,584.7 615.7,597.9 "/>
<rect x="633.2" y="606.4" class="st6" width="9.8" height="8.8"/>
<path class="st0" d="M601.4,645.1v257.1h-65.2v8.2h-2v-8.1h-69.1v-2.6c0-2.1,3.2-7.8,4.7-11.7s3.7-8,4.4-10.8s7.6-9.2,11.3-12.7
s91.5-95.7,91.5-95.7S592.2,677.8,601.4,645.1z"/>
<path class="st0" d="M601.4,913.4v37.9c0,0-17.8-4-23.1-4.8s-23-2.9-25.4-3.7s-15.1-4.2-16.9-4.4v-28L601.4,913.4z"/>
<path class="st0" d="M534.2,910.4v27.8c0,0-24.9-3.4-37.5-5.8s-30.1-5.6-32.3-5.8v-20.3L534.2,910.4z"/>
<polygon class="st6" points="665,597 662.8,590.2 655.5,582.9 648.2,580.5 646.5,570.2 659.1,575.9 670,584.7 672.5,597.9 "/>
<rect x="645.1" y="606.4" class="st6" width="9.8" height="8.8"/>
<path class="st0" d="M686.7,645.1v257.1h65.2v8.2h2v-8.1H823v-2.6c0-2.1-3.2-7.8-4.7-11.7s-3.7-8-4.4-10.8s-7.6-9.2-11.3-12.7
s-91.5-95.7-91.5-95.7S695.9,677.8,686.7,645.1z"/>
<path class="st0" d="M686.7,913.4v37.9c0,0,17.8-4,23.1-4.8s23-2.9,25.4-3.7s15.1-4.2,16.9-4.4v-28L686.7,913.4z"/>
<path class="st0" d="M753.9,910.4v27.8c0,0,24.9-3.4,37.5-5.8s30.1-5.6,32.3-5.8v-20.3L753.9,910.4z"/>
<path class="st0" d="M612.2,958.3c-3.9-12.3-7-24.7-9.4-37.4v65.2h20.6V959L612.2,958.3z M607,958.5c0.9,0,1.7,0.8,1.7,1.7
s-0.8,1.7-1.7,1.7s-1.7-0.8-1.7-1.7v0C605.3,959.3,606,958.5,607,958.5C607,958.5,607,958.5,607,958.5L607,958.5z M607,965
c0.9,0,1.7,0.8,1.7,1.7s-0.8,1.7-1.7,1.7s-1.7-0.8-1.7-1.7v0C605.3,965.8,606,965,607,965C607,965,607,965,607,965L607,965z
M604.9,982.8c-0.6,0-1-0.4-1-1s0.4-1,1-1s1,0.4,1,1C605.9,982.3,605.5,982.8,604.9,982.8C604.9,982.8,604.9,982.8,604.9,982.8
L604.9,982.8z M605.3,973.2c0-0.9,0.8-1.7,1.8-1.7c0.9,0,1.7,0.8,1.7,1.8c0,0.9-0.8,1.6-1.7,1.7C606.1,975,605.3,974.3,605.3,973.2
C605.2,973.3,605.2,973.3,605.3,973.2L605.3,973.2z M609.1,982.3c-0.6,0-1-0.4-1-1s0.4-1,1-1s1,0.4,1,1
C610.1,981.9,609.7,982.3,609.1,982.3C609.1,982.3,609.1,982.3,609.1,982.3L609.1,982.3z"/>
<path class="st0" d="M676,958.3l-11.3,0.7v27.1h20.6v-65.2C683,933.6,679.8,946,676,958.3z M681.2,958.5c0.9,0,1.7,0.8,1.7,1.7
s-0.8,1.7-1.7,1.7s-1.7-0.8-1.7-1.7v0C679.4,959.3,680.2,958.5,681.2,958.5L681.2,958.5z M681.2,965c0.9,0,1.7,0.8,1.7,1.7
s-0.8,1.7-1.7,1.7s-1.7-0.8-1.7-1.7v0C679.4,965.8,680.2,965,681.2,965L681.2,965z M679,982.3c-0.6,0-1-0.4-1-1s0.4-1,1-1s1,0.4,1,1
S679.6,982.3,679,982.3z M679.4,973.2c0-0.9,0.8-1.7,1.7-1.7s1.7,0.8,1.7,1.7s-0.8,1.7-1.7,1.7h0
C680.2,974.9,679.4,974.2,679.4,973.2L679.4,973.2z M683.2,982.8c-0.6,0-1-0.4-1-1s0.4-1,1-1s1,0.4,1,1S683.8,982.8,683.2,982.8z"/>
<ellipse transform="matrix(0.9778 -0.2096 0.2096 0.9778 -192.2354 155.6226)" class="st0" cx="638" cy="984.7" rx="0.8" ry="1.2"/>
<polygon class="st0" points="624.7,986.1 635.1,986.1 635.1,983.5 624.7,977.7 "/>
<path class="st0" d="M640.2,905.5c0,0,0.7,1.3,1.6,1.3v83.1h-1.2L640.2,905.5z"/>
<ellipse transform="matrix(0.2096 -0.9778 0.9778 0.2096 -449.0005 1413.9041)" class="st0" cx="650.1" cy="984.7" rx="1.2" ry="0.8"/>
<polygon class="st0" points="663.4,986.1 653,986.1 653,983.5 663.4,977.7 "/>
<path class="st0" d="M648,905.5c0,0-0.7,1.3-1.6,1.3v83.1h1.2L648,905.5z"/>
<use xlink:href="#Новый_символ_2" width="62.9" height="62.9" x="-31.5" y="-31.5" transform="matrix(1.62 0 0 1.62 869.8933 593.9933)" style="overflow:visible;"/>
<use xlink:href="#Новый_символ_2" width="62.9" height="62.9" x="-31.5" y="-31.5" transform="matrix(1.62 0 0 1.62 318.0233 674.3633)" style="overflow:visible;"/>
<use xlink:href="#Новый_символ_2" width="62.9" height="62.9" x="-31.5" y="-31.5" transform="matrix(0.57 0 0 0.57 869.5251 694.095)" style="overflow:visible;"/>
<use xlink:href="#Новый_символ_2" width="62.9" height="62.9" x="-31.5" y="-31.5" transform="matrix(0.57 0 0 0.57 447.0251 641.7651)" style="overflow:visible;"/>
<use xlink:href="#Новый_символ_2" width="62.9" height="62.9" x="-31.5" y="-31.5" transform="matrix(0.46 0 0 0.46 273.0939 788.4239)" style="overflow:visible;"/>
<use xlink:href="#Новый_символ_2" width="62.9" height="62.9" x="-31.5" y="-31.5" transform="matrix(0.57 0 0 0.57 342.9951 547.545)" style="overflow:visible;"/>
<use xlink:href="#Новый_символ_2" width="62.9" height="62.9" x="-31.5" y="-31.5" transform="matrix(0.57 0 0 0.57 412.2851 436.9151)" style="overflow:visible;"/>
<use xlink:href="#Новый_символ_2" width="62.9" height="62.9" x="-31.5" y="-31.5" transform="matrix(0.57 0 0 0.57 995.9951 746.4551)" style="overflow:visible;"/>
<use xlink:href="#Новый_символ_2" width="62.9" height="62.9" x="-31.5" y="-31.5" transform="matrix(0.71 0 0 0.71 998.3502 658.5701)" style="overflow:visible;"/>
<use xlink:href="#Новый_символ_2" width="62.9" height="62.9" x="-31.5" y="-31.5" transform="matrix(0.71 0 0 0.71 922.8602 489.4901)" style="overflow:visible;"/>
<use xlink:href="#Новый_символ_2" width="62.9" height="62.9" x="-31.5" y="-31.5" transform="matrix(1.11 0 0 1.11 832.0261 422.8661)" style="overflow:visible;"/>
<use xlink:href="#Новый_символ_2" width="62.9" height="62.9" x="-31.5" y="-31.5" transform="matrix(1.11 0 0 1.11 448.2261 539.5862)" style="overflow:visible;"/>
</svg>

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -0,0 +1,48 @@
{
"name": "spaceship-prompt",
"version": "3.9.0",
"description": "A Zsh prompt for Astronauts.",
"files": [
"lib",
"scripts",
"sections",
"spaceship.zsh",
"spaceship.zsh-theme"
],
"scripts": {
"postinstall": "./scripts/install.sh",
"postuninstall": "./scripts/uninstall.sh",
"version": "./scripts/version.sh",
"postpublish": "git push --follow-tags",
"test": "./scripts/tests.sh",
"docs:prepare": "gitbook install",
"docs:icons": "cp logos/apple-touch-icon.png _book/gitbook/images/apple-touch-icon-precomposed-152.png && cp logos/favicon.ico _book/gitbook/images",
"docs:serve": "npm run docs:prepare && gitbook serve .",
"docs:build": "npm run docs:prepare && gitbook build && npm run docs:icons"
},
"repository": {
"type": "git",
"url": "git+https://github.com/denysdovhan/spaceship-prompt.git"
},
"keywords": [
"prompt",
"shell",
"zsh",
"zsh-theme",
"terminal"
],
"author": "Denys Dovhan <email@denysdovhan.com> (http://denysdovhan.com/)",
"license": "MIT",
"bugs": {
"url": "https://github.com/denysdovhan/spaceship-prompt/issues"
},
"homepage": "https://github.com/denysdovhan/spaceship-prompt#readme",
"devDependencies": {
"gitbook-cli": "^2.3.2",
"gitbook-plugin-anchorjs": "^1.1.1",
"gitbook-plugin-edit-link": "^2.0.2",
"gitbook-plugin-github": "^2.0.0",
"gitbook-plugin-github-buttons": "^3.0.0",
"gitbook-plugin-prism": "^2.3.0"
}
}

View File

@ -0,0 +1,127 @@
#!/usr/bin/env zsh
#
# Author: Denys Dovhan, denysdovhan.com
# https://github.com/denysdovhan/spaceship-prompt
# ------------------------------------------------------------------------------
# Colors
# Set color variables for colorful output
# ------------------------------------------------------------------------------
# If we have tput, let's set colors
if [[ ! -z $(which tput 2> /dev/null) ]]; then
reset=$(tput sgr0)
bold=$(tput bold)
red=$(tput setaf 1)
green=$(tput setaf 2)
yellow=$(tput setaf 3)
blue=$(tput setaf 4)
magenta=$(tput setaf 5)
cyan=$(tput setaf 6)
fi
# ------------------------------------------------------------------------------
# VARIABLES
# Paths to important resources
# ------------------------------------------------------------------------------
ZSHRC="$HOME/.zshrc"
REPO='https://github.com/denysdovhan/spaceship-prompt.git'
SOURCE="$PWD/spaceship.zsh"
USER_SOURCE="$HOME/.spaceship-prompt"
DEST='/usr/local/share/zsh/site-functions'
USER_DEST="$HOME/.zfunctions"
# ------------------------------------------------------------------------------
# HELPERS
# Useful functions for common tasks
# ------------------------------------------------------------------------------
# Paint text in specific color with reset
# USAGE:
# paint <color> [text...]
paint() {
local color=$1 rest=${@:2}
echo "$color$rest$reset"
}
# Aliases for common used colors
# Colon at the end is required: https://askubuntu.com/a/521942
# USAGE:
# info|warn|error|success|code [...text]
info() { paint "$cyan" "SPACESHIP: $@" ; }
warn() { paint "$yellow" "SPACESHIP: $@" ; }
error() { paint "$red" "SPACESHIP: $@" ; }
success() { paint "$green" "SPACESHIP: $@" ; }
code() { paint "$bold" "SPACESHIP: $@" ; }
# Append text in ~/.zshrc
# USAGE:
# append_zshrc [text...]
append_zshrc() {
info "These lines will be added to your ~/.zshrc file:"
code "$@"
echo "$@" >> "$HOME/.zshrc"
}
# ------------------------------------------------------------------------------
# MAIN
# Checkings and installing process
# ------------------------------------------------------------------------------
main() {
# How we install Spaceship:
# 1. Install via NPM
# 2. Install via curl or wget
if [[ ! -f "$SOURCE" ]]; then
warn "Spaceship is not present in current directory"
# Clone repo into the ~/..spaceship-prompt and change SOURCE
git clone "$REPO" "$USER_SOURCE"
SOURCE="$USER_SOURCE/spaceship.zsh"
else
info "Spaceship is present in current directory"
fi
# If we can't symlink to the site-functions, then try to use .zfunctions instead
if [[ ! -w "$DEST" ]]; then
error "Failed to symlink $SOURCE to $DEST."
# Use $USER_DEST instead
DEST="$USER_DEST"
info "Adding $DEST to fpath..."
echo 'fpath=($fpath "'"$DEST"'")' >> "$ZSHRC"
info "Trying to symlink $SOURCE to $DEST"
fi
# Link prompt entry point to fpath
info "Linking $SOURCE to $DEST/prompt_spaceship_setup..."
mkdir -p "$DEST"
ln -sf "$SOURCE" "$DEST/prompt_spaceship_setup"
# If 'prompt spaceship' is already present in .zshrc, then skip
if sed 's/#.*//' "$ZSHRC" | grep -q "prompt spaceship"; then
warn "Spaceship is already present in .zshrc!"
exit
fi
# Enabling statements for ~/.zshrc
msg="
# Set Spaceship ZSH as a prompt
autoload -U promptinit; promptinit
prompt spaceship"
# Check if appending was successful and perform corresponding actions
if append_zshrc "$msg"; then
success "Done! Please, reload your terminal."
echo
else
error "Cannot automatically insert prompt init commands."
error "Please insert these line into your ~/.zshrc:"
code "$msg"
exit 1
fi
}
main "$@"

View File

@ -0,0 +1,70 @@
#!/usr/bin/env zsh
# Required for shunit2 to run correctly
setopt shwordsplit
# ------------------------------------------------------------------------------
# Colors
# Set color variables for colorful output
# ------------------------------------------------------------------------------
# If we have tput, let's set colors
if [[ ! -z $(which tput 2> /dev/null) ]]; then
reset=$(tput sgr0)
bold=$(tput bold)
red=$(tput setaf 1)
green=$(tput setaf 2)
yellow=$(tput setaf 3)
blue=$(tput setaf 4)
magenta=$(tput setaf 5)
cyan=$(tput setaf 6)
fi
# ------------------------------------------------------------------------------
# VARIABLES
# Paths to important resources
# ------------------------------------------------------------------------------
TESTS="$(find . -type f -name "*.test.zsh")"
EXIT_CODE=0
# ------------------------------------------------------------------------------
# HELPERS
# Useful functions for common tasks
# ------------------------------------------------------------------------------
header() {
[[ -n $2 ]] && color=$1 || color=$cyan
[[ -n $2 ]] && content=${@:2} || content=$@
echo $color$bold
echo '--------------------------------------------------------------------------------'
echo "$content"
echo '--------------------------------------------------------------------------------'
echo $reset
}
# ------------------------------------------------------------------------------
# MAIN
# Checkings and installing process
# ------------------------------------------------------------------------------
main() {
for test in $TESTS; do
header "Run $test..."
( eval zsh $test 2>&1 )
local exitcode="$?"
[ "$exitcode" != "0" ] && EXIT_CODE=$exitcode
done
if [ "$EXIT_CODE" != "0" ]; then
header $red "Tests are failing!"
exit $EXIT_CODE
else
header $green "Tests are passing!"
exit 0
fi
}
main "$@"

View File

@ -0,0 +1,98 @@
#!/usr/bin/env zsh
#
# Author: Denys Dovhan, denysdovhan.com
# https://github.com/denysdovhan/spaceship-prompt
# ------------------------------------------------------------------------------
# Colors
# Set color variables for colorful output
# ------------------------------------------------------------------------------
# If we have tput, let's set colors
if [[ ! -z $(which tput 2> /dev/null) ]]; then
reset=$(tput sgr0)
bold=$(tput bold)
red=$(tput setaf 1)
green=$(tput setaf 2)
yellow=$(tput setaf 3)
blue=$(tput setaf 4)
magenta=$(tput setaf 5)
cyan=$(tput setaf 6)
fi
# ------------------------------------------------------------------------------
# VARIABLES
# Paths to important resources
# ------------------------------------------------------------------------------
ZSHRC="$HOME/.zshrc"
USER_SOURCE="$HOME/.spaceship-prompt"
GLOBAL_DEST="/usr/local/share/zsh/site-functions/prompt_spaceship_setup"
USER_DEST="$HOME/.zfunctions/prompt_spaceship_setup"
# ------------------------------------------------------------------------------
# HELPERS
# Useful functions for common tasks
# ------------------------------------------------------------------------------
# Paint text in specific color with reset
# USAGE:
# paint <color> [text...]
paint() {
local color=$1 rest=${@:2}
echo "$color$rest$reset"
}
# Aliases for common used colors
# Colon at the end is required: https://askubuntu.com/a/521942
# USAGE:
# info|warn|error|success|code [...text]
info() { paint "$cyan" "SPACESHIP: $@" ; }
warn() { paint "$yellow" "SPACESHIP: $@" ; }
error() { paint "$red" "SPACESHIP: $@" ; }
success() { paint "$green" "SPACESHIP: $@" ; }
code() { paint "$bold" "SPACESHIP: $@" ; }
# Check if symlink is exists and remove it
# USAGE:
# rmln <target>
rmln() {
local target=$1
if [[ -L "$target" ]]; then
info "Removing $target..."
rm -f "$target"
fi
}
# ------------------------------------------------------------------------------
# MAIN
# Checkings and uninstalling process
# ------------------------------------------------------------------------------
main() {
# Remove $GLOBAL_DEST symlink
if [[ -L "$GLOBAL_DEST" || -L "$USER_DEST" ]]; then
rmln "$GLOBAL_DEST"
rmln "$USER_DEST"
else
warn "Symlinks to Spaceship are not found."
fi
# Remove Spaceship from .zshrc
if grep -q "spaceship" "$ZSHRC"; then
info "Removing Spaceship from ~/.zshrc"
# Remove enabling statements from ~/.zshrc
sed -i '' '/^# Set Spaceship ZSH as a prompt$/d' $ZSHRC
sed -i '' '/^autoload -U promptinit; promptinit$/d' $ZSHRC
sed -i '' '/^prompt spaceship$/d' $ZSHRC
# Remove Spaceship configuration
sed -i '' '/^SPACESHIP_.*$/d' $ZSHRC
else
warn "Spaceship configuration not found in ~/.zshrc!"
fi
success "Done! Spaceship installation have to be removed!"
success "Please, reload your terminal."
}
main "$@"

View File

@ -0,0 +1,13 @@
#!/usr/bin/env zsh
main() {
new_version=$(grep -E '"version": "v?([0-9]+\.){1,}' package.json | cut -d\" -f4 2> /dev/null)
filename="$PWD/spaceship.zsh"
sed -e "s/SPACESHIP_VERSION='.*'/SPACESHIP_VERSION='$new_version'/g" "$filename" >"$filename.bak"
mv -- "$filename.bak" "$filename"
git add spaceship.zsh
}
main "$@"

View File

@ -0,0 +1,37 @@
#
# Amazon Web Services (AWS)
#
# The AWS Command Line Interface (CLI) is a unified tool to manage AWS services.
# Link: https://aws.amazon.com/cli/
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_AWS_SHOW="${SPACESHIP_AWS_SHOW=true}"
SPACESHIP_AWS_PREFIX="${SPACESHIP_AWS_PREFIX="using "}"
SPACESHIP_AWS_SUFFIX="${SPACESHIP_AWS_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_AWS_SYMBOL="${SPACESHIP_AWS_SYMBOL="☁️ "}"
SPACESHIP_AWS_COLOR="${SPACESHIP_AWS_COLOR="208"}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Shows selected AWS-cli profile.
spaceship_aws() {
[[ $SPACESHIP_AWS_SHOW == false ]] && return
# Check if the AWS-cli is installed
spaceship::exists aws || return
# Is the current profile not the default profile
[[ -z $AWS_PROFILE ]] || [[ "$AWS_PROFILE" == "default" ]] && return
# Show prompt section
spaceship::section \
"$SPACESHIP_AWS_COLOR" \
"$SPACESHIP_AWS_PREFIX" \
"${SPACESHIP_AWS_SYMBOL}$AWS_PROFILE" \
"$SPACESHIP_AWS_SUFFIX"
}

View File

@ -0,0 +1,104 @@
#
# Battery
#
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# | SPACESHIP_BATTERY_SHOW | below threshold | above threshold | fully charged |
# |------------------------+-----------------+-----------------+---------------|
# | false | hidden | hidden | hidden |
# | always | shown | shown | shown |
# | true | shown | hidden | hidden |
# | charged | shown | hidden | shown |
# ------------------------------------------------------------------------------
SPACESHIP_BATTERY_SHOW="${SPACESHIP_BATTERY_SHOW=true}"
SPACESHIP_BATTERY_PREFIX="${SPACESHIP_BATTERY_PREFIX=""}"
SPACESHIP_BATTERY_SUFFIX="${SPACESHIP_BATTERY_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_BATTERY_SYMBOL_CHARGING="${SPACESHIP_BATTERY_SYMBOL_CHARGING="⇡"}"
SPACESHIP_BATTERY_SYMBOL_DISCHARGING="${SPACESHIP_BATTERY_SYMBOL_DISCHARGING="⇣"}"
SPACESHIP_BATTERY_SYMBOL_FULL="${SPACESHIP_BATTERY_SYMBOL_FULL="•"}"
SPACESHIP_BATTERY_THRESHOLD="${SPACESHIP_BATTERY_THRESHOLD=10}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show section only if either of follow is true
# - Always show is true
# - battery percentage is below the given limit (default: 10%)
# - Battery is fully charged
# Escape % for display since it's a special character in zsh prompt expansion
spaceship_battery() {
[[ $SPACESHIP_BATTERY_SHOW == false ]] && return
local battery_data battery_percent battery_status battery_color
if spaceship::exists pmset; then
battery_data=$(pmset -g batt | grep "InternalBattery")
# Return if no internal battery
[[ -z "$battery_data" ]] && return
battery_percent="$( echo $battery_data | grep -oE '[0-9]{1,3}%' )"
battery_status="$( echo $battery_data | awk -F '; *' 'NR==2 { print $2 }' )"
elif spaceship::exists acpi; then
battery_data=$(acpi -b 2>/dev/null | head -1)
# Return if no battery
[[ -z $battery_data ]] && return
battery_percent="$( echo $battery_data | awk '{print $4}' )"
# If battery is 0% charge, battery likely doesn't exist.
[[ $battery_percent == "0%," ]] && return
battery_status="$( echo $battery_data | awk '{print tolower($3)}' )"
elif spaceship::exists upower; then
local battery=$(command upower -e | grep battery | head -1)
# Return if no battery
[[ -z $battery ]] && return
battery_data=$(upower -i $battery)
battery_percent="$( echo "$battery_data" | grep percentage | awk '{print $2}' )"
battery_status="$( echo "$battery_data" | grep state | awk '{print $2}' )"
else
return
fi
# Remove trailing % and symbols for comparison
battery_percent="$(echo $battery_percent | tr -d '%[,;]')"
# Change color based on battery percentage
if [[ $battery_percent == 100 || $battery_status =~ "(charged|full)" ]]; then
battery_color="green"
elif [[ $battery_percent -lt $SPACESHIP_BATTERY_THRESHOLD ]]; then
battery_color="red"
else
battery_color="yellow"
fi
# Battery indicator based on current status of battery
if [[ $battery_status == "charging" ]];then
battery_symbol="${SPACESHIP_BATTERY_SYMBOL_CHARGING}"
elif [[ $battery_status =~ "^[dD]ischarg.*" ]]; then
battery_symbol="${SPACESHIP_BATTERY_SYMBOL_DISCHARGING}"
else
battery_symbol="${SPACESHIP_BATTERY_SYMBOL_FULL}"
fi
# Escape % for display since it's a special character in Zsh prompt expansion
if [[ $SPACESHIP_BATTERY_SHOW == 'always' ||
$battery_percent -lt $SPACESHIP_BATTERY_THRESHOLD ||
$SPACESHIP_BATTERY_SHOW == 'charged' && $battery_status =~ "(charged|full)" ]]; then
spaceship::section \
"$battery_color" \
"$SPACESHIP_BATTERY_PREFIX" \
"$battery_symbol$battery_percent%%" \
"$SPACESHIP_BATTERY_SUFFIX"
fi
}

View File

@ -0,0 +1,44 @@
#
# Prompt character
#
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_CHAR_PREFIX="${SPACESHIP_CHAR_PREFIX=""}"
SPACESHIP_CHAR_SUFFIX="${SPACESHIP_CHAR_SUFFIX=""}"
SPACESHIP_CHAR_SYMBOL="${SPACESHIP_CHAR_SYMBOL="➜ "}"
SPACESHIP_CHAR_SYMBOL_ROOT="${SPACESHIP_CHAR_SYMBOL_ROOT="$SPACESHIP_CHAR_SYMBOL"}"
SPACESHIP_CHAR_SYMBOL_SECONDARY="${SPACESHIP_CHAR_SYMBOL_SECONDARY="$SPACESHIP_CHAR_SYMBOL"}"
SPACESHIP_CHAR_COLOR_SUCCESS="${SPACESHIP_CHAR_COLOR_SUCCESS="green"}"
SPACESHIP_CHAR_COLOR_FAILURE="${SPACESHIP_CHAR_COLOR_FAILURE="red"}"
SPACESHIP_CHAR_COLOR_SECONDARY="${SPACESHIP_CHAR_COLOR_SECONDARY="yellow"}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Paint $PROMPT_SYMBOL in red if previous command was fail and
# paint in green if everything was OK.
spaceship_char() {
local 'color' 'char'
if [[ $RETVAL -eq 0 ]]; then
color="$SPACESHIP_CHAR_COLOR_SUCCESS"
else
color="$SPACESHIP_CHAR_COLOR_FAILURE"
fi
if [[ $UID -eq 0 ]]; then
char="$SPACESHIP_CHAR_SYMBOL_ROOT"
else
char="$SPACESHIP_CHAR_SYMBOL"
fi
spaceship::section \
"$color" \
"$SPACESHIP_CHAR_PREFIX" \
"$char" \
"$SPACESHIP_CHAR_SUFFIX"
}

View File

@ -0,0 +1,33 @@
#
# Conda
#
# Package, dependency and environment management for any language
# Link: https://conda.io/
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_CONDA_SHOW="${SPACESHIP_CONDA_SHOW=true}"
SPACESHIP_CONDA_PREFIX="${SPACESHIP_CONDA_PREFIX="$SPACESHIP_PROMPT_DEFAULT_PREFIX"}"
SPACESHIP_CONDA_SUFFIX="${SPACESHIP_CONDA_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_CONDA_SYMBOL="${SPACESHIP_CONDA_SYMBOL="🅒 "}"
SPACESHIP_CONDA_COLOR="${SPACESHIP_CONDA_COLOR="blue"}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show current conda virtual environment
spaceship_conda() {
[[ $SPACESHIP_CONDA_SHOW == false ]] && return
# Check if running via conda virtualenv
spaceship::exists conda && [ -n "$CONDA_DEFAULT_ENV" ] || return
spaceship::section \
"$SPACESHIP_CONDA_COLOR" \
"$SPACESHIP_CONDA_PREFIX" \
"${SPACESHIP_CONDA_SYMBOL}${CONDA_DEFAULT_ENV}" \
"$SPACESHIP_CONDA_SUFFIX"
}

View File

@ -0,0 +1,68 @@
#
# Working directory
#
# Current directory. Return only three last items of path
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_DIR_SHOW="${SPACESHIP_DIR_SHOW=true}"
SPACESHIP_DIR_PREFIX="${SPACESHIP_DIR_PREFIX="in "}"
SPACESHIP_DIR_SUFFIX="${SPACESHIP_DIR_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_DIR_TRUNC="${SPACESHIP_DIR_TRUNC=3}"
SPACESHIP_DIR_TRUNC_PREFIX="${SPACESHIP_DIR_TRUNC_PREFIX=}"
SPACESHIP_DIR_TRUNC_REPO="${SPACESHIP_DIR_TRUNC_REPO=true}"
SPACESHIP_DIR_COLOR="${SPACESHIP_DIR_COLOR="cyan"}"
SPACESHIP_DIR_LOCK_SYMBOL="${SPACESHIP_DIR_LOCK_SYMBOL=" "}"
SPACESHIP_DIR_LOCK_COLOR="${SPACESHIP_DIR_LOCK_COLOR="red"}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
spaceship_dir() {
[[ $SPACESHIP_DIR_SHOW == false ]] && return
local 'dir' 'trunc_prefix'
# Threat repo root as a top-level directory or not
if [[ $SPACESHIP_DIR_TRUNC_REPO == true ]] && spaceship::is_git; then
local git_root=$(git rev-parse --show-toplevel)
# Check if the parent of the $git_root is "/"
if [[ $git_root:h == / ]]; then
trunc_prefix=/
else
trunc_prefix=$SPACESHIP_DIR_TRUNC_PREFIX
fi
# `${NAME#PATTERN}` removes a leading prefix PATTERN from NAME.
# `$~~` avoids `GLOB_SUBST` so that `$git_root` won't actually be
# considered a pattern and matched literally, even if someone turns that on.
# `$git_root` has symlinks resolved, so we use `${PWD:A}` which resolves
# symlinks in the working directory.
# See "Parameter Expansion" under the Zsh manual.
dir="$trunc_prefix$git_root:t${${PWD:A}#$~~git_root}"
else
if [[ SPACESHIP_DIR_TRUNC -gt 0 ]]; then
# `%(N~|TRUE-TEXT|FALSE-TEXT)` replaces `TRUE-TEXT` if the current path,
# with prefix replacement, has at least N elements relative to the root
# directory else `FALSE-TEXT`.
# See "Prompt Expansion" under the Zsh manual.
trunc_prefix="%($((SPACESHIP_DIR_TRUNC + 1))~|$SPACESHIP_DIR_TRUNC_PREFIX|)"
fi
dir="$trunc_prefix%${SPACESHIP_DIR_TRUNC}~"
fi
if [[ ! -w . ]]; then
SPACESHIP_DIR_SUFFIX="%F{$SPACESHIP_DIR_LOCK_COLOR}${SPACESHIP_DIR_LOCK_SYMBOL}%f${SPACESHIP_DIR_SUFFIX}"
fi
spaceship::section \
"$SPACESHIP_DIR_COLOR" \
"$SPACESHIP_DIR_PREFIX" \
"$dir" \
"$SPACESHIP_DIR_SUFFIX"
}

View File

@ -0,0 +1,67 @@
#
# Docker
#
# Docker automates the repetitive tasks of setting up development environments
# Link: https://www.docker.com
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_DOCKER_SHOW="${SPACESHIP_DOCKER_SHOW=true}"
SPACESHIP_DOCKER_PREFIX="${SPACESHIP_DOCKER_PREFIX="on "}"
SPACESHIP_DOCKER_SUFFIX="${SPACESHIP_DOCKER_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_DOCKER_SYMBOL="${SPACESHIP_DOCKER_SYMBOL="🐳 "}"
SPACESHIP_DOCKER_COLOR="${SPACESHIP_DOCKER_COLOR="cyan"}"
SPACESHIP_DOCKER_VERBOSE="${SPACESHIP_DOCKER_VERBOSE=false}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show current Docker version and connected machine
spaceship_docker() {
[[ $SPACESHIP_DOCKER_SHOW == false ]] && return
spaceship::exists docker || return
# Better support for docker environment vars: https://docs.docker.com/compose/reference/envvars/
local compose_exists=false
if [[ -n "$COMPOSE_FILE" ]]; then
# Use COMPOSE_PATH_SEPARATOR or colon as default
local separator=${COMPOSE_PATH_SEPARATOR:-":"}
# COMPOSE_FILE may have several filenames separated by colon, test all of them
local filenames=("${(@ps/$separator/)COMPOSE_FILE}")
for filename in $filenames; do
if [[ ! -f $filename ]]; then
compose_exists=false
break
fi
compose_exists=true
done
# Must return if COMPOSE_FILE is present but invalid
[[ "$compose_exists" == false ]] && return
fi
# Show Docker status only for Docker-specific folders
[[ "$compose_exists" == true || -f Dockerfile || -f docker-compose.yml ]] || return
# if docker daemon isn't running you'll get an error saying it can't connect
local docker_version=$(docker version -f "{{.Server.Version}}" 2>/dev/null)
[[ -z $docker_version ]] && return
[[ $SPACESHIP_DOCKER_VERBOSE == false ]] && docker_version=${docker_version%-*}
if [[ -n $DOCKER_MACHINE_NAME ]]; then
docker_version+=" via ($DOCKER_MACHINE_NAME)"
fi
spaceship::section \
"$SPACESHIP_DOCKER_COLOR" \
"$SPACESHIP_DOCKER_PREFIX" \
"${SPACESHIP_DOCKER_SYMBOL}v${docker_version}" \
"$SPACESHIP_DOCKER_SUFFIX"
}

View File

@ -0,0 +1,41 @@
#
# .NET
#
# .NET Framework is a software framework developed by Microsoft.
# It includes a large class library and provides language interoperability
# across several programming languages.
# Link: https://www.microsoft.com/net
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_DOTNET_SHOW="${SPACESHIP_DOTNET_SHOW=true}"
SPACESHIP_DOTNET_PREFIX="${SPACESHIP_DOTNET_PREFIX="$SPACESHIP_PROMPT_DEFAULT_PREFIX"}"
SPACESHIP_DOTNET_SUFFIX="${SPACESHIP_DOTNET_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_DOTNET_SYMBOL="${SPACESHIP_DOTNET_SYMBOL=".NET "}"
SPACESHIP_DOTNET_COLOR="${SPACESHIP_DOTNET_COLOR="128"}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show current version of .NET SDK
spaceship_dotnet() {
[[ $SPACESHIP_DOTNET_SHOW == false ]] && return
# Show DOTNET status only for folders containing project.json, global.json, .csproj, .xproj or .sln files
[[ -f project.json || -f global.json || -n *.csproj(#qN^/) || -n *.xproj(#qN^/) || -n *.sln(#qN^/) ]] || return
spaceship::exists dotnet || return
# dotnet-cli automatically handles SDK pinning (specified in a global.json file)
# therefore, this already returns the expected version for the current directory
local dotnet_version=$(dotnet --version 2>/dev/null)
spaceship::section \
"$SPACESHIP_DOTNET_COLOR" \
"$SPACESHIP_DOTNET_PREFIX" \
"${SPACESHIP_DOTNET_SYMBOL}${dotnet_version}" \
"$SPACESHIP_DOTNET_SUFFIX"
}

View File

@ -0,0 +1,53 @@
#
# Elixir
#
# Elixir is a dynamic, functional language designed for building scalable applications.
# Link: https://elixir-lang.org/
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_ELIXIR_SHOW="${SPACESHIP_ELIXIR_SHOW=true}"
SPACESHIP_ELIXIR_PREFIX="${SPACESHIP_ELIXIR_PREFIX="$SPACESHIP_PROMPT_DEFAULT_PREFIX"}"
SPACESHIP_ELIXIR_SUFFIX="${SPACESHIP_ELIXIR_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_ELIXIR_SYMBOL="${SPACESHIP_ELIXIR_SYMBOL="💧 "}"
SPACESHIP_ELIXIR_DEFAULT_VERSION="${SPACESHIP_ELIXIR_DEFAULT_VERSION=""}"
SPACESHIP_ELIXIR_COLOR="${SPACESHIP_ELIXIR_COLOR="magenta"}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show current version of Elixir
spaceship_elixir() {
[[ $SPACESHIP_ELIXIR_SHOW == false ]] && return
# Show versions only for Elixir-specific folders
[[ -f mix.exs || -n *.ex(#qN^/) || -n *.exs(#qN^/) ]] || return
local 'elixir_version'
if spaceship::exists kiex; then
elixir_version="${ELIXIR_VERSION}"
elif spaceship::exists exenv; then
elixir_version=$(exenv version-name)
fi
if [[ $elixir_version == "" ]]; then
spaceship::exists elixir || return
elixir_version=$(elixir -v 2>/dev/null | grep "Elixir" --color=never | cut -d ' ' -f 2)
fi
[[ $elixir_version == "system" ]] && return
[[ $elixir_version == $SPACESHIP_ELIXIR_DEFAULT_VERSION ]] && return
# Add 'v' before elixir version that starts with a number
[[ "${elixir_version}" =~ ^[0-9].+$ ]] && elixir_version="v${elixir_version}"
spaceship::section \
"$SPACESHIP_ELIXIR_COLOR" \
"$SPACESHIP_ELIXIR_PREFIX" \
"${SPACESHIP_ELIXIR_SYMBOL}${elixir_version}" \
"$SPACESHIP_ELIXIR_SUFFIX"
}

View File

@ -0,0 +1,36 @@
#
# Elm
#
# A delightful language for reliable webapps.
# Link: https://elm-lang.org/
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_ELM_SHOW="${SPACESHIP_ELM_SHOW=true}"
SPACESHIP_ELM_PREFIX="${SPACESHIP_ELM_PREFIX="$SPACESHIP_PROMPT_DEFAULT_PREFIX"}"
SPACESHIP_ELM_SUFFIX="${SPACESHIP_ELM_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_ELM_SYMBOL="${SPACESHIP_ELM_SYMBOL="🌳 "}"
SPACESHIP_ELM_COLOR="${SPACESHIP_ELM_COLOR="cyan"}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show current version of Elm.
spaceship_elm() {
[[ $SPACESHIP_ELM_SHOW == false ]] && return
[[ -f elm.json || -f elm-package.json || -d elm-stuff || -n *.elm(#qN^/) ]] || return
spaceship::exists elm || return
local elm_version=$(elm --version 2> /dev/null)
spaceship::section \
"$SPACESHIP_ELM_COLOR" \
"$SPACESHIP_ELM_PREFIX" \
"${SPACESHIP_ELM_SYMBOL}v${elm_version}" \
"$SPACESHIP_ELM_SUFFIX"
}

View File

@ -0,0 +1,36 @@
#
# Ember.js
#
# An open-source JavaScript web framework, based on the MVVM pattern.
# Link: https://www.emberjs.com/
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_EMBER_SHOW="${SPACESHIP_EMBER_SHOW=true}"
SPACESHIP_EMBER_PREFIX="${SPACESHIP_EMBER_PREFIX="$SPACESHIP_PROMPT_DEFAULT_PREFIX"}"
SPACESHIP_EMBER_SUFFIX="${SPACESHIP_EMBER_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_EMBER_SYMBOL="${SPACESHIP_EMBER_SYMBOL="🐹 "}"
SPACESHIP_EMBER_COLOR="${SPACESHIP_EMBER_COLOR="210"}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show current version of Ember, exception system.
spaceship_ember() {
[[ $SPACESHIP_EMBER_SHOW == false ]] && return
# Show EMBER status only for folders w/ ember-cli-build.js files
[[ -f ember-cli-build.js && -f node_modules/ember-cli/package.json ]] || return
local ember_version=$(grep '"version":' ./node_modules/ember-cli/package.json | cut -d\" -f4)
[[ $ember_version == "system" || $ember_version == "ember" ]] && return
spaceship::section \
"$SPACESHIP_EMBER_COLOR" \
"$SPACESHIP_EMBER_PREFIX" \
"${SPACESHIP_EMBER_SYMBOL}${ember_version}" \
"$SPACESHIP_EMBER_SUFFIX"
}

View File

@ -0,0 +1,30 @@
#
# Execution time
#
# Execution time of the last command.
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_EXEC_TIME_SHOW="${SPACESHIP_EXEC_TIME_SHOW=true}"
SPACESHIP_EXEC_TIME_PREFIX="${SPACESHIP_EXEC_TIME_PREFIX="took "}"
SPACESHIP_EXEC_TIME_SUFFIX="${SPACESHIP_EXEC_TIME_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_EXEC_TIME_COLOR="${SPACESHIP_EXEC_TIME_COLOR="yellow"}"
SPACESHIP_EXEC_TIME_ELAPSED="${SPACESHIP_EXEC_TIME_ELAPSED=2}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
spaceship_exec_time() {
[[ $SPACESHIP_EXEC_TIME_SHOW == false ]] && return
if [[ $SPACESHIP_EXEC_TIME_duration -ge $SPACESHIP_EXEC_TIME_ELAPSED ]]; then
spaceship::section \
"$SPACESHIP_EXEC_TIME_COLOR" \
"$SPACESHIP_EXEC_TIME_PREFIX" \
"$(spaceship::displaytime $SPACESHIP_EXEC_TIME_duration)" \
"$SPACESHIP_EXEC_TIME_SUFFIX"
fi
}

View File

@ -0,0 +1,28 @@
#
# Exit code
#
# Show exit code of last executed command
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_EXIT_CODE_SHOW="${SPACESHIP_EXIT_CODE_SHOW=false}"
SPACESHIP_EXIT_CODE_PREFIX="${SPACESHIP_EXIT_CODE_PREFIX=""}"
SPACESHIP_EXIT_CODE_SUFFIX="${SPACESHIP_EXIT_CODE_SUFFIX=" "}"
SPACESHIP_EXIT_CODE_SYMBOL="${SPACESHIP_EXIT_CODE_SYMBOL="✘"}"
SPACESHIP_EXIT_CODE_COLOR="${SPACESHIP_EXIT_CODE_COLOR="red"}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
spaceship_exit_code() {
[[ $SPACESHIP_EXIT_CODE_SHOW == false || $RETVAL == 0 ]] && return
spaceship::section \
"$SPACESHIP_EXIT_CODE_COLOR" \
"$SPACESHIP_EXIT_CODE_PREFIX" \
"${SPACESHIP_EXIT_CODE_SYMBOL}$RETVAL" \
"$SPACESHIP_EXIT_CODE_SUFFIX"
}

View File

@ -0,0 +1,40 @@
#
# Git
#
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_GIT_SHOW="${SPACESHIP_GIT_SHOW=true}"
SPACESHIP_GIT_PREFIX="${SPACESHIP_GIT_PREFIX="on "}"
SPACESHIP_GIT_SUFFIX="${SPACESHIP_GIT_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_GIT_SYMBOL="${SPACESHIP_GIT_SYMBOL=" "}"
# ------------------------------------------------------------------------------
# Dependencies
# ------------------------------------------------------------------------------
source "$SPACESHIP_ROOT/sections/git_branch.zsh"
source "$SPACESHIP_ROOT/sections/git_status.zsh"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show both git branch and git status:
# spaceship_git_branch
# spaceship_git_status
spaceship_git() {
[[ $SPACESHIP_GIT_SHOW == false ]] && return
local git_branch="$(spaceship_git_branch)" git_status="$(spaceship_git_status)"
[[ -z $git_branch ]] && return
spaceship::section \
'white' \
"$SPACESHIP_GIT_PREFIX" \
"${git_branch}${git_status}" \
"$SPACESHIP_GIT_SUFFIX"
}

View File

@ -0,0 +1,31 @@
#
# Git branch
#
# Show current git branch
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_GIT_BRANCH_SHOW="${SPACESHIP_GIT_BRANCH_SHOW=true}"
SPACESHIP_GIT_BRANCH_PREFIX="${SPACESHIP_GIT_BRANCH_PREFIX="$SPACESHIP_GIT_SYMBOL"}"
SPACESHIP_GIT_BRANCH_SUFFIX="${SPACESHIP_GIT_BRANCH_SUFFIX=""}"
SPACESHIP_GIT_BRANCH_COLOR="${SPACESHIP_GIT_BRANCH_COLOR="magenta"}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
spaceship_git_branch() {
[[ $SPACESHIP_GIT_BRANCH_SHOW == false ]] && return
local git_current_branch="$vcs_info_msg_0_"
[[ -z "$git_current_branch" ]] && return
git_current_branch="${git_current_branch#heads/}"
git_current_branch="${git_current_branch/.../}"
spaceship::section \
"$SPACESHIP_GIT_BRANCH_COLOR" \
"$SPACESHIP_GIT_BRANCH_PREFIX${git_current_branch}$SPACESHIP_GIT_BRANCH_SUFFIX"
}

View File

@ -0,0 +1,115 @@
#
# Git status
#
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_GIT_STATUS_SHOW="${SPACESHIP_GIT_STATUS_SHOW=true}"
SPACESHIP_GIT_STATUS_PREFIX="${SPACESHIP_GIT_STATUS_PREFIX=" ["}"
SPACESHIP_GIT_STATUS_SUFFIX="${SPACESHIP_GIT_STATUS_SUFFIX="]"}"
SPACESHIP_GIT_STATUS_COLOR="${SPACESHIP_GIT_STATUS_COLOR="red"}"
SPACESHIP_GIT_STATUS_UNTRACKED="${SPACESHIP_GIT_STATUS_UNTRACKED="?"}"
SPACESHIP_GIT_STATUS_ADDED="${SPACESHIP_GIT_STATUS_ADDED="+"}"
SPACESHIP_GIT_STATUS_MODIFIED="${SPACESHIP_GIT_STATUS_MODIFIED="!"}"
SPACESHIP_GIT_STATUS_RENAMED="${SPACESHIP_GIT_STATUS_RENAMED="»"}"
SPACESHIP_GIT_STATUS_DELETED="${SPACESHIP_GIT_STATUS_DELETED="✘"}"
SPACESHIP_GIT_STATUS_STASHED="${SPACESHIP_GIT_STATUS_STASHED="$"}"
SPACESHIP_GIT_STATUS_UNMERGED="${SPACESHIP_GIT_STATUS_UNMERGED="="}"
SPACESHIP_GIT_STATUS_AHEAD="${SPACESHIP_GIT_STATUS_AHEAD="⇡"}"
SPACESHIP_GIT_STATUS_BEHIND="${SPACESHIP_GIT_STATUS_BEHIND="⇣"}"
SPACESHIP_GIT_STATUS_DIVERGED="${SPACESHIP_GIT_STATUS_DIVERGED="⇕"}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# We used to depend on OMZ git library,
# But it doesn't handle many of the status indicator combinations.
# Also, It's hard to maintain external dependency.
# See PR #147 at https://git.io/vQkkB
# See git help status to know more about status formats
spaceship_git_status() {
[[ $SPACESHIP_GIT_STATUS_SHOW == false ]] && return
spaceship::is_git || return
local INDEX git_status=""
INDEX=$(command git status --porcelain -b 2> /dev/null)
# Check for untracked files
if $(echo "$INDEX" | command grep -E '^\?\? ' &> /dev/null); then
git_status="$SPACESHIP_GIT_STATUS_UNTRACKED$git_status"
fi
# Check for staged files
if $(echo "$INDEX" | command grep '^A[ MDAU] ' &> /dev/null); then
git_status="$SPACESHIP_GIT_STATUS_ADDED$git_status"
elif $(echo "$INDEX" | command grep '^M[ MD] ' &> /dev/null); then
git_status="$SPACESHIP_GIT_STATUS_ADDED$git_status"
elif $(echo "$INDEX" | command grep '^UA' &> /dev/null); then
git_status="$SPACESHIP_GIT_STATUS_ADDED$git_status"
fi
# Check for modified files
if $(echo "$INDEX" | command grep '^[ MARC]M ' &> /dev/null); then
git_status="$SPACESHIP_GIT_STATUS_MODIFIED$git_status"
fi
# Check for renamed files
if $(echo "$INDEX" | command grep '^R[ MD] ' &> /dev/null); then
git_status="$SPACESHIP_GIT_STATUS_RENAMED$git_status"
fi
# Check for deleted files
if $(echo "$INDEX" | command grep '^[MARCDU ]D ' &> /dev/null); then
git_status="$SPACESHIP_GIT_STATUS_DELETED$git_status"
elif $(echo "$INDEX" | command grep '^D[ UM] ' &> /dev/null); then
git_status="$SPACESHIP_GIT_STATUS_DELETED$git_status"
fi
# Check for stashes
if $(command git rev-parse --verify refs/stash >/dev/null 2>&1); then
git_status="$SPACESHIP_GIT_STATUS_STASHED$git_status"
fi
# Check for unmerged files
if $(echo "$INDEX" | command grep '^U[UDA] ' &> /dev/null); then
git_status="$SPACESHIP_GIT_STATUS_UNMERGED$git_status"
elif $(echo "$INDEX" | command grep '^AA ' &> /dev/null); then
git_status="$SPACESHIP_GIT_STATUS_UNMERGED$git_status"
elif $(echo "$INDEX" | command grep '^DD ' &> /dev/null); then
git_status="$SPACESHIP_GIT_STATUS_UNMERGED$git_status"
elif $(echo "$INDEX" | command grep '^[DA]U ' &> /dev/null); then
git_status="$SPACESHIP_GIT_STATUS_UNMERGED$git_status"
fi
# Check whether branch is ahead
local is_ahead=false
if $(echo "$INDEX" | command grep '^## [^ ]\+ .*ahead' &> /dev/null); then
is_ahead=true
fi
# Check whether branch is behind
local is_behind=false
if $(echo "$INDEX" | command grep '^## [^ ]\+ .*behind' &> /dev/null); then
is_behind=true
fi
# Check wheather branch has diverged
if [[ "$is_ahead" == true && "$is_behind" == true ]]; then
git_status="$SPACESHIP_GIT_STATUS_DIVERGED$git_status"
else
[[ "$is_ahead" == true ]] && git_status="$SPACESHIP_GIT_STATUS_AHEAD$git_status"
[[ "$is_behind" == true ]] && git_status="$SPACESHIP_GIT_STATUS_BEHIND$git_status"
fi
if [[ -n $git_status ]]; then
# Status prefixes are colorized
spaceship::section \
"$SPACESHIP_GIT_STATUS_COLOR" \
"$SPACESHIP_GIT_STATUS_PREFIX$git_status$SPACESHIP_GIT_STATUS_SUFFIX"
fi
}

View File

@ -0,0 +1,38 @@
#
# Go
#
# Go is an open source programming language that makes it easy
# to build efficient software.
# Link: https://golang.org/
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_GOLANG_SHOW="${SPACESHIP_GOLANG_SHOW=true}"
SPACESHIP_GOLANG_PREFIX="${SPACESHIP_GOLANG_PREFIX="$SPACESHIP_PROMPT_DEFAULT_PREFIX"}"
SPACESHIP_GOLANG_SUFFIX="${SPACESHIP_GOLANG_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_GOLANG_SYMBOL="${SPACESHIP_GOLANG_SYMBOL="🐹 "}"
SPACESHIP_GOLANG_COLOR="${SPACESHIP_GOLANG_COLOR="cyan"}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
spaceship_golang() {
[[ $SPACESHIP_GOLANG_SHOW == false ]] && return
# If there are Go-specific files in current directory, or current directory is under the GOPATH
[[ -f go.mod || -d Godeps || -f glide.yaml || -n *.go(#qN^/) || -f Gopkg.yml || -f Gopkg.lock \
|| ( $GOPATH && "$PWD/" =~ "$GOPATH/" ) ]] || return
spaceship::exists go || return
local go_version=$(go version | awk '{print substr($3, 3)}' )
spaceship::section \
"$SPACESHIP_GOLANG_COLOR" \
"$SPACESHIP_GOLANG_PREFIX" \
"${SPACESHIP_GOLANG_SYMBOL}v${go_version}" \
"$SPACESHIP_GOLANG_SUFFIX"
}

View File

@ -0,0 +1,38 @@
#
# Haskell Stack
#
# An advanced, purely functional programming language.
# Link: https://www.haskell.org/
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_HASKELL_SHOW="${SPACESHIP_HASKELL_SHOW=true}"
SPACESHIP_HASKELL_PREFIX="${SPACESHIP_HASKELL_PREFIX="$SPACESHIP_PROMPT_DEFAULT_PREFIX"}"
SPACESHIP_HASKELL_SUFFIX="${SPACESHIP_HASKELL_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_HASKELL_SYMBOL="${SPACESHIP_HASKELL_SYMBOL="λ "}"
SPACESHIP_HASKELL_COLOR="${SPACESHIP_HASKELL_COLOR="red"}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show current version of Haskell Tool Stack.
spaceship_haskell() {
[[ $SPACESHIP_HASKELL_SHOW == false ]] && return
# If there are stack files in current directory
[[ -f stack.yaml ]] || return
# The command is stack, so do not change this to haskell.
spaceship::exists stack || return
local haskell_version=$(stack ghc -- --numeric-version --no-install-ghc)
spaceship::section \
"$SPACESHIP_HASKELL_COLOR" \
"$SPACESHIP_HASKELL_PREFIX" \
"${SPACESHIP_HASKELL_SYMBOL}v${haskell_version}" \
"$SPACESHIP_HASKELL_SUFFIX"
}

View File

@ -0,0 +1,40 @@
#
# Mercurial (hg)
#
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_HG_SHOW="${SPACESHIP_HG_SHOW=true}"
SPACESHIP_HG_PREFIX="${SPACESHIP_HG_PREFIX="on "}"
SPACESHIP_HG_SUFFIX="${SPACESHIP_HG_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_HG_SYMBOL="${SPACESHIP_HG_SYMBOL="☿ "}"
# ------------------------------------------------------------------------------
# Dependencies
# ------------------------------------------------------------------------------
source "$SPACESHIP_ROOT/sections/hg_branch.zsh"
source "$SPACESHIP_ROOT/sections/hg_status.zsh"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show both hg branch and hg status:
# spaceship_hg_branch
# spaceship_hg_status
spaceship_hg() {
[[ $SPACESHIP_HG_SHOW == false ]] && return
local hg_branch="$(spaceship_hg_branch)" hg_status="$(spaceship_hg_status)"
[[ -z $hg_branch ]] && return
spaceship::section \
'white' \
"$SPACESHIP_HG_PREFIX" \
"${hg_branch}${hg_status}" \
"$SPACESHIP_HG_SUFFIX"
}

View File

@ -0,0 +1,33 @@
#
# Mercurial (hg) branch
#
# Show current Mercurial branch
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_HG_BRANCH_SHOW="${SPACESHIP_HG_BRANCH_SHOW=true}"
SPACESHIP_HG_BRANCH_PREFIX="${SPACESHIP_HG_BRANCH_PREFIX="$SPACESHIP_HG_SYMBOL"}"
SPACESHIP_HG_BRANCH_SUFFIX="${SPACESHIP_HG_BRANCH_SUFFIX=""}"
SPACESHIP_HG_BRANCH_COLOR="${SPACESHIP_HG_BRANCH_COLOR="magenta"}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
spaceship_hg_branch() {
[[ $SPACESHIP_HG_BRANCH_SHOW == false ]] && return
spaceship::is_hg || return
local hg_info=$(hg log -r . -T '{activebookmark}')
if [[ -z $hg_info ]]; then
hg_info=$(hg branch)
fi
spaceship::section \
"$SPACESHIP_HG_BRANCH_COLOR" \
"$SPACESHIP_HG_BRANCH_PREFIX"$hg_info"$SPACESHIP_HG_BRANCH_SUFFIX"
}

View File

@ -0,0 +1,51 @@
#
# Mercurial (hg) status
#
# Show Mercurial status
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_HG_STATUS_SHOW="${SPACESHIP_HG_STATUS_SHOW=true}"
SPACESHIP_HG_STATUS_PREFIX="${SPACESHIP_HG_STATUS_PREFIX=" ["}"
SPACESHIP_HG_STATUS_SUFFIX="${SPACESHIP_HG_STATUS_SUFFIX="]"}"
SPACESHIP_HG_STATUS_COLOR="${SPACESHIP_HG_STATUS_COLOR="red"}"
SPACESHIP_HG_STATUS_UNTRACKED="${SPACESHIP_HG_STATUS_UNTRACKED="?"}"
SPACESHIP_HG_STATUS_ADDED="${SPACESHIP_HG_STATUS_ADDED="+"}"
SPACESHIP_HG_STATUS_MODIFIED="${SPACESHIP_HG_STATUD_MODIFIED="!"}"
SPACESHIP_HG_STATUS_DELETED="${SPACESHIP_HG_STATUS_DELETED="✘"}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Check if current dir is a hg repo and show hg status as indicators
spaceship_hg_status() {
[[ $SPACESHIP_HG_STATUS_SHOW == false ]] && return
spaceship::is_hg || return
local INDEX=$(hg status 2>/dev/null) hg_status=""
# Indicators are suffixed instead of prefixed to each other to
# provide uniform view across git and mercurial indicators
if $(echo "$INDEX" | grep -E '^\? ' &> /dev/null); then
hg_status="$SPACESHIP_HG_STATUS_UNTRACKED$hg_status"
fi
if $(echo "$INDEX" | grep -E '^A ' &> /dev/null); then
hg_status="$SPACESHIP_HG_STATUS_ADDED$hg_status"
fi
if $(echo "$INDEX" | grep -E '^M ' &> /dev/null); then
hg_status="$SPACESHIP_HG_STATUS_MODIFIED$hg_status"
fi
if $(echo "$INDEX" | grep -E '^(R|!)' &> /dev/null); then
hg_status="$SPACESHIP_HG_STATUS_DELETED$hg_status"
fi
if [[ -n $hg_status ]]; then
spaceship::section \
"$SPACESHIP_HG_STATUS_COLOR" \
"$SPACESHIP_HG_STATUS_PREFIX"$hg_status"$SPACESHIP_HG_STATUS_SUFFIX"
fi
}

View File

@ -0,0 +1,46 @@
#
# Hostname
#
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_HOST_SHOW="${SPACESHIP_HOST_SHOW=true}"
SPACESHIP_HOST_SHOW_FULL="${SPACESHIP_HOST_SHOW_FULL=false}"
SPACESHIP_HOST_PREFIX="${SPACESHIP_HOST_PREFIX="at "}"
SPACESHIP_HOST_SUFFIX="${SPACESHIP_HOST_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_HOST_COLOR="${SPACESHIP_HOST_COLOR="blue"}"
SPACESHIP_HOST_COLOR_SSH="${SPACESHIP_HOST_COLOR_SSH="green"}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# If there is an ssh connections, current machine name.
spaceship_host() {
[[ $SPACESHIP_HOST_SHOW == false ]] && return
if [[ $SPACESHIP_HOST_SHOW == 'always' ]] || [[ -n $SSH_CONNECTION ]]; then
local host_color host
# Determination of what color should be used
if [[ -n $SSH_CONNECTION ]]; then
host_color=$SPACESHIP_HOST_COLOR_SSH
else
host_color=$SPACESHIP_HOST_COLOR
fi
if [[ $SPACESHIP_HOST_SHOW_FULL == true ]]; then
host="%M"
else
host="%m"
fi
spaceship::section \
"$host_color" \
"$SPACESHIP_HOST_PREFIX" \
"$host" \
"$SPACESHIP_HOST_SUFFIX"
fi
}

View File

@ -0,0 +1,41 @@
#
# Background jobs
#
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_JOBS_SHOW="${SPACESHIP_JOBS_SHOW=true}"
SPACESHIP_JOBS_PREFIX="${SPACESHIP_JOBS_PREFIX=""}"
SPACESHIP_JOBS_SUFFIX="${SPACESHIP_JOBS_SUFFIX=" "}"
SPACESHIP_JOBS_SYMBOL="${SPACESHIP_JOBS_SYMBOL="✦"}"
SPACESHIP_JOBS_COLOR="${SPACESHIP_JOBS_COLOR="blue"}"
SPACESHIP_JOBS_AMOUNT_PREFIX="${SPACESHIP_JOBS_AMOUNT_PREFIX=""}"
SPACESHIP_JOBS_AMOUNT_SUFFIX="${SPACESHIP_JOBS_AMOUNT_SUFFIX=""}"
SPACESHIP_JOBS_AMOUNT_THRESHOLD="${SPACESHIP_JOBS_AMOUNT_THRESHOLD=1}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show icon if there's a working jobs in the background
spaceship_jobs() {
[[ $SPACESHIP_JOBS_SHOW == false ]] && return
local jobs_amount=$( jobs -d | awk '!/pwd/' | wc -l | tr -d " ")
[[ $jobs_amount -gt 0 ]] || return
if [[ $jobs_amount -le $SPACESHIP_JOBS_AMOUNT_THRESHOLD ]]; then
jobs_amount=''
SPACESHIP_JOBS_AMOUNT_PREFIX=''
SPACESHIP_JOBS_AMOUNT_SUFFIX=''
fi
spaceship::section \
"$SPACESHIP_JOBS_COLOR" \
"$SPACESHIP_JOBS_PREFIX" \
"${SPACESHIP_JOBS_SYMBOL}${SPACESHIP_JOBS_AMOUNT_PREFIX}${jobs_amount}${SPACESHIP_JOBS_AMOUNT_SUFFIX}" \
"$SPACESHIP_JOBS_SUFFIX"
}

View File

@ -0,0 +1,37 @@
#
# Julia
#
# A high-level, high-performance dynamic programming language for numerical computing.
# Link: https://julialang.org/
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_JULIA_SHOW="${SPACESHIP_JULIA_SHOW=true}"
SPACESHIP_JULIA_PREFIX="${SPACESHIP_JULIA_PREFIX="$SPACESHIP_PROMPT_DEFAULT_PREFIX"}"
SPACESHIP_JULIA_SUFFIX="${SPACESHIP_JULIA_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_JULIA_SYMBOL="${SPACESHIP_JULIA_SYMBOL="ஃ "}"
SPACESHIP_JULIA_COLOR="${SPACESHIP_JULIA_COLOR="green"}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show current version of Julia
spaceship_julia() {
[[ $SPACESHIP_JULIA_SHOW == false ]] && return
# If there are julia files in current directory
[[ -n *.jl(#qN^/) ]] || return
spaceship::exists julia || return
local julia_version=$(julia --version | grep --color=never -oE '[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]')
spaceship::section \
"$SPACESHIP_JULIA_COLOR" \
"$SPACESHIP_JULIA_PREFIX" \
"${SPACESHIP_JULIA_SYMBOL}v${julia_version}" \
"$SPACESHIP_JULIA_SUFFIX"
}

View File

@ -0,0 +1,62 @@
#
# Kubernetes (kubectl)
#
# Kubernetes is an open-source system for deployment, scaling,
# and management of containerized applications.
# Link: https://kubernetes.io/
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_KUBECONTEXT_SHOW="${SPACESHIP_KUBECONTEXT_SHOW=true}"
SPACESHIP_KUBECONTEXT_PREFIX="${SPACESHIP_KUBECONTEXT_PREFIX="at "}"
SPACESHIP_KUBECONTEXT_SUFFIX="${SPACESHIP_KUBECONTEXT_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
# Additional space is added because ☸️ is much bigger than the other symbols
# See: https://github.com/denysdovhan/spaceship-prompt/pull/432
SPACESHIP_KUBECONTEXT_SYMBOL="${SPACESHIP_KUBECONTEXT_SYMBOL="☸️ "}"
SPACESHIP_KUBECONTEXT_COLOR="${SPACESHIP_KUBECONTEXT_COLOR="cyan"}"
SPACESHIP_KUBECONTEXT_NAMESPACE_SHOW="${SPACESHIP_KUBECONTEXT_NAMESPACE_SHOW=true}"
SPACESHIP_KUBECONTEXT_COLOR_GROUPS=(${SPACESHIP_KUBECONTEXT_COLOR_GROUPS=})
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show current context in kubectl
spaceship_kubecontext() {
[[ $SPACESHIP_KUBECONTEXT_SHOW == false ]] && return
spaceship::exists kubectl || return
local kube_context=$(kubectl config current-context 2>/dev/null)
[[ -z $kube_context ]] && return
if [[ $SPACESHIP_KUBECONTEXT_NAMESPACE_SHOW == true ]]; then
local kube_namespace=$(kubectl config view --minify --output 'jsonpath={..namespace}' 2>/dev/null)
[[ -n $kube_namespace && "$kube_namespace" != "default" ]] && kube_context="$kube_context ($kube_namespace)"
fi
# Apply custom color to section if $kube_context matches a pattern defined in SPACESHIP_KUBECONTEXT_COLOR_GROUPS array.
# See Options.md for usage example.
local len=${#SPACESHIP_KUBECONTEXT_COLOR_GROUPS[@]}
local it_to=$((len / 2))
local 'section_color' 'i'
for ((i = 1; i <= $it_to; i++)); do
local idx=$(((i - 1) * 2))
local color="${SPACESHIP_KUBECONTEXT_COLOR_GROUPS[$idx + 1]}"
local pattern="${SPACESHIP_KUBECONTEXT_COLOR_GROUPS[$idx + 2]}"
if [[ "$kube_context" =~ "$pattern" ]]; then
section_color=$color
break
fi
done
[[ -z "$section_color" ]] && section_color=$SPACESHIP_KUBECONTEXT_COLOR
spaceship::section \
"$section_color" \
"$SPACESHIP_KUBECONTEXT_PREFIX" \
"${SPACESHIP_KUBECONTEXT_SYMBOL}${kube_context}" \
"$SPACESHIP_KUBECONTEXT_SUFFIX"
}

View File

@ -0,0 +1,12 @@
#
# Line separator
#
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Should it write prompt in two lines or not?
spaceship_line_sep() {
[[ $SPACESHIP_PROMPT_SEPARATE_LINE == true ]] && echo -n "$NEWLINE"
}

View File

@ -0,0 +1,50 @@
#
# Node.js
#
# Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine.
# Link: https://nodejs.org/
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_NODE_SHOW="${SPACESHIP_NODE_SHOW=true}"
SPACESHIP_NODE_PREFIX="${SPACESHIP_NODE_PREFIX="$SPACESHIP_PROMPT_DEFAULT_PREFIX"}"
SPACESHIP_NODE_SUFFIX="${SPACESHIP_NODE_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_NODE_SYMBOL="${SPACESHIP_NODE_SYMBOL="⬢ "}"
SPACESHIP_NODE_DEFAULT_VERSION="${SPACESHIP_NODE_DEFAULT_VERSION=""}"
SPACESHIP_NODE_COLOR="${SPACESHIP_NODE_COLOR="green"}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show current version of node, exception system.
spaceship_node() {
[[ $SPACESHIP_NODE_SHOW == false ]] && return
# Show NODE status only for JS-specific folders
[[ -f package.json || -d node_modules || -n *.js(#qN^/) ]] || return
local 'node_version'
if spaceship::exists nvm; then
node_version=$(nvm current 2>/dev/null)
[[ $node_version == "system" || $node_version == "node" ]] && return
elif spaceship::exists nodenv; then
node_version=$(nodenv version-name)
[[ $node_version == "system" || $node_version == "node" ]] && return
elif spaceship::exists node; then
node_version=$(node -v 2>/dev/null)
else
return
fi
[[ $node_version == $SPACESHIP_NODE_DEFAULT_VERSION ]] && return
spaceship::section \
"$SPACESHIP_NODE_COLOR" \
"$SPACESHIP_NODE_PREFIX" \
"${SPACESHIP_NODE_SYMBOL}${node_version}" \
"$SPACESHIP_NODE_SUFFIX"
}

View File

@ -0,0 +1,48 @@
#
# Package
#
# Current package version.
# These package managers supported:
# * NPM
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_PACKAGE_SHOW="${SPACESHIP_PACKAGE_SHOW=true}"
SPACESHIP_PACKAGE_PREFIX="${SPACESHIP_PACKAGE_PREFIX="is "}"
SPACESHIP_PACKAGE_SUFFIX="${SPACESHIP_PACKAGE_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_PACKAGE_SYMBOL="${SPACESHIP_PACKAGE_SYMBOL="📦 "}"
SPACESHIP_PACKAGE_COLOR="${SPACESHIP_PACKAGE_COLOR="red"}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
spaceship_package() {
[[ $SPACESHIP_PACKAGE_SHOW == false ]] && return
# Show package version only when repository is a package
# @todo: add more package managers
[[ -f package.json ]] || return
spaceship::exists npm || return
local 'package_version'
if spaceship::exists jq; then
package_version=$(jq -r '.version' package.json 2>/dev/null)
elif spaceship::exists python; then
package_version=$(python -c "import json; print(json.load(open('package.json'))['version'])" 2>/dev/null)
elif spaceship::exists node; then
package_version=$(node -p "require('./package.json').version" 2> /dev/null)
fi
[[ -z $package_version || "$package_version" == "undefined" ]] && return
spaceship::section \
"$SPACESHIP_PACKAGE_COLOR" \
"$SPACESHIP_PACKAGE_PREFIX" \
"${SPACESHIP_PACKAGE_SYMBOL}v${package_version}" \
"$SPACESHIP_PACKAGE_SUFFIX"
}

View File

@ -0,0 +1,37 @@
#
# PHP
#
# PHP is a server-side scripting language designed primarily for web development.
# Link: http://www.php.net/
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_PHP_SHOW="${SPACESHIP_PHP_SHOW=true}"
SPACESHIP_PHP_PREFIX="${SPACESHIP_PHP_PREFIX="$SPACESHIP_PROMPT_DEFAULT_PREFIX"}"
SPACESHIP_PHP_SUFFIX="${SPACESHIP_PHP_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_PHP_SYMBOL="${SPACESHIP_PHP_SYMBOL="🐘 "}"
SPACESHIP_PHP_COLOR="${SPACESHIP_PHP_COLOR="blue"}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show current version of PHP
spaceship_php() {
[[ $SPACESHIP_PHP_SHOW == false ]] && return
# Show only if php files or composer.json exist in current directory
[[ -n *.php(#qN^/) || -f composer.json ]] || return
spaceship::exists php || return
local php_version=$(php -v 2>&1 | grep --color=never -oe "^PHP\s*[0-9.]\+" | awk '{print $2}')
spaceship::section \
"$SPACESHIP_PHP_COLOR" \
"$SPACESHIP_PHP_PREFIX" \
"${SPACESHIP_PHP_SYMBOL}v${php_version}" \
"${SPACESHIP_PHP_SUFFIX}"
}

View File

@ -0,0 +1,37 @@
#
# pyenv
#
# pyenv lets you easily switch between multiple versions of Python.
# Link: https://github.com/pyenv/pyenv
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_PYENV_SHOW="${SPACESHIP_PYENV_SHOW=true}"
SPACESHIP_PYENV_PREFIX="${SPACESHIP_PYENV_PREFIX="$SPACESHIP_PROMPT_DEFAULT_PREFIX"}"
SPACESHIP_PYENV_SUFFIX="${SPACESHIP_PYENV_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_PYENV_SYMBOL="${SPACESHIP_PYENV_SYMBOL="🐍 "}"
SPACESHIP_PYENV_COLOR="${SPACESHIP_PYENV_COLOR="yellow"}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show current version of pyenv Python, including system.
spaceship_pyenv() {
[[ $SPACESHIP_PYENV_SHOW == false ]] && return
# Show pyenv python version only for Python-specific folders
[[ -f requirements.txt || -f pyproject.toml || -n *.py(#qN^/) ]] || return
spaceship::exists pyenv || return # Do nothing if pyenv is not installed
local pyenv_status=${$(pyenv version-name 2>/dev/null)//:/ }
spaceship::section \
"$SPACESHIP_PYENV_COLOR" \
"$SPACESHIP_PYENV_PREFIX" \
"${SPACESHIP_PYENV_SYMBOL}${pyenv_status}" \
"$SPACESHIP_PYENV_SUFFIX"
}

View File

@ -0,0 +1,53 @@
#
# Ruby
#
# A dynamic, reflective, object-oriented, general-purpose programming language.
# Link: https://www.ruby-lang.org/
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_RUBY_SHOW="${SPACESHIP_RUBY_SHOW=true}"
SPACESHIP_RUBY_PREFIX="${SPACESHIP_RUBY_PREFIX="$SPACESHIP_PROMPT_DEFAULT_PREFIX"}"
SPACESHIP_RUBY_SUFFIX="${SPACESHIP_RUBY_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_RUBY_SYMBOL="${SPACESHIP_RUBY_SYMBOL="💎 "}"
SPACESHIP_RUBY_COLOR="${SPACESHIP_RUBY_COLOR="red"}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show current version of Ruby
spaceship_ruby() {
[[ $SPACESHIP_RUBY_SHOW == false ]] && return
# Show versions only for Ruby-specific folders
[[ -f Gemfile || -f Rakefile || -n *.rb(#qN^/) ]] || return
local 'ruby_version'
if spaceship::exists rvm-prompt; then
ruby_version=$(rvm-prompt i v g)
elif spaceship::exists chruby; then
ruby_version=$(chruby | sed -n -e 's/ \* //p')
elif spaceship::exists rbenv; then
ruby_version=$(rbenv version-name)
elif spaceship::exists asdf; then
# split output on space and return first element
ruby_version=${$(asdf current ruby)[1]}
else
return
fi
[[ -z $ruby_version || "${ruby_version}" == "system" ]] && return
# Add 'v' before ruby version that starts with a number
[[ "${ruby_version}" =~ ^[0-9].+$ ]] && ruby_version="v${ruby_version}"
spaceship::section \
"$SPACESHIP_RUBY_COLOR" \
"$SPACESHIP_RUBY_PREFIX" \
"${SPACESHIP_RUBY_SYMBOL}${ruby_version}" \
"$SPACESHIP_RUBY_SUFFIX"
}

View File

@ -0,0 +1,42 @@
#
# Rust
#
# Rust is a systems programming language sponsored by Mozilla Research.
# Link: https://www.rust-lang.org
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_RUST_SHOW="${SPACESHIP_RUST_SHOW=true}"
SPACESHIP_RUST_PREFIX="${SPACESHIP_RUST_PREFIX="$SPACESHIP_PROMPT_DEFAULT_PREFIX"}"
SPACESHIP_RUST_SUFFIX="${SPACESHIP_RUST_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_RUST_SYMBOL="${SPACESHIP_RUST_SYMBOL="𝗥 "}"
SPACESHIP_RUST_COLOR="${SPACESHIP_RUST_COLOR="red"}"
SPACESHIP_RUST_VERBOSE_VERSION="${SPACESHIP_RUST_VERBOSE_VERSION=false}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show current version of Rust
spaceship_rust() {
[[ $SPACESHIP_RUST_SHOW == false ]] && return
# If there are Rust-specific files in current directory
[[ -f Cargo.toml || -n *.rs(#qN^/) ]] || return
spaceship::exists rustc || return
local rust_version=$(rustc --version | cut -d' ' -f2)
if [[ $SPACESHIP_RUST_VERBOSE_VERSION == false ]]; then
local rust_version=$(echo $rust_version | cut -d'-' -f1) # Cut off -suffixes from version. "v1.30.0-beta.11" or "v1.30.0-nightly"
fi
spaceship::section \
"$SPACESHIP_RUST_COLOR" \
"$SPACESHIP_RUST_PREFIX" \
"${SPACESHIP_RUST_SYMBOL}v${rust_version}" \
"$SPACESHIP_RUST_SUFFIX"
}

View File

@ -0,0 +1,43 @@
#
# Swift
#
# A general-purpose, multi-paradigm, compiled programming language by Apple Inc.
# Link: https://developer.apple.com/swift/
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_SWIFT_SHOW_LOCAL="${SPACESHIP_SWIFT_SHOW_LOCAL=true}"
SPACESHIP_SWIFT_SHOW_GLOBAL="${SPACESHIP_SWIFT_SHOW_GLOBAL=false}"
SPACESHIP_SWIFT_PREFIX="${SPACESHIP_SWIFT_PREFIX="$SPACESHIP_PROMPT_DEFAULT_PREFIX"}"
SPACESHIP_SWIFT_SUFFIX="${SPACESHIP_SWIFT_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_SWIFT_SYMBOL="${SPACESHIP_SWIFT_SYMBOL="🐦 "}"
SPACESHIP_SWIFT_COLOR="${SPACESHIP_SWIFT_COLOR="yellow"}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show current version of Swift
spaceship_swift() {
spaceship::exists swiftenv || return
local 'swift_version'
if [[ $SPACESHIP_SWIFT_SHOW_GLOBAL == true ]] ; then
swift_version=$(swiftenv version | sed 's/ .*//')
elif [[ $SPACESHIP_SWIFT_SHOW_LOCAL == true ]] ; then
if swiftenv version | grep ".swift-version" > /dev/null; then
swift_version=$(swiftenv version | sed 's/ .*//')
fi
fi
[ -n "${swift_version}" ] || return
spaceship::section \
"$SPACESHIP_SWIFT_COLOR" \
"$SPACESHIP_SWIFT_PREFIX" \
"${SPACESHIP_SWIFT_SYMBOL}${swift_version}" \
"$SPACESHIP_SWIFT_SUFFIX"
}

View File

@ -0,0 +1,40 @@
#
# Terraform Workspaces
#
# Terraform automates the repetitive tasks of setting up cloud resources
# Link: https://www.terraform.io
#
# This section shows you the current Terraform workspace
# Link: https://www.terraform.io/docs/state/workspaces.html
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_TERRAFORM_SHOW="${SPACESHIP_TERRAFORM_SHOW=true}"
SPACESHIP_TERRAFORM_PREFIX="${SPACESHIP_TERRAFORM_PREFIX="$SPACESHIP_PROMPT_DEFAULT_PREFIX"}"
SPACESHIP_TERRAFORM_SUFFIX="${SPACESHIP_TERRAFORM_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_TERRAFORM_SYMBOL="${SPACESHIP_TERRAFORM_SYMBOL="🛠 "}"
SPACESHIP_TERRAFORM_COLOR="${SPACESHIP_TERRAFORM_COLOR="105"}"
# ------------------------------------------------------------------------------
# Section
# ----------------------------------------------- -------------------------------
spaceship_terraform() {
[[ $SPACESHIP_TERRAFORM_SHOW == false ]] && return
spaceship::exists terraform || return
# Show Terraform Workspaces when exists
[[ -f .terraform/environment ]] || return
local terraform_workspace=$(<.terraform/environment)
[[ -z $terraform_workspace ]] && return
spaceship::section \
"$SPACESHIP_TERRAFORM_COLOR" \
"$SPACESHIP_TERRAFORM_PREFIX" \
"$SPACESHIP_TERRAFORM_SYMBOL$terraform_workspace" \
"$SPACESHIP_TERRAFORM_SUFFIX"
}

View File

@ -0,0 +1,39 @@
#
# Time
#
# Current time
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_TIME_SHOW="${SPACESHIP_TIME_SHOW=false}"
SPACESHIP_TIME_PREFIX="${SPACESHIP_TIME_PREFIX="at "}"
SPACESHIP_TIME_SUFFIX="${SPACESHIP_TIME_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_TIME_FORMAT="${SPACESHIP_TIME_FORMAT=false}"
SPACESHIP_TIME_12HR="${SPACESHIP_TIME_12HR=false}"
SPACESHIP_TIME_COLOR="${SPACESHIP_TIME_COLOR="yellow"}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
spaceship_time() {
[[ $SPACESHIP_TIME_SHOW == false ]] && return
local 'time_str'
if [[ $SPACESHIP_TIME_FORMAT != false ]]; then
time_str="${SPACESHIP_TIME_FORMAT}"
elif [[ $SPACESHIP_TIME_12HR == true ]]; then
time_str="%D{%r}"
else
time_str="%D{%T}"
fi
spaceship::section \
"$SPACESHIP_TIME_COLOR" \
"$SPACESHIP_TIME_PREFIX" \
"$time_str" \
"$SPACESHIP_TIME_SUFFIX"
}

View File

@ -0,0 +1,50 @@
#
# Username
#
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
# --------------------------------------------------------------------------
# | SPACESHIP_USER_SHOW | show username on local | show username on remote |
# |---------------------+------------------------+-------------------------|
# | false | never | never |
# | always | always | always |
# | true | if needed | always |
# | needed | if needed | if needed |
# --------------------------------------------------------------------------
SPACESHIP_USER_SHOW="${SPACESHIP_USER_SHOW=true}"
SPACESHIP_USER_PREFIX="${SPACESHIP_USER_PREFIX="with "}"
SPACESHIP_USER_SUFFIX="${SPACESHIP_USER_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_USER_COLOR="${SPACESHIP_USER_COLOR="yellow"}"
SPACESHIP_USER_COLOR_ROOT="${SPACESHIP_USER_COLOR_ROOT="red"}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
spaceship_user() {
[[ $SPACESHIP_USER_SHOW == false ]] && return
if [[ $SPACESHIP_USER_SHOW == 'always' ]] \
|| [[ $LOGNAME != $USER ]] \
|| [[ $UID == 0 ]] \
|| [[ $SPACESHIP_USER_SHOW == true && -n $SSH_CONNECTION ]]
then
local 'user_color'
if [[ $USER == 'root' ]]; then
user_color=$SPACESHIP_USER_COLOR_ROOT
else
user_color="$SPACESHIP_USER_COLOR"
fi
spaceship::section \
"$user_color" \
"$SPACESHIP_USER_PREFIX" \
'%n' \
"$SPACESHIP_USER_SUFFIX"
fi
}

View File

@ -0,0 +1,45 @@
#
# Virtualenv
#
# virtualenv is a tool to create isolated Python environments.
# Link: https://virtualenv.pypa.io/
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_VENV_SHOW="${SPACESHIP_VENV_SHOW=true}"
SPACESHIP_VENV_PREFIX="${SPACESHIP_VENV_PREFIX="$SPACESHIP_PROMPT_DEFAULT_PREFIX"}"
SPACESHIP_VENV_SUFFIX="${SPACESHIP_VENV_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_VENV_SYMBOL="${SPACESHIP_VENV_SYMBOL=""}"
# The (A) expansion flag creates an array, the '=' activates word splitting
SPACESHIP_VENV_GENERIC_NAMES="${(A)=SPACESHIP_VENV_GENERIC_NAMES=virtualenv venv .venv}"
SPACESHIP_VENV_COLOR="${SPACESHIP_VENV_COLOR="blue"}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show current virtual environment (Python).
spaceship_venv() {
[[ $SPACESHIP_VENV_SHOW == false ]] && return
# Check if the current directory running via Virtualenv
[ -n "$VIRTUAL_ENV" ] || return
local 'venv'
if [[ "${SPACESHIP_VENV_GENERIC_NAMES[(i)$VIRTUAL_ENV:t]}" -le \
"${#SPACESHIP_VENV_GENERIC_NAMES}" ]]
then
venv="$VIRTUAL_ENV:h:t"
else
venv="$VIRTUAL_ENV:t"
fi
spaceship::section \
"$SPACESHIP_VENV_COLOR" \
"$SPACESHIP_VENV_PREFIX" \
"${SPACESHIP_VENV_SYMBOL}${venv}" \
"$SPACESHIP_VENV_SUFFIX"
}

View File

@ -0,0 +1,58 @@
#
# vi-mode
#
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_VI_MODE_SHOW="${SPACESHIP_VI_MODE_SHOW=true}"
SPACESHIP_VI_MODE_PREFIX="${SPACESHIP_VI_MODE_PREFIX=""}"
SPACESHIP_VI_MODE_SUFFIX="${SPACESHIP_VI_MODE_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_VI_MODE_INSERT="${SPACESHIP_VI_MODE_INSERT="[I]"}"
SPACESHIP_VI_MODE_NORMAL="${SPACESHIP_VI_MODE_NORMAL="[N]"}"
SPACESHIP_VI_MODE_COLOR="${SPACESHIP_VI_MODE_COLOR="white"}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show current vi-mode mode
spaceship_vi_mode() {
[[ $SPACESHIP_VI_MODE_SHOW == true ]] || return
if bindkey | grep "vi-quoted-insert" > /dev/null 2>&1; then # check if vi-mode enabled
local mode_indicator="${SPACESHIP_VI_MODE_INSERT}"
case "${KEYMAP}" in
main|viins)
mode_indicator="${SPACESHIP_VI_MODE_INSERT}"
;;
vicmd)
mode_indicator="${SPACESHIP_VI_MODE_NORMAL}"
;;
esac
spaceship::section \
"$SPACESHIP_VI_MODE_COLOR" \
"$SPACESHIP_VI_MODE_PREFIX" \
"$mode_indicator" \
"$SPACESHIP_VI_MODE_SUFFIX"
fi
}
# ------------------------------------------------------------------------------
# Helpers
# ------------------------------------------------------------------------------
# Temporarily switch to vi-mode
spaceship_vi_mode_enable() {
function zle-keymap-select() { zle reset-prompt ; zle -R }
zle -N zle-keymap-select
bindkey -v
}
# Temporarily switch to emacs-mode
spaceship_vi_mode_disable() {
bindkey -e
}

View File

@ -0,0 +1,50 @@
#
# Xcode
#
# Xcode is an integrated development environment for macOS.
# Link: https://developer.apple.com/xcode/
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_XCODE_SHOW_LOCAL="${SPACESHIP_XCODE_SHOW_LOCAL=true}"
SPACESHIP_XCODE_SHOW_GLOBAL="${SPACESHIP_XCODE_SHOW_GLOBAL=false}"
SPACESHIP_XCODE_PREFIX="${SPACESHIP_XCODE_PREFIX="$SPACESHIP_PROMPT_DEFAULT_PREFIX"}"
SPACESHIP_XCODE_SUFFIX="${SPACESHIP_XCODE_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_XCODE_SYMBOL="${SPACESHIP_XCODE_SYMBOL="🛠 "}"
SPACESHIP_XCODE_COLOR="${SPACESHIP_XCODE_COLOR="blue"}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show current version of Xcode
spaceship_xcode() {
spaceship::exists xcenv || return
local 'xcode_path'
if [[ $SPACESHIP_SWIFT_SHOW_GLOBAL == true ]] ; then
xcode_path=$(xcenv version | sed 's/ .*//')
elif [[ $SPACESHIP_SWIFT_SHOW_LOCAL == true ]] ; then
if xcenv version | grep ".xcode-version" > /dev/null; then
xcode_path=$(xcenv version | sed 's/ .*//')
fi
fi
if [ -n "${xcode_path}" ]; then
local xcode_version_path=$xcode_path"/Contents/version.plist"
if [ -f ${xcode_version_path} ]; then
if spaceship::exists defaults; then
local xcode_version=$(defaults read ${xcode_version_path} CFBundleShortVersionString)
spaceship::section \
"$SPACESHIP_XCODE_COLOR" \
"$SPACESHIP_XCODE_PREFIX" \
"${SPACESHIP_XCODE_SYMBOL}${xcode_version}" \
"$SPACESHIP_XCODE_SUFFIX"
fi
fi
fi
}

View File

@ -0,0 +1,217 @@
#
# Spaceship ZSH
#
# Author: Denys Dovhan, denysdovhan.com
# License: MIT
# https://github.com/denysdovhan/spaceship-prompt
# Current version of Spaceship
# Useful for issue reporting
export SPACESHIP_VERSION='3.9.0'
# Common-used variable for new line separator
NEWLINE='
'
# Determination of Spaceship working directory
# https://git.io/vdBH7
if [[ -z "$SPACESHIP_ROOT" ]]; then
if [[ "${(%):-%N}" == '(eval)' ]]; then
if [[ "$0" == '-antigen-load' ]] && [[ -r "${PWD}/spaceship.zsh" ]]; then
# Antigen uses eval to load things so it can change the plugin (!!)
# https://github.com/zsh-users/antigen/issues/581
export SPACESHIP_ROOT=$PWD
else
print -P "%F{red}You must set SPACESHIP_ROOT to work from within an (eval).%f"
return 1
fi
else
# Get the path to file this code is executing in; then
# get the absolute path and strip the filename.
# See https://stackoverflow.com/a/28336473/108857
export SPACESHIP_ROOT=${${(%):-%x}:A:h}
fi
fi
# ------------------------------------------------------------------------------
# CONFIGURATION
# The default configuration that can be overridden in .zshrc
# ------------------------------------------------------------------------------
if [ -z "$SPACESHIP_PROMPT_ORDER" ]; then
SPACESHIP_PROMPT_ORDER=(
time # Time stampts section
user # Username section
dir # Current directory section
host # Hostname section
git # Git section (git_branch + git_status)
hg # Mercurial section (hg_branch + hg_status)
package # Package version
node # Node.js section
ruby # Ruby section
elm # Elm section
elixir # Elixir section
xcode # Xcode section
swift # Swift section
golang # Go section
php # PHP section
rust # Rust section
haskell # Haskell Stack section
julia # Julia section
docker # Docker section
aws # Amazon Web Services section
venv # virtualenv section
conda # conda virtualenv section
pyenv # Pyenv section
dotnet # .NET section
ember # Ember.js section
kubecontext # Kubectl context section
terraform # Terraform workspace section
exec_time # Execution time
line_sep # Line break
battery # Battery level and status
vi_mode # Vi-mode indicator
jobs # Background jobs indicator
exit_code # Exit code section
char # Prompt character
)
fi
if [ -z "$SPACESHIP_RPROMPT_ORDER" ]; then
SPACESHIP_RPROMPT_ORDER=(
# empty by default
)
fi
# PROMPT
SPACESHIP_PROMPT_ADD_NEWLINE="${SPACESHIP_PROMPT_ADD_NEWLINE=true}"
SPACESHIP_PROMPT_SEPARATE_LINE="${SPACESHIP_PROMPT_SEPARATE_LINE=true}"
SPACESHIP_PROMPT_FIRST_PREFIX_SHOW="${SPACESHIP_PROMPT_FIRST_PREFIX_SHOW=false}"
SPACESHIP_PROMPT_PREFIXES_SHOW="${SPACESHIP_PROMPT_PREFIXES_SHOW=true}"
SPACESHIP_PROMPT_SUFFIXES_SHOW="${SPACESHIP_PROMPT_SUFFIXES_SHOW=true}"
SPACESHIP_PROMPT_DEFAULT_PREFIX="${SPACESHIP_PROMPT_DEFAULT_PREFIX="via "}"
SPACESHIP_PROMPT_DEFAULT_SUFFIX="${SPACESHIP_PROMPT_DEFAULT_SUFFIX=" "}"
# ------------------------------------------------------------------------------
# LIBS
# Spaceship utils/hooks/etc
# ------------------------------------------------------------------------------
# Load utils
source "$SPACESHIP_ROOT/lib/utils.zsh"
# load hooks
source "$SPACESHIP_ROOT/lib/hooks.zsh"
# load section utils
source "$SPACESHIP_ROOT/lib/section.zsh"
# ------------------------------------------------------------------------------
# SECTIONS
# Sourcing sections the prompt consists of
# ------------------------------------------------------------------------------
for section in $(spaceship::union $SPACESHIP_PROMPT_ORDER $SPACESHIP_RPROMPT_ORDER); do
if [[ -f "$SPACESHIP_ROOT/sections/$section.zsh" ]]; then
source "$SPACESHIP_ROOT/sections/$section.zsh"
elif spaceship::defined "spaceship_$section"; then
# Custom section is declared, nothing else to do
continue
else
echo "Section '$section' have not been loaded."
fi
done
# ------------------------------------------------------------------------------
# BACKWARD COMPATIBILITY WARNINGS
# Show deprecation messages for options that are set, but not supported
# ------------------------------------------------------------------------------
spaceship::deprecated SPACESHIP_PROMPT_SYMBOL "Use %BSPACESHIP_CHAR_SYMBOL%b instead."
spaceship::deprecated SPACESHIP_BATTERY_ALWAYS_SHOW "Use %BSPACESHIP_BATTERY_SHOW='always'%b instead."
spaceship::deprecated SPACESHIP_BATTERY_CHARGING_SYMBOL "Use %BSPACESHIP_BATTERY_SYMBOL_CHARGING%b instead."
spaceship::deprecated SPACESHIP_BATTERY_DISCHARGING_SYMBOL "Use %BSPACESHIP_BATTERY_SYMBOL_DISCHARGING%b instead."
spaceship::deprecated SPACESHIP_BATTERY_FULL_SYMBOL "Use %BSPACESHIP_BATTERY_SYMBOL_FULL%b instead."
# ------------------------------------------------------------------------------
# PROMPTS
# An entry point of prompt
# ------------------------------------------------------------------------------
# PROMPT
# Primary (left) prompt
spaceship_prompt() {
# Retrieve exit code of last command to use in exit_code
# Must be captured before any other command in prompt is executed
# Must be the very first line in all entry prompt functions, or the value
# will be overridden by a different command execution - do not move this line!
RETVAL=$?
# Should it add a new line before the prompt?
[[ $SPACESHIP_PROMPT_ADD_NEWLINE == true ]] && echo -n "$NEWLINE"
spaceship::compose_prompt $SPACESHIP_PROMPT_ORDER
}
# $RPROMPT
# Optional (right) prompt
spaceship_rprompt() {
# Retrieve exit code of last command to use in exit_code
RETVAL=$?
spaceship::compose_prompt $SPACESHIP_RPROMPT_ORDER
}
# PS2
# Continuation interactive prompt
spaceship_ps2() {
# Retrieve exit code of last command to use in exit_code
RETVAL=$?
local char="${SPACESHIP_CHAR_SYMBOL_SECONDARY="$SPACESHIP_CHAR_SYMBOL"}"
spaceship::section "$SPACESHIP_CHAR_COLOR_SECONDARY" "$char"
}
# ------------------------------------------------------------------------------
# SETUP
# Setup requirements for prompt
# ------------------------------------------------------------------------------
# Runs once when user opens a terminal
# All preparation before drawing prompt should be done here
prompt_spaceship_setup() {
autoload -Uz vcs_info
autoload -Uz add-zsh-hook
# This variable is a magic variable used when loading themes with zsh's prompt
# function. It will ensure the proper prompt options are set.
prompt_opts=(cr percent sp subst)
# Borrowed from promptinit, sets the prompt options in case the prompt was not
# initialized via promptinit.
setopt noprompt{bang,cr,percent,subst} "prompt${^prompt_opts[@]}"
# Add exec_time hooks
add-zsh-hook preexec spaceship_exec_time_preexec_hook
add-zsh-hook precmd spaceship_exec_time_precmd_hook
# Disable python virtualenv environment prompt prefix
VIRTUAL_ENV_DISABLE_PROMPT=true
# Configure vcs_info helper for potential use in the future
add-zsh-hook precmd spaceship_exec_vcs_info_precmd_hook
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:git*' formats '%b'
# Expose Spaceship to environment variables
PROMPT='$(spaceship_prompt)'
PS2='$(spaceship_ps2)'
RPS1='$(spaceship_rprompt)'
}
# ------------------------------------------------------------------------------
# ENTRY POINT
# An entry point of prompt
# ------------------------------------------------------------------------------
# Pass all arguments to the spaceship_setup function
prompt_spaceship_setup "$@"

View File

@ -0,0 +1,217 @@
#
# Spaceship ZSH
#
# Author: Denys Dovhan, denysdovhan.com
# License: MIT
# https://github.com/denysdovhan/spaceship-prompt
# Current version of Spaceship
# Useful for issue reporting
export SPACESHIP_VERSION='3.9.0'
# Common-used variable for new line separator
NEWLINE='
'
# Determination of Spaceship working directory
# https://git.io/vdBH7
if [[ -z "$SPACESHIP_ROOT" ]]; then
if [[ "${(%):-%N}" == '(eval)' ]]; then
if [[ "$0" == '-antigen-load' ]] && [[ -r "${PWD}/spaceship.zsh" ]]; then
# Antigen uses eval to load things so it can change the plugin (!!)
# https://github.com/zsh-users/antigen/issues/581
export SPACESHIP_ROOT=$PWD
else
print -P "%F{red}You must set SPACESHIP_ROOT to work from within an (eval).%f"
return 1
fi
else
# Get the path to file this code is executing in; then
# get the absolute path and strip the filename.
# See https://stackoverflow.com/a/28336473/108857
export SPACESHIP_ROOT=${${(%):-%x}:A:h}
fi
fi
# ------------------------------------------------------------------------------
# CONFIGURATION
# The default configuration that can be overridden in .zshrc
# ------------------------------------------------------------------------------
if [ -z "$SPACESHIP_PROMPT_ORDER" ]; then
SPACESHIP_PROMPT_ORDER=(
time # Time stampts section
user # Username section
dir # Current directory section
host # Hostname section
git # Git section (git_branch + git_status)
hg # Mercurial section (hg_branch + hg_status)
package # Package version
node # Node.js section
ruby # Ruby section
elm # Elm section
elixir # Elixir section
xcode # Xcode section
swift # Swift section
golang # Go section
php # PHP section
rust # Rust section
haskell # Haskell Stack section
julia # Julia section
docker # Docker section
aws # Amazon Web Services section
venv # virtualenv section
conda # conda virtualenv section
pyenv # Pyenv section
dotnet # .NET section
ember # Ember.js section
kubecontext # Kubectl context section
terraform # Terraform workspace section
exec_time # Execution time
line_sep # Line break
battery # Battery level and status
vi_mode # Vi-mode indicator
jobs # Background jobs indicator
exit_code # Exit code section
char # Prompt character
)
fi
if [ -z "$SPACESHIP_RPROMPT_ORDER" ]; then
SPACESHIP_RPROMPT_ORDER=(
# empty by default
)
fi
# PROMPT
SPACESHIP_PROMPT_ADD_NEWLINE="${SPACESHIP_PROMPT_ADD_NEWLINE=true}"
SPACESHIP_PROMPT_SEPARATE_LINE="${SPACESHIP_PROMPT_SEPARATE_LINE=true}"
SPACESHIP_PROMPT_FIRST_PREFIX_SHOW="${SPACESHIP_PROMPT_FIRST_PREFIX_SHOW=false}"
SPACESHIP_PROMPT_PREFIXES_SHOW="${SPACESHIP_PROMPT_PREFIXES_SHOW=true}"
SPACESHIP_PROMPT_SUFFIXES_SHOW="${SPACESHIP_PROMPT_SUFFIXES_SHOW=true}"
SPACESHIP_PROMPT_DEFAULT_PREFIX="${SPACESHIP_PROMPT_DEFAULT_PREFIX="via "}"
SPACESHIP_PROMPT_DEFAULT_SUFFIX="${SPACESHIP_PROMPT_DEFAULT_SUFFIX=" "}"
# ------------------------------------------------------------------------------
# LIBS
# Spaceship utils/hooks/etc
# ------------------------------------------------------------------------------
# Load utils
source "$SPACESHIP_ROOT/lib/utils.zsh"
# load hooks
source "$SPACESHIP_ROOT/lib/hooks.zsh"
# load section utils
source "$SPACESHIP_ROOT/lib/section.zsh"
# ------------------------------------------------------------------------------
# SECTIONS
# Sourcing sections the prompt consists of
# ------------------------------------------------------------------------------
for section in $(spaceship::union $SPACESHIP_PROMPT_ORDER $SPACESHIP_RPROMPT_ORDER); do
if [[ -f "$SPACESHIP_ROOT/sections/$section.zsh" ]]; then
source "$SPACESHIP_ROOT/sections/$section.zsh"
elif spaceship::defined "spaceship_$section"; then
# Custom section is declared, nothing else to do
continue
else
echo "Section '$section' have not been loaded."
fi
done
# ------------------------------------------------------------------------------
# BACKWARD COMPATIBILITY WARNINGS
# Show deprecation messages for options that are set, but not supported
# ------------------------------------------------------------------------------
spaceship::deprecated SPACESHIP_PROMPT_SYMBOL "Use %BSPACESHIP_CHAR_SYMBOL%b instead."
spaceship::deprecated SPACESHIP_BATTERY_ALWAYS_SHOW "Use %BSPACESHIP_BATTERY_SHOW='always'%b instead."
spaceship::deprecated SPACESHIP_BATTERY_CHARGING_SYMBOL "Use %BSPACESHIP_BATTERY_SYMBOL_CHARGING%b instead."
spaceship::deprecated SPACESHIP_BATTERY_DISCHARGING_SYMBOL "Use %BSPACESHIP_BATTERY_SYMBOL_DISCHARGING%b instead."
spaceship::deprecated SPACESHIP_BATTERY_FULL_SYMBOL "Use %BSPACESHIP_BATTERY_SYMBOL_FULL%b instead."
# ------------------------------------------------------------------------------
# PROMPTS
# An entry point of prompt
# ------------------------------------------------------------------------------
# PROMPT
# Primary (left) prompt
spaceship_prompt() {
# Retrieve exit code of last command to use in exit_code
# Must be captured before any other command in prompt is executed
# Must be the very first line in all entry prompt functions, or the value
# will be overridden by a different command execution - do not move this line!
RETVAL=$?
# Should it add a new line before the prompt?
[[ $SPACESHIP_PROMPT_ADD_NEWLINE == true ]] && echo -n "$NEWLINE"
spaceship::compose_prompt $SPACESHIP_PROMPT_ORDER
}
# $RPROMPT
# Optional (right) prompt
spaceship_rprompt() {
# Retrieve exit code of last command to use in exit_code
RETVAL=$?
spaceship::compose_prompt $SPACESHIP_RPROMPT_ORDER
}
# PS2
# Continuation interactive prompt
spaceship_ps2() {
# Retrieve exit code of last command to use in exit_code
RETVAL=$?
local char="${SPACESHIP_CHAR_SYMBOL_SECONDARY="$SPACESHIP_CHAR_SYMBOL"}"
spaceship::section "$SPACESHIP_CHAR_COLOR_SECONDARY" "$char"
}
# ------------------------------------------------------------------------------
# SETUP
# Setup requirements for prompt
# ------------------------------------------------------------------------------
# Runs once when user opens a terminal
# All preparation before drawing prompt should be done here
prompt_spaceship_setup() {
autoload -Uz vcs_info
autoload -Uz add-zsh-hook
# This variable is a magic variable used when loading themes with zsh's prompt
# function. It will ensure the proper prompt options are set.
prompt_opts=(cr percent sp subst)
# Borrowed from promptinit, sets the prompt options in case the prompt was not
# initialized via promptinit.
setopt noprompt{bang,cr,percent,subst} "prompt${^prompt_opts[@]}"
# Add exec_time hooks
add-zsh-hook preexec spaceship_exec_time_preexec_hook
add-zsh-hook precmd spaceship_exec_time_precmd_hook
# Disable python virtualenv environment prompt prefix
VIRTUAL_ENV_DISABLE_PROMPT=true
# Configure vcs_info helper for potential use in the future
add-zsh-hook precmd spaceship_exec_vcs_info_precmd_hook
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:git*' formats '%b'
# Expose Spaceship to environment variables
PROMPT='$(spaceship_prompt)'
PS2='$(spaceship_ps2)'
RPS1='$(spaceship_rprompt)'
}
# ------------------------------------------------------------------------------
# ENTRY POINT
# An entry point of prompt
# ------------------------------------------------------------------------------
# Pass all arguments to the spaceship_setup function
prompt_spaceship_setup "$@"

View File

@ -0,0 +1,100 @@
#!/usr/bin/env zsh
# Required for shunit2 to run correctly
setopt shwordsplit
SHUNIT_PARENT=$0
# ------------------------------------------------------------------------------
# SHUNIT2 HOOKS
# ------------------------------------------------------------------------------
oneTimeSetUp() {
export TERM="xterm-256color"
SPACESHIP_PROMPT_FIRST_PREFIX_SHOW=true
SPACESHIP_PROMPT_ADD_NEWLINE=false
SPACESHIP_PROMPT_ORDER=(char)
source spaceship.zsh
}
setUp() {
SPACESHIP_CHAR_PREFIX=""
SPACESHIP_CHAR_SUFFIX=""
SPACESHIP_CHAR_SYMBOL="➜ "
SPACESHIP_CHAR_COLOR_SUCCESS="green"
SPACESHIP_CHAR_COLOR_FAILURE="red"
SPACESHIP_CHAR_COLOR_SECONDARY="yellow"
}
oneTimeTearDown() {
unset SPACESHIP_PROMPT_FIRST_PREFIX_SHOW
unset SPACESHIP_PROMPT_ADD_NEWLINE
unset SPACESHIP_PROMPT_ORDER
}
tearDown() {
unset SPACESHIP_CHAR_PREFIX
unset SPACESHIP_CHAR_SUFFIX
unset SPACESHIP_CHAR_SYMBOL
unset SPACESHIP_CHAR_COLOR_SUCCESS
unset SPACESHIP_CHAR_COLOR_FAILURE
unset SPACESHIP_CHAR_COLOR_SECONDARY
}
# ------------------------------------------------------------------------------
# TEST CASES
# ------------------------------------------------------------------------------
test_char() {
SPACESHIP_CHAR_COLOR_SUCCESS=blue
local expected="%{%B%}%{%b%}%{%B%F{$SPACESHIP_CHAR_COLOR_SUCCESS}%}➜ %{%b%f%}%{%B%}%{%b%}"
local actual="$(spaceship_prompt)"
assertEquals "render char" "$expected" "$actual"
}
test_char_failure() {
SPACESHIP_CHAR_COLOR_FAILURE=yellow
local expected="%{%B%}%{%b%}%{%B%F{$SPACESHIP_CHAR_COLOR_FAILURE}%}➜ %{%b%f%}%{%B%}%{%b%}"
command false # this command should exit with non-zero code
local actual="$(spaceship_prompt)"
assertEquals "render char with failure" "$expected" "$actual"
}
test_char_symbol() {
SPACESHIP_CHAR_SYMBOL='-> '
local expected="%{%B%}%{%b%}%{%B%F{green}%}$SPACESHIP_CHAR_SYMBOL%{%b%f%}%{%B%}%{%b%}"
local actual="$(spaceship_prompt)"
assertEquals "render char with custom symbol" "$expected" "$actual"
}
test_char_prefix() {
SPACESHIP_CHAR_PREFIX='prefix'
SPACESHIP_CHAR_SUFFIX=''
local expected="%{%B%}$SPACESHIP_CHAR_PREFIX%{%b%}%{%B%F{green}%}➜ %{%b%f%}%{%B%}$SPACESHIP_CHAR_SUFFIX%{%b%}"
local actual="$(spaceship_prompt)"
assertEquals "render char with prefix" "$expected" "$actual"
}
test_char_suffix() {
SPACESHIP_CHAR_PREFIX=''
SPACESHIP_CHAR_SUFFIX='suffix'
local expected="%{%B%}$SPACESHIP_CHAR_PREFIX%{%b%}%{%B%F{green}%}➜ %{%b%f%}%{%B%}$SPACESHIP_CHAR_SUFFIX%{%b%}"
local actual="$(spaceship_prompt)"
assertEquals "render char with suffix" "$expected" "$actual"
}
# ------------------------------------------------------------------------------
# SHUNIT2
# Run tests with shunit2
# ------------------------------------------------------------------------------
source modules/shunit2/shunit2

View File

@ -0,0 +1,145 @@
#!/usr/bin/env zsh
# Required for shunit2 to run correctly
setopt shwordsplit
SHUNIT_PARENT=$0
# ------------------------------------------------------------------------------
# SHUNIT2 HOOKS
# ------------------------------------------------------------------------------
oneTimeSetUp() {
export TERM="xterm-256color"
SPACESHIP_PROMPT_FIRST_PREFIX_SHOW=true
SPACESHIP_PROMPT_ADD_NEWLINE=false
SPACESHIP_PROMPT_ORDER=(dir)
source spaceship.zsh
}
setUp() {
SPACESHIP_DIR_SHOW=true
SPACESHIP_DIR_PREFIX="in "
SPACESHIP_DIR_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"
SPACESHIP_DIR_TRUNC=3
SPACESHIP_DIR_TRUNC_REPO=true
SPACESHIP_DIR_COLOR="cyan"
}
oneTimeTearDown() {
unset SPACESHIP_PROMPT_FIRST_PREFIX_SHOW
unset SPACESHIP_PROMPT_ADD_NEWLINE
unset SPACESHIP_PROMPT_ORDER
}
tearDown() {
unset SPACESHIP_DIR_SHOW
unset SPACESHIP_DIR_PREFIX
unset SPACESHIP_DIR_SUFFIX
unset SPACESHIP_DIR_TRUNC
unset SPACESHIP_DIR_TRUNC_REPO
unset SPACESHIP_DIR_COLOR
}
# ------------------------------------------------------------------------------
# TEST CASES
# ------------------------------------------------------------------------------
test_dir_home() {
cd ~
local expected="%{%B%}in %{%b%}%{%B%F{$SPACESHIP_DIR_COLOR}%}%(4~||)%3~%{%b%f%}%{%B%} %{%b%}"
local actual="$(spaceship_prompt)"
assertEquals "render dir" "$expected" "$actual"
}
test_dir_color() {
SPACESHIP_DIR_COLOR=blue
local expected="%{%B%}in %{%b%}%{%B%F{$SPACESHIP_DIR_COLOR}%}%(4~||)%3~%{%b%f%}%{%B%} %{%b%}"
local actual="$(spaceship_prompt)"
assertEquals "render dir with custom color" "$expected" "$actual"
}
test_dir_prefix() {
SPACESHIP_DIR_PREFIX='prefix'
SPACESHIP_DIR_SUFFIX=''
local expected="%{%B%}$SPACESHIP_DIR_PREFIX%{%b%}%{%B%F{cyan}%}%(4~||)%3~%{%b%f%}%{%B%}$SPACESHIP_DIR_SUFFIX%{%b%}"
local actual="$(spaceship_prompt)"
assertEquals "render dir with prefix" "$expected" "$actual"
}
test_dir_suffix() {
SPACESHIP_DIR_PREFIX=''
SPACESHIP_DIR_SUFFIX='suffix'
local expected="%{%B%}$SPACESHIP_DIR_PREFIX%{%b%}%{%B%F{cyan}%}%(4~||)%3~%{%b%f%}%{%B%}$SPACESHIP_DIR_SUFFIX%{%b%}"
local actual="$(spaceship_prompt)"
assertEquals "render dir with suffix" "$expected" "$actual"
}
test_dir_trunc() {
SPACESHIP_DIR_TRUNC=2
local expected="%{%B%}in %{%b%}%{%B%F{cyan}%}%($((SPACESHIP_DIR_TRUNC+1))~||)%$SPACESHIP_DIR_TRUNC~%{%b%f%}%{%B%} %{%b%}"
local actual="$(spaceship_prompt)"
assertEquals "render truncated dir" "$expected" "$actual"
}
test_dir_trunc_git() {
local REPO="$SHUNIT_TMPDIR/dir/trunc_git/dir1/dir2/dir3"
mkdir -p $REPO/dir4/dir5
cd $REPO
command git init >/dev/null
cd $REPO/dir4/dir5
local expected="%{%B%}in %{%b%}%{%B%F{cyan}%}dir3/dir4/dir5%{%b%f%}%{%B%} %{%b%}"
local actual="$(spaceship_prompt)"
assertEquals "render truncated dir in git repos" "$expected" "$actual"
}
test_dir_trunc_git_submodule() {
local FOLDER="$SHUNIT_TMPDIR/dir/trunc_git_submodule"
local REPO="$FOLDER/dir1/dir2/dir3"
local SUBMODULE="$FOLDER/dir1/dir2/dir4"
mkdir -p $REPO
mkdir -p $SUBMODULE
cd $SUBMODULE
command git init >/dev/null
command touch sample.txt
command git add sample.txt >/dev/null
command git commit -m "Add sample file" >/dev/null
cd $REPO
command git init >/dev/null
command touch sample.txt
command git add sample.txt >/dev/null
command git commit -m "Add sample file" >/dev/null
command git submodule add $SUBMODULE 2&>/dev/null
cd dir4
local expected="%{%B%}in %{%b%}%{%B%F{cyan}%}dir4%{%b%f%}%{%B%} %{%b%}"
local actual="$(spaceship_prompt)"
assertEquals "render submodule dir in the git repo" "$expected" "$actual"
}
# ------------------------------------------------------------------------------
# SHUNIT2
# Run tests with shunit2
# ------------------------------------------------------------------------------
source modules/shunit2/shunit2

View File

@ -0,0 +1,136 @@
#!/usr/bin/env zsh
# Required for shunit2 to run correctly
setopt shwordsplit
SHUNIT_PARENT=$0
# ------------------------------------------------------------------------------
# SHUNIT2 HOOKS
# ------------------------------------------------------------------------------
oneTimeSetUp() {
export TERM="xterm-256color"
export PATH=$PWD/tests/stubs:$PATH
SPACESHIP_PROMPT_FIRST_PREFIX_SHOW=true
SPACESHIP_PROMPT_ADD_NEWLINE=false
SPACESHIP_PROMPT_ORDER=(elm)
source spaceship.zsh
}
setUp() {
SPACESHIP_ELM_SHOW=true
SPACESHIP_ELM_PREFIX="via "
SPACESHIP_ELM_SUFFIX=""
SPACESHIP_ELM_SYMBOL="🌳 "
SPACESHIP_ELM_COLOR="cyan"
cd $SHUNIT_TMPDIR
touch test.elm
}
oneTimeTearDown() {
unset SPACESHIP_PROMPT_FIRST_PREFIX_SHOW
unset SPACESHIP_PROMPT_ADD_NEWLINE
unset SPACESHIP_PROMPT_ORDER
}
tearDown() {
unset SPACESHIP_ELM_SHOW
unset SPACESHIP_ELM_PREFIX
unset SPACESHIP_ELM_SUFFIX
unset SPACESHIP_ELM_SYMBOL
unset SPACESHIP_ELM_COLOR
}
# ------------------------------------------------------------------------------
# TEST CASES
# ------------------------------------------------------------------------------
test_elm() {
local expected="%{%B%}via %{%b%}%{%B%F{cyan}%}🌳 v0.20.0%{%b%f%}%{%B%}%{%b%}"
local actual="$(spaceship_prompt)"
assertEquals "render elm" "$expected" "$actual"
}
test_elm_show_false() {
SPACESHIP_ELM_SHOW=false
local expected=""
local actual="$(spaceship_prompt)"
assertEquals "don't render elm" "$expected" "$actual"
}
test_elm_files() {
local expected="%{%B%}via %{%b%}%{%B%F{cyan}%}🌳 v0.20.0%{%b%f%}%{%B%}%{%b%}"
local actual="$(spaceship_prompt)"
assertEquals "render elm when test.elm exists" "$expected" "$actual"
rm test.elm
touch elm.json
local actual="$(spaceship_prompt)"
assertEquals "render elm when elm.json exists" "$expected" "$actual"
rm elm.json
touch elm-package.json
local actual="$(spaceship_prompt)"
assertEquals "render elm when elm-package.json exists" "$expected" "$actual"
rm elm-package.json
mkdir elm-stuff
local actual="$(spaceship_prompt)"
assertEquals "render elm when elm-stuff exists" "$expected" "$actual"
rm -r elm-stuff
local expected=""
local actual="$(spaceship_prompt)"
assertEquals "don't render when no elm files are present" "$expected" "$actual"
}
test_elm_symbol() {
SPACESHIP_ELM_SYMBOL="🌵 "
local expected="%{%B%}via %{%b%}%{%B%F{cyan}%}🌵 v0.20.0%{%b%f%}%{%B%}%{%b%}"
local actual="$(spaceship_prompt)"
assertEquals "render elm with custom symbol" "$expected" "$actual"
}
test_elm_prefix() {
SPACESHIP_ELM_PREFIX='prefix'
SPACESHIP_ELM_SUFFIX=''
local expected="%{%B%}prefix%{%b%}%{%B%F{cyan}%}🌳 v0.20.0%{%b%f%}%{%B%}%{%b%}"
local actual="$(spaceship_prompt)"
assertEquals "render elm with prefix" "$expected" "$actual"
}
test_elm_suffix() {
SPACESHIP_ELM_PREFIX=''
SPACESHIP_ELM_SUFFIX='suffix'
local expected="%{%B%}%{%b%}%{%B%F{cyan}%}🌳 v0.20.0%{%b%f%}%{%B%}suffix%{%b%}"
local actual="$(spaceship_prompt)"
assertEquals "render elm with suffix" "$expected" "$actual"
}
# ------------------------------------------------------------------------------
# SHUNIT2
# Run tests with shunit2
# ------------------------------------------------------------------------------
source modules/shunit2/shunit2

View File

@ -0,0 +1,91 @@
#!/usr/bin/env zsh
# Required for shunit2 to run correctly
setopt shwordsplit
SHUNIT_PARENT=$0
# ------------------------------------------------------------------------------
# SHUNIT2 HOOKS
# ------------------------------------------------------------------------------
oneTimeSetUp() {
export TERM="xterm-256color"
source lib/hooks.zsh
}
setUp() {
SPACESHIP_EXEC_TIME_SHOW=true
SPACESHIP_GIT_BRANCH_SHOW=true
}
tearDown() {
unset SPACESHIP_EXEC_TIME_SHOW
unset SPACESHIP_GIT_BRANCH_SHOW
}
# ------------------------------------------------------------------------------
# TEST CASES
# ------------------------------------------------------------------------------
test_exec_time_preexec_hook() {
local date_mock='123456'
date() { echo -n $date_mock }
local expected="$date_mock"
# Hook call should call `date` and save time to $SPACESHIP_EXEC_TIME_start
spaceship_exec_time_preexec_hook
assertEquals "should save starting time" "$date_mock" "$SPACESHIP_EXEC_TIME_start"
unset SPACESHIP_EXEC_TIME_start
SPACESHIP_EXEC_TIME_SHOW=false
spaceship_exec_time_preexec_hook
assertNull "should not call hook" "$SPACESHIP_EXEC_TIME_start"
}
test_exec_time_precmd_hook() {
local date_start_mock='123'
local date_stop_mock='321'
local date_duration_mock='198'
date() { echo -n $date_stop_mock }
SPACESHIP_EXEC_TIME_start="$date_start_mock"
spaceship_exec_time_precmd_hook
assertEquals "should calculate duration" "$date_duration_mock" "$SPACESHIP_EXEC_TIME_duration"
assertNull "$SPACESHIP_EXEC_TIME_start"
spaceship_exec_time_precmd_hook
assertNull "should not calculate without starting time" "$SPACESHIP_EXEC_TIME_duration"
SPACESHIP_EXEC_TIME_SHOW=false
SPACESHIP_EXEC_TIME_start="$date_start_mock"
spaceship_exec_time_precmd_hook
assertNull "should not calculate duration" "$SPACESHIP_EXEC_TIME_duration"
}
test_exec_vcs_info_precmd_hook() {
local info_mock="vcs_info"
vcs_info() { echo -n $info_mock }
local expected="$info_mock"
local actual="$(spaceship_exec_vcs_info_precmd_hook)"
assertEquals "call vcs_info" "$expected" "$actual"
SPACESHIP_GIT_BRANCH_SHOW=false
local expected_skip=""
local actual_skip="$(spaceship_exec_vcs_info_precmd_hook)"
assertEquals "should not call vcs_info hook" "$expected_skip" "$actual_skip"
}
# ------------------------------------------------------------------------------
# SHUNIT2
# Run tests with shunit2
# ------------------------------------------------------------------------------
source modules/shunit2/shunit2

View File

@ -0,0 +1,144 @@
#!/usr/bin/env zsh
# Required for shunit2 to run correctly
setopt shwordsplit
SHUNIT_PARENT=$0
# ------------------------------------------------------------------------------
# SHUNIT2 HOOKS
# ------------------------------------------------------------------------------
oneTimeSetUp() {
export TERM="xterm-256color"
SPACESHIP_PROMPT_FIRST_PREFIX_SHOW=true
SPACESHIP_PROMPT_ADD_NEWLINE=false
SPACESHIP_PROMPT_ORDER=(host)
source spaceship.zsh
}
setUp() {
SPACESHIP_HOST_SHOW=true
SPACESHIP_HOST_SHOW_FULL=false
SPACESHIP_HOST_PREFIX="at "
SPACESHIP_HOST_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"
SPACESHIP_HOST_COLOR="blue"
SPACESHIP_HOST_COLOR_SSH="green"
}
oneTimeTearDown() {
unset SPACESHIP_PROMPT_FIRST_PREFIX_SHOW
unset SPACESHIP_PROMPT_ADD_NEWLINE
unset SPACESHIP_PROMPT_ORDER
}
tearDown() {
unset SPACESHIP_HOST_SHOW
unset SPACESHIP_HOST_SHOW_FULL
unset SPACESHIP_HOST_PREFIX
unset SPACESHIP_HOST_SUFFIX
unset SPACESHIP_HOST_COLOR
unset SPACESHIP_HOST_COLOR_SSH
}
# ------------------------------------------------------------------------------
# TEST CASES
# ------------------------------------------------------------------------------
test_host() {
SPACESHIP_HOST_SHOW=true
unset SSH_CONNECTION
assertEquals "do not render host by default" "" "$(spaceship_prompt)"
}
test_host_show() {
local expected="%{%B%}at %{%b%}%{%B%F{$SPACESHIP_HOST_COLOR}%}%m%{%b%f%}%{%B%} %{%b%}"
local expected_full="%{%B%}at %{%b%}%{%B%F{$SPACESHIP_HOST_COLOR}%}%M%{%b%f%}%{%B%} %{%b%}"
local expected_ssh="%{%B%}at %{%b%}%{%B%F{$SPACESHIP_HOST_COLOR_SSH}%}%m%{%b%f%}%{%B%} %{%b%}"
local expected_ssh_full="%{%B%}at %{%b%}%{%B%F{$SPACESHIP_HOST_COLOR_SSH}%}%M%{%b%f%}%{%B%} %{%b%}"
SPACESHIP_HOST_SHOW=true
SSH_CONNECTION=''
SPACESHIP_HOST_SHOW_FULL=false
assertEquals "SHOW=true, SSH=false, FULL=false" "" "$(spaceship_prompt)"
SPACESHIP_HOST_SHOW_FULL=true
assertEquals "SHOW=true, SSH=false, FULL=true" "" "$(spaceship_prompt)"
SSH_CONNECTION='ssh'
SPACESHIP_HOST_SHOW_FULL=false
assertEquals "SHOW=true, SSH=true, FULL=false" "$expected_ssh" "$(spaceship_prompt)"
SPACESHIP_HOST_SHOW_FULL=true
assertEquals "SHOW=true, SSH=true, FULL=true" "$expected_ssh_full" "$(spaceship_prompt)"
SPACESHIP_HOST_SHOW=always
SSH_CONNECTION='ssh'
SPACESHIP_HOST_SHOW_FULL=false
assertEquals "SHOW=always, SSH=true, FULL=false" "$expected_ssh" "$(spaceship_prompt)"
SPACESHIP_HOST_SHOW_FULL=true
assertEquals "SHOW=always, SSH=true, FULL=true" "$expected_ssh_full" "$(spaceship_prompt)"
SSH_CONNECTION=''
SPACESHIP_HOST_SHOW_FULL=false
assertEquals "SHOW=always, SSH=false, FULL=false" "$expected" "$(spaceship_prompt)"
SPACESHIP_HOST_SHOW_FULL=true
assertEquals "SHOW=always, SSH=false, FULL=true" "$expected_full" "$(spaceship_prompt)"
SPACESHIP_HOST_SHOW=false
SSH_CONNECTION='ssh'
SPACESHIP_HOST_SHOW_FULL=false
assertEquals "SHOW=false, SSH=true, FULL=false" "" "$(spaceship_prompt)"
SPACESHIP_HOST_SHOW_FULL=true
assertEquals "SHOW=false, SSH=true, FULL=true" "" "$(spaceship_prompt)"
SSH_CONNECTION=''
SPACESHIP_HOST_SHOW_FULL=false
assertEquals "SHOW=false, SSH=false, FULL=false" "" "$(spaceship_prompt)"
SPACESHIP_HOST_SHOW_FULL=true
assertEquals "SHOW=false, SSH=false, FULL=true" "" "$(spaceship_prompt)"
unset SPACESHIP_HOST_SHOW_FULL
unset SSH_CONNECTION
}
test_host_color() {
SPACESHIP_HOST_SHOW=always # force user display
SPACESHIP_HOST_COLOR=blue
local expected="%{%B%}at %{%b%}%{%B%F{$SPACESHIP_HOST_COLOR}%}%m%{%b%f%}%{%B%} %{%b%}"
local actual="$(spaceship_prompt)"
assertEquals "render host with custom color" "$expected" "$actual"
}
test_host_prefix() {
SPACESHIP_HOST_SHOW=always # force user display
SPACESHIP_HOST_PREFIX='prefix'
SPACESHIP_HOST_SUFFIX=''
local expected="%{%B%}$SPACESHIP_HOST_PREFIX%{%b%}%{%B%F{blue}%}%m%{%b%f%}%{%B%}$SPACESHIP_HOST_SUFFIX%{%b%}"
local actual="$(spaceship_prompt)"
assertEquals "render host with prefix" "$expected" "$actual"
}
test_host_suffix() {
SPACESHIP_HOST_SHOW=always # force user display
SPACESHIP_HOST_PREFIX=''
SPACESHIP_HOST_SUFFIX='suffix'
local expected="%{%B%}$SPACESHIP_HOST_PREFIX%{%b%}%{%B%F{blue}%}%m%{%b%f%}%{%B%}$SPACESHIP_HOST_SUFFIX%{%b%}"
local actual="$(spaceship_prompt)"
assertEquals "render host with suffix" "$expected" "$actual"
}
# ------------------------------------------------------------------------------
# SHUNIT2
# Run tests with shunit2
# ------------------------------------------------------------------------------
source modules/shunit2/shunit2

View File

@ -0,0 +1,81 @@
#!/usr/bin/env zsh
# Required for shunit2 to run correctly
setopt shwordsplit
SHUNIT_PARENT=$0
# ------------------------------------------------------------------------------
# SHUNIT2 HOOKS
# ------------------------------------------------------------------------------
oneTimeSetUp() {
export TERM="xterm-256color"
source lib/utils.zsh
source lib/section.zsh
}
setUp() {
SPACESHIP_PROMPT_PREFIXES_SHOW=true
SPACESHIP_PROMPT_SUFFIXES_SHOW=true
}
tearDown() {
unset SPACESHIP_PROMPT_PREFIXES_SHOW
unset SPACESHIP_PROMPT_SUFFIXES_SHOW
}
# ------------------------------------------------------------------------------
# TEST CASES
# ------------------------------------------------------------------------------
test_section() {
local color="cyan" content="content" prefix="prefix" suffix="suffix"
local expected_none="%{%B%}%{%b%}%{%B%f%}%{%b%f%}%{%B%}%{%b%}"
local actual_none="$(spaceship::section)"
assertEquals "render section without arguments" "$expected_none" "$actual_none"
local expected_short="%{%B%}%{%b%}%{%B%F{$color}%}$content%{%b%f%}%{%B%}%{%b%}"
local actual_short="$(spaceship::section $color $content)"
assertEquals "render short section" "$expected_short" "$actual_short"
local expected_suffix="%{%B%}%{%b%}%{%B%F{$color}%}$content%{%b%f%}%{%B%}$suffix%{%b%}"
local actual_suffix="$(spaceship::section $color $prefix $content $suffix)"
assertEquals "render full section with suffix" "$expected_suffix" "$actual_suffix"
spaceship_prompt_opened=true
local expected="%{%B%}$prefix%{%b%}%{%B%F{$color}%}$content%{%b%f%}%{%B%}$suffix%{%b%}"
local actual="$(spaceship::section $color $prefix $content $suffix)"
assertEquals "render full section with prefix and suffix" "$expected" "$actual"
}
test_compose_prompt() {
spaceship_foo() { echo -n 'foo' }
spaceship_bar() { echo -n 'bar' }
local TEST_SPACESHIP_ORDER=(foo bar)
local expected="foobar"
local actual="$(spaceship::compose_prompt $TEST_SPACESHIP_ORDER)"
assertEquals "render spaceship sections" "$expected" "$actual"
local TEST_SPACESHIP_ORDER_NOT_FOUND=(foo bar baz)
local expected_not_found="foobar%{%B%}%{%b%}%{%B%F{red}%}'baz' not found%{%b%f%}%{%B%}%{%b%}"
local actual_not_found="$(spaceship::compose_prompt $TEST_SPACESHIP_ORDER_NOT_FOUND)"
assertEquals "render missing sections" "$expected_not_found" "$actual_not_found"
}
# ------------------------------------------------------------------------------
# SHUNIT2
# Run tests with shunit2
# ------------------------------------------------------------------------------
source modules/shunit2/shunit2

View File

@ -0,0 +1,3 @@
#!/usr/bin/env zsh
echo 0.20.0

View File

@ -0,0 +1,126 @@
#!/usr/bin/env zsh
# Required for shunit2 to run correctly
setopt shwordsplit
SHUNIT_PARENT=$0
# ------------------------------------------------------------------------------
# SHUNIT2 HOOKS
# ------------------------------------------------------------------------------
oneTimeSetUp() {
export TERM="xterm-256color"
SPACESHIP_PROMPT_ADD_NEWLINE=false
SPACESHIP_PROMPT_FIRST_PREFIX_SHOW=true
SPACESHIP_PROMPT_ORDER=(user)
source spaceship.zsh
}
setUp() {
SPACESHIP_USER_SHOW=true
SPACESHIP_USER_PREFIX="with "
SPACESHIP_USER_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"
SPACESHIP_USER_COLOR="yellow"
SPACESHIP_USER_COLOR_ROOT="red"
}
oneTimeTearDown() {
unset SPACESHIP_PROMPT_FIRST_PREFIX_SHOW
unset SPACESHIP_PROMPT_ADD_NEWLINE
unset SPACESHIP_PROMPT_ORDER
}
tearDown() {
unset SPACESHIP_USER_SHOW
unset SPACESHIP_USER_PREFIX
unset SPACESHIP_USER_SUFFIX
unset SPACESHIP_USER_COLOR
unset SPACESHIP_USER_COLOR_ROOT
}
# ------------------------------------------------------------------------------
# TEST CASES
# ------------------------------------------------------------------------------
test_user() {
local _user_="$USER"
USER='tests'
local expected="%{%B%}with %{%b%}%{%B%F{yellow}%}%n%{%b%f%}%{%B%} %{%b%}"
local actual="$(spaceship_prompt)"
assertEquals "render user when needed" "$expected" "$actual"
USER=$_user_
}
test_user_show() {
local expected="%{%B%}with %{%b%}%{%B%F{yellow}%}%n%{%b%f%}%{%B%} %{%b%}"
SPACESHIP_USER_SHOW=true
SSH_CONNECTION=''
assertEquals "SHOW=true, SSH=false" "" "$(spaceship_prompt)"
SSH_CONNECTION='ssh'
assertEquals "SHOW=true, SSH=true" "$expected" "$(spaceship_prompt)"
SPACESHIP_USER_SHOW=always
SSH_CONNECTION=''
assertEquals "SHOW=always, SSH=false" "$expected" "$(spaceship_prompt)"
SSH_CONNECTION='ssh'
assertEquals "SHOW=always, SSH=true" "$expected" "$(spaceship_prompt)"
SPACESHIP_USER_SHOW=false
SSH_CONNECTION=''
assertEquals "SHOW=false, SSH=false" "" "$(spaceship_prompt)"
SSH_CONNECTION='ssh'
assertEquals "SHOW=false, SSH=true" "" "$(spaceship_prompt)"
SPACESHIP_USER_SHOW=needed
SSH_CONNECTION=''
assertEquals "SHOW=needed, SSH=false" "" "$(spaceship_prompt)"
SSH_CONNECTION='ssh'
assertEquals "SHOW=needed, SSH=true" "" "$(spaceship_prompt)"
unset SSH_CONNECTION
}
test_user_color() {
SPACESHIP_USER_SHOW=always # force user display
SPACESHIP_USER_COLOR=green
local expected="%{%B%}with %{%b%}%{%B%F{$SPACESHIP_USER_COLOR}%}%n%{%b%f%}%{%B%} %{%b%}"
local actual="$(spaceship_prompt)"
assertEquals "render user with custom color" "$expected" "$actual"
}
test_user_prefix() {
SPACESHIP_USER_SHOW=always # force user display
SPACESHIP_USER_PREFIX='prefix'
SPACESHIP_USER_SUFFIX=''
local expected="%{%B%}$SPACESHIP_USER_PREFIX%{%b%}%{%B%F{yellow}%}%n%{%b%f%}%{%B%}$SPACESHIP_USER_SUFFIX%{%b%}"
local actual="$(spaceship_prompt)"
assertEquals "render user with prefix" "$expected" "$actual"
}
test_user_suffix() {
SPACESHIP_USER_SHOW=always # force user display
SPACESHIP_USER_PREFIX=''
SPACESHIP_USER_SUFFIX='suffix'
local expected="%{%B%}$SPACESHIP_USER_PREFIX%{%b%}%{%B%F{yellow}%}%n%{%b%f%}%{%B%}$SPACESHIP_USER_SUFFIX%{%b%}"
local actual="$(spaceship_prompt)"
assertEquals "render user with suffix" "$expected" "$actual"
}
# ------------------------------------------------------------------------------
# SHUNIT2
# Run tests with shunit2
# ------------------------------------------------------------------------------
source modules/shunit2/shunit2

View File

@ -0,0 +1,114 @@
#!/usr/bin/env zsh
# Required for shunit2 to run correctly
setopt shwordsplit
SHUNIT_PARENT=$0
# ------------------------------------------------------------------------------
# SHUNIT2 HOOKS
# ------------------------------------------------------------------------------
oneTimeSetUp() {
export TERM="xterm-256color"
source lib/utils.zsh
}
# ------------------------------------------------------------------------------
# TEST CASES
# ------------------------------------------------------------------------------
test_exists() {
mock() {}
assertTrue "command should exist" '$(spaceship::exists cd)'
assertFalse "command should not exist" '$(spaceship::exists d41d8cd)'
assertTrue "function should exist" '$(spaceship::exists mock)'
}
test_defined() {
mock() {}
assertFalse "command should not exist" '$(spaceship::defined cd)'
assertTrue "function should exist" '$(spaceship::defined mock)'
assertFalse "function should not exist" '$(spaceship::defined d41d8cd)'
}
test_is_git() {
local REPO="$SHUNIT_TMPDIR/utils/is_git"
mkdir -p $REPO/foo
cd $REPO
# Init a Git repo in $REPO
command git init > /dev/null
assertTrue "should be a git repo" '$(spaceship::is_git)'
cd foo
assertTrue "foo should be in git repo" '$(spaceship::is_git)'
cd ../..
assertFalse "should not be a git repo" '$(spaceship::is_git)'
}
test_is_hg() {
# Skip this test case if Mercurial is not istalled
if ! spaceship::exists hg; then
startSkipping
fi
local REPO="$SHUNIT_TMPDIR/utils/is_hg"
mkdir -p $REPO/foo
cd $REPO
if spaceship::exists hg; then
command hg init
fi
assertTrue "should be a hg repo" '$(spaceship::is_hg)'
cd foo
assertTrue "foo should be in hg repo" '$(spaceship::is_hg)'
cd ../..
assertFalse "should not be a hg repo" '$(spaceship::is_hg)'
if isSkipping; then
endSkipping
fi
}
test_deprecated() {
SPACESHIP_TEST='deprecated'
local e_expected="%{%B%}SPACESHIP_TEST%{%b%} is deprecated.%{ %}"
local expected="$(print -P "$e_expected")"
local actual=$(spaceship::deprecated SPACESHIP_TEST)
assertEquals "render deprecation warning" "$expected" "$actual"
local desc="Use SOMETHING instead!"
local e_expected=$e_expected$desc
local expected="$(print -P "$e_expected")"
local actual=$(spaceship::deprecated SPACESHIP_TEST "$desc")
assertEquals "render deprecation warning with description" "$expected" "$actual"
unset SPACESHIP_TEST
}
test_displaytime() {
local expected='14d 6h 56m 7s'
local actual=$(spaceship::displaytime 1234567)
assertEquals "$expected" "$actual"
}
test_union() {
local arr1=('a' 'b' 'c') arr2=('b' 'c' 'd') arr3=('c' 'd' 'e')
local expected=('a' 'b' 'c' 'd' 'e')
local actual=$(spaceship::union $arr1 $arr2 $arr3)
assertEquals "union of arrays" "$expected" "$actual"
}
# ------------------------------------------------------------------------------
# SHUNIT2
# Run tests with shunit2
# ------------------------------------------------------------------------------
source modules/shunit2/shunit2

View File

@ -0,0 +1 @@
434af7b11dd33641231f1b48b8432e68eb472e46

View File

@ -0,0 +1 @@
0.6.0

View File

@ -0,0 +1,107 @@
# -------------------------------------------------------------------------------------------------
# Copyright (c) 2010-2016 zsh-syntax-highlighting contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted
# provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this list of conditions
# and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice, this list of
# conditions and the following disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
# may be used to endorse or promote products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# -------------------------------------------------------------------------------------------------
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
# vim: ft=zsh sw=2 ts=2 et
# -------------------------------------------------------------------------------------------------
# Define default styles.
: ${ZSH_HIGHLIGHT_STYLES[bracket-error]:=fg=red,bold}
: ${ZSH_HIGHLIGHT_STYLES[bracket-level-1]:=fg=blue,bold}
: ${ZSH_HIGHLIGHT_STYLES[bracket-level-2]:=fg=green,bold}
: ${ZSH_HIGHLIGHT_STYLES[bracket-level-3]:=fg=magenta,bold}
: ${ZSH_HIGHLIGHT_STYLES[bracket-level-4]:=fg=yellow,bold}
: ${ZSH_HIGHLIGHT_STYLES[bracket-level-5]:=fg=cyan,bold}
: ${ZSH_HIGHLIGHT_STYLES[cursor-matchingbracket]:=standout}
# Whether the brackets highlighter should be called or not.
_zsh_highlight_highlighter_brackets_predicate()
{
[[ $WIDGET == zle-line-finish ]] || _zsh_highlight_cursor_moved || _zsh_highlight_buffer_modified
}
# Brackets highlighting function.
_zsh_highlight_highlighter_brackets_paint()
{
local char style
local -i bracket_color_size=${#ZSH_HIGHLIGHT_STYLES[(I)bracket-level-*]} buflen=${#BUFFER} level=0 matchingpos pos
local -A levelpos lastoflevel matching
# Find all brackets and remember which one is matching
for (( pos = 1; pos <= buflen; pos++ )) ; do
char=$BUFFER[pos]
case $char in
["([{"])
levelpos[$pos]=$((++level))
lastoflevel[$level]=$pos
;;
[")]}"])
matchingpos=$lastoflevel[$level]
levelpos[$pos]=$((level--))
if _zsh_highlight_brackets_match $matchingpos $pos; then
matching[$matchingpos]=$pos
matching[$pos]=$matchingpos
fi
;;
['"'\'])
# Skip everything inside quotes
pos=$BUFFER[(ib:pos+1:)$char]
;;
esac
done
# Now highlight all found brackets
for pos in ${(k)levelpos}; do
if (( $+matching[$pos] )); then
if (( bracket_color_size )); then
style=bracket-level-$(( (levelpos[$pos] - 1) % bracket_color_size + 1 ))
fi
else
style=bracket-error
fi
_zsh_highlight_add_highlight $((pos - 1)) $pos $style
done
# If cursor is on a bracket, then highlight corresponding bracket, if any.
if [[ $WIDGET != zle-line-finish ]]; then
pos=$((CURSOR + 1))
if [[ -n $levelpos[$pos] ]] && [[ -n $matching[$pos] ]]; then
local -i otherpos=$matching[$pos]
_zsh_highlight_add_highlight $((otherpos - 1)) $otherpos cursor-matchingbracket
fi
fi
}
# Helper function to differentiate type
_zsh_highlight_brackets_match()
{
case $BUFFER[$1] in
\() [[ $BUFFER[$2] == \) ]];;
\[) [[ $BUFFER[$2] == \] ]];;
\{) [[ $BUFFER[$2] == \} ]];;
*) false;;
esac
}

View File

@ -0,0 +1,47 @@
# -------------------------------------------------------------------------------------------------
# Copyright (c) 2010-2011 zsh-syntax-highlighting contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted
# provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this list of conditions
# and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice, this list of
# conditions and the following disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
# may be used to endorse or promote products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# -------------------------------------------------------------------------------------------------
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
# vim: ft=zsh sw=2 ts=2 et
# -------------------------------------------------------------------------------------------------
# Define default styles.
: ${ZSH_HIGHLIGHT_STYLES[cursor]:=standout}
# Whether the cursor highlighter should be called or not.
_zsh_highlight_highlighter_cursor_predicate()
{
# remove cursor highlighting when the line is finished
[[ $WIDGET == zle-line-finish ]] || _zsh_highlight_cursor_moved
}
# Cursor highlighting function.
_zsh_highlight_highlighter_cursor_paint()
{
[[ $WIDGET == zle-line-finish ]] && return
_zsh_highlight_add_highlight $CURSOR $(( $CURSOR + 1 )) cursor
}

View File

@ -0,0 +1,44 @@
# -------------------------------------------------------------------------------------------------
# Copyright (c) 2010-2011 zsh-syntax-highlighting contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted
# provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this list of conditions
# and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice, this list of
# conditions and the following disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
# may be used to endorse or promote products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# -------------------------------------------------------------------------------------------------
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
# vim: ft=zsh sw=2 ts=2 et
# -------------------------------------------------------------------------------------------------
# Define default styles.
: ${ZSH_HIGHLIGHT_STYLES[line]:=}
# Whether the root highlighter should be called or not.
_zsh_highlight_highlighter_line_predicate()
{
_zsh_highlight_buffer_modified
}
# root highlighting function.
_zsh_highlight_highlighter_line_paint()
{
_zsh_highlight_add_highlight 0 $#BUFFER line
}

View File

@ -0,0 +1,934 @@
# -------------------------------------------------------------------------------------------------
# Copyright (c) 2010-2016 zsh-syntax-highlighting contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted
# provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this list of conditions
# and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice, this list of
# conditions and the following disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
# may be used to endorse or promote products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# -------------------------------------------------------------------------------------------------
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
# vim: ft=zsh sw=2 ts=2 et
# -------------------------------------------------------------------------------------------------
# Define default styles.
: ${ZSH_HIGHLIGHT_STYLES[default]:=none}
: ${ZSH_HIGHLIGHT_STYLES[unknown-token]:=fg=red,bold}
: ${ZSH_HIGHLIGHT_STYLES[reserved-word]:=fg=yellow}
: ${ZSH_HIGHLIGHT_STYLES[suffix-alias]:=fg=green,underline}
: ${ZSH_HIGHLIGHT_STYLES[precommand]:=fg=green,underline}
: ${ZSH_HIGHLIGHT_STYLES[commandseparator]:=none}
: ${ZSH_HIGHLIGHT_STYLES[path]:=underline}
: ${ZSH_HIGHLIGHT_STYLES[path_pathseparator]:=}
: ${ZSH_HIGHLIGHT_STYLES[path_prefix_pathseparator]:=}
: ${ZSH_HIGHLIGHT_STYLES[globbing]:=fg=blue}
: ${ZSH_HIGHLIGHT_STYLES[history-expansion]:=fg=blue}
: ${ZSH_HIGHLIGHT_STYLES[single-hyphen-option]:=none}
: ${ZSH_HIGHLIGHT_STYLES[double-hyphen-option]:=none}
: ${ZSH_HIGHLIGHT_STYLES[back-quoted-argument]:=none}
: ${ZSH_HIGHLIGHT_STYLES[single-quoted-argument]:=fg=yellow}
: ${ZSH_HIGHLIGHT_STYLES[double-quoted-argument]:=fg=yellow}
: ${ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]:=fg=yellow}
: ${ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]:=fg=cyan}
: ${ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]:=fg=cyan}
: ${ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]:=fg=cyan}
: ${ZSH_HIGHLIGHT_STYLES[assign]:=none}
: ${ZSH_HIGHLIGHT_STYLES[redirection]:=none}
: ${ZSH_HIGHLIGHT_STYLES[comment]:=fg=black,bold}
: ${ZSH_HIGHLIGHT_STYLES[arg0]:=fg=green}
# Whether the highlighter should be called or not.
_zsh_highlight_highlighter_main_predicate()
{
# may need to remove path_prefix highlighting when the line ends
[[ $WIDGET == zle-line-finish ]] || _zsh_highlight_buffer_modified
}
# Helper to deal with tokens crossing line boundaries.
_zsh_highlight_main_add_region_highlight() {
integer start=$1 end=$2
shift 2
if (( $+argv[2] )); then
# Caller specified inheritance explicitly.
else
# Automate inheritance.
typeset -A fallback_of; fallback_of=(
alias arg0
suffix-alias arg0
builtin arg0
function arg0
command arg0
precommand arg0
hashed-command arg0
path_prefix path
# The path separator fallback won't ever be used, due to the optimisation
# in _zsh_highlight_main_highlighter_highlight_path_separators().
path_pathseparator path
path_prefix_pathseparator path_prefix
)
local needle=$1 value
while [[ -n ${value::=$fallback_of[$needle]} ]]; do
unset "fallback_of[$needle]" # paranoia against infinite loops
argv+=($value)
needle=$value
done
fi
# The calculation was relative to $PREBUFFER$BUFFER, but region_highlight is
# relative to $BUFFER.
(( start -= $#PREBUFFER ))
(( end -= $#PREBUFFER ))
(( end < 0 )) && return # having end<0 would be a bug
(( start < 0 )) && start=0 # having start<0 is normal with e.g. multiline strings
_zsh_highlight_add_highlight $start $end "$@"
}
# Get the type of a command.
#
# Uses the zsh/parameter module if available to avoid forks, and a
# wrapper around 'type -w' as fallback.
#
# Takes a single argument.
#
# The result will be stored in REPLY.
_zsh_highlight_main__type() {
if (( $+_zsh_highlight_main__command_type_cache )); then
REPLY=$_zsh_highlight_main__command_type_cache[(e)$1]
if [[ -n "$REPLY" ]]; then
return
fi
fi
if (( $#options_to_set )); then
setopt localoptions $options_to_set;
fi
unset REPLY
if zmodload -e zsh/parameter; then
if (( $+aliases[(e)$1] )); then
REPLY=alias
elif (( $+saliases[(e)${1##*.}] )); then
REPLY='suffix alias'
elif (( $reswords[(Ie)$1] )); then
REPLY=reserved
elif (( $+functions[(e)$1] )); then
REPLY=function
elif (( $+builtins[(e)$1] )); then
REPLY=builtin
elif (( $+commands[(e)$1] )); then
REPLY=command
# zsh 5.2 and older have a bug whereby running 'type -w ./sudo' implicitly
# runs 'hash ./sudo=/usr/local/bin/./sudo' (assuming /usr/local/bin/sudo
# exists and is in $PATH). Avoid triggering the bug, at the expense of
# falling through to the $() below, incurring a fork. (Issue #354.)
#
# The first disjunct mimics the isrelative() C call from the zsh bug.
elif { [[ $1 != */* ]] || is-at-least 5.3 } &&
! builtin type -w -- $1 >/dev/null 2>&1; then
REPLY=none
fi
fi
if ! (( $+REPLY )); then
REPLY="${$(LC_ALL=C builtin type -w -- $1 2>/dev/null)##*: }"
fi
if (( $+_zsh_highlight_main__command_type_cache )); then
_zsh_highlight_main__command_type_cache[(e)$1]=$REPLY
fi
}
# Check whether the first argument is a redirection operator token.
# Report result via the exit code.
_zsh_highlight_main__is_redirection() {
# A redirection operator token:
# - starts with an optional single-digit number;
# - then, has a '<' or '>' character;
# - is not a process substitution [<(...) or >(...)].
[[ $1 == (<0-9>|)(\<|\>)* ]] && [[ $1 != (\<|\>)$'\x28'* ]]
}
# Resolve alias.
#
# Takes a single argument.
#
# The result will be stored in REPLY.
_zsh_highlight_main__resolve_alias() {
if zmodload -e zsh/parameter; then
REPLY=${aliases[$arg]}
else
REPLY="${"$(alias -- $arg)"#*=}"
fi
}
# Check that the top of $braces_stack has the expected value. If it does, set
# the style according to $2; otherwise, set style=unknown-token.
#
# $1: character expected to be at the top of $braces_stack
# $2: assignment to execute it if matches
_zsh_highlight_main__stack_pop() {
if [[ $braces_stack[1] == $1 ]]; then
braces_stack=${braces_stack:1}
eval "$2"
else
style=unknown-token
fi
}
# Main syntax highlighting function.
_zsh_highlight_highlighter_main_paint()
{
## Before we even 'emulate -L', we must test a few options that would reset.
if [[ -o interactive_comments ]]; then
local interactive_comments= # set to empty
fi
if [[ -o ignore_braces ]] || eval '[[ -o ignore_close_braces ]] 2>/dev/null'; then
local right_brace_is_recognised_everywhere=false
else
local right_brace_is_recognised_everywhere=true
fi
if [[ -o path_dirs ]]; then
integer path_dirs_was_set=1
else
integer path_dirs_was_set=0
fi
if [[ -o multi_func_def ]]; then
integer multi_func_def=1
else
integer multi_func_def=0
fi
emulate -L zsh
setopt localoptions extendedglob bareglobqual
# At the PS3 prompt and in vared, highlight nothing.
#
# (We can't check this in _zsh_highlight_highlighter_main_predicate because
# if the predicate returns false, the previous value of region_highlight
# would be reused.)
if [[ $CONTEXT == (select|vared) ]]; then
return
fi
## Variable declarations and initializations
local start_pos=0 end_pos highlight_glob=true arg style
local in_array_assignment=false # true between 'a=(' and the matching ')'
typeset -a ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR
typeset -a ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS
typeset -a ZSH_HIGHLIGHT_TOKENS_CONTROL_FLOW
local -a options_to_set # used in callees
local buf="$PREBUFFER$BUFFER"
integer len="${#buf}"
integer pure_buf_len=$(( len - ${#PREBUFFER} )) # == $#BUFFER, used e.g. in *_check_path
# "R" for round
# "Q" for square
# "Y" for curly
# "D" for do/done
# "$" for 'end' (matches 'foreach' always; also used with cshjunkiequotes in repeat/while)
# "?" for 'if'/'fi'; also checked by 'elif'/'else'
# ":" for 'then'
local braces_stack
if (( path_dirs_was_set )); then
options_to_set+=( PATH_DIRS )
fi
unset path_dirs_was_set
ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR=(
'|' '||' ';' '&' '&&'
'|&'
'&!' '&|'
# ### 'case' syntax, but followed by a pattern, not by a command
# ';;' ';&' ';|'
)
ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS=(
'builtin' 'command' 'exec' 'nocorrect' 'noglob'
'pkexec' # immune to #121 because it's usually not passed --option flags
)
# Tokens that, at (naively-determined) "command position", are followed by
# a de jure command position. All of these are reserved words.
ZSH_HIGHLIGHT_TOKENS_CONTROL_FLOW=(
$'\x7b' # block
$'\x28' # subshell
'()' # anonymous function
'while'
'until'
'if'
'then'
'elif'
'else'
'do'
'time'
'coproc'
'!' # reserved word; unrelated to $histchars[1]
)
local -a match mbegin mend
# State machine
#
# The states are:
# - :start: Command word
# - :sudo_opt: A leading-dash option to sudo (such as "-u" or "-i")
# - :sudo_arg: The argument to a sudo leading-dash option that takes one,
# when given as a separate word; i.e., "foo" in "-u foo" (two
# words) but not in "-ufoo" (one word).
# - :regular: "Not a command word", and command delimiters are permitted.
# Mainly used to detect premature termination of commands.
# - :always: The word 'always' in the «{ foo } always { bar }» syntax.
#
# When the kind of a word is not yet known, $this_word / $next_word may contain
# multiple states. For example, after "sudo -i", the next word may be either
# another --flag or a command name, hence the state would include both :start:
# and :sudo_opt:.
#
# The tokens are always added with both leading and trailing colons to serve as
# word delimiters (an improvised array); [[ $x == *:foo:* ]] and x=${x//:foo:/}
# will DTRT regardless of how many elements or repetitions $x has..
#
# Handling of redirections: upon seeing a redirection token, we must stall
# the current state --- that is, the value of $this_word --- for two iterations
# (one for the redirection operator, one for the word following it representing
# the redirection target). Therefore, we set $in_redirection to 2 upon seeing a
# redirection operator, decrement it each iteration, and stall the current state
# when it is non-zero. Thus, upon reaching the next word (the one that follows
# the redirection operator and target), $this_word will still contain values
# appropriate for the word immediately following the word that preceded the
# redirection operator.
#
# The "the previous word was a redirection operator" state is not communicated
# to the next iteration via $next_word/$this_word as usual, but via
# $in_redirection. The value of $next_word from the iteration that processed
# the operator is discarded.
#
local this_word=':start:' next_word
integer in_redirection
# Processing buffer
local proc_buf="$buf"
for arg in ${interactive_comments-${(z)buf}} \
${interactive_comments+${(zZ+c+)buf}}; do
# Initialize $next_word.
if (( in_redirection )); then
(( --in_redirection ))
fi
if (( in_redirection == 0 )); then
# Initialize $next_word to its default value.
next_word=':regular:'
else
# Stall $next_word.
fi
# Initialize per-"simple command" [zshmisc(1)] variables:
#
# $already_added (see next paragraph)
# $style how to highlight $arg
# $in_array_assignment boolean flag for "between '(' and ')' of array assignment"
# $highlight_glob boolean flag for "'noglob' is in effect"
#
# $already_added is set to 1 to disable adding an entry to region_highlight
# for this iteration. Currently, that is done for "" and $'' strings,
# which add the entry early so escape sequences within the string override
# the string's color.
integer already_added=0
style=unknown-token
if [[ $this_word == *':start:'* ]]; then
in_array_assignment=false
if [[ $arg == 'noglob' ]]; then
highlight_glob=false
fi
fi
# Compute the new $start_pos and $end_pos, skipping over whitespace in $buf.
if [[ $arg == ';' ]] ; then
# We're looking for either a semicolon or a newline, whichever comes
# first. Both of these are rendered as a ";" (SEPER) by the ${(z)..}
# flag.
#
# We can't use the (Z+n+) flag because that elides the end-of-command
# token altogether, so 'echo foo\necho bar' (two commands) becomes
# indistinguishable from 'echo foo echo bar' (one command with three
# words for arguments).
local needle=$'[;\n]'
integer offset=$(( ${proc_buf[(i)$needle]} - 1 ))
(( start_pos += offset ))
(( end_pos = start_pos + $#arg ))
else
# The line was:
#
# integer offset=$(((len-start_pos)-${#${proc_buf##([[:space:]]|\\[[:space:]])#}}))
#
# - len-start_pos is length of current proc_buf; basically: initial length minus where
# we are, and proc_buf is chopped to the "where we are" (compare the "previous value
# of start_pos" below, and the len-(start_pos-offset) = len-start_pos+offset)
# - what's after main minus sign is: length of proc_buf without spaces at the beginning
# - so what the line actually did, was computing length of the spaces!
# - this can be done via (#b) flag, like below
if [[ "$proc_buf" = (#b)(#s)(([[:space:]]|\\[[:space:]])##)* ]]; then
# The first, outer parenthesis
integer offset="${#match[1]}"
else
integer offset=0
fi
((start_pos+=offset))
((end_pos=$start_pos+${#arg}))
fi
# Compute the new $proc_buf. We advance it
# (chop off characters from the beginning)
# beyond what end_pos points to, by skipping
# as many characters as end_pos was advanced.
#
# end_pos was advanced by $offset (via start_pos)
# and by $#arg. Note the `start_pos=$end_pos`
# below.
#
# As for the [,len]. We could use [,len-start_pos+offset]
# here, but to make it easier on eyes, we use len and
# rely on the fact that Zsh simply handles that. The
# length of proc_buf is len-start_pos+offset because
# we're chopping it to match current start_pos, so its
# length matches the previous value of start_pos.
#
# Why [,-1] is slower than [,length] isn't clear.
proc_buf="${proc_buf[offset + $#arg + 1,len]}"
# Handle the INTERACTIVE_COMMENTS option.
#
# We use the (Z+c+) flag so the entire comment is presented as one token in $arg.
if [[ -n ${interactive_comments+'set'} && $arg[1] == $histchars[3] ]]; then
if [[ $this_word == *(':regular:'|':start:')* ]]; then
style=comment
else
style=unknown-token # prematurely terminated
fi
_zsh_highlight_main_add_region_highlight $start_pos $end_pos $style
already_added=1
start_pos=$end_pos
continue
fi
# Analyse the current word.
if _zsh_highlight_main__is_redirection $arg ; then
# A '<' or '>', possibly followed by a digit
in_redirection=2
fi
# Special-case the first word after 'sudo'.
if (( ! in_redirection )); then
if [[ $this_word == *':sudo_opt:'* ]] && [[ $arg != -* ]]; then
this_word=${this_word//:sudo_opt:/}
fi
fi
# Parse the sudo command line
if (( ! in_redirection )); then
if [[ $this_word == *':sudo_opt:'* ]]; then
case "$arg" in
# Flag that requires an argument
'-'[Cgprtu]) this_word=${this_word//:start:/};
next_word=':sudo_arg:';;
# This prevents misbehavior with sudo -u -otherargument
'-'*) this_word=${this_word//:start:/};
next_word+=':start:';
next_word+=':sudo_opt:';;
*) ;;
esac
elif [[ $this_word == *':sudo_arg:'* ]]; then
next_word+=':sudo_opt:'
next_word+=':start:'
fi
fi
# The Great Fork: is this a command word? Is this a non-command word?
if [[ $this_word == *':always:'* && $arg == 'always' ]]; then
# try-always construct
style=reserved-word # de facto a reserved word, although not de jure
next_word=':start:'
elif [[ $this_word == *':start:'* ]] && (( in_redirection == 0 )); then # $arg is the command word
if [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS:#"$arg"} ]]; then
style=precommand
elif [[ "$arg" = "sudo" ]]; then
style=precommand
next_word=${next_word//:regular:/}
next_word+=':sudo_opt:'
next_word+=':start:'
else
_zsh_highlight_main_highlighter_expand_path $arg
local expanded_arg="$REPLY"
_zsh_highlight_main__type ${expanded_arg}
local res="$REPLY"
() {
# Special-case: command word is '$foo', like that, without braces or anything.
#
# That's not entirely correct --- if the parameter's value happens to be a reserved
# word, the parameter expansion will be highlighted as a reserved word --- but that
# incorrectness is outweighed by the usability improvement of permitting the use of
# parameters that refer to commands, functions, and builtins.
local -a match mbegin mend
local MATCH; integer MBEGIN MEND
if [[ $res == none ]] && (( ${+parameters} )) &&
[[ ${arg[1]} == \$ ]] && [[ ${arg:1} =~ ^([A-Za-z_][A-Za-z0-9_]*|[0-9]+)$ ]] &&
(( ${+parameters[${MATCH}]} ))
then
_zsh_highlight_main__type ${(P)MATCH}
res=$REPLY
fi
}
case $res in
reserved) # reserved word
style=reserved-word
case $arg in
($'\x7b')
braces_stack='Y'"$braces_stack"
;;
($'\x7d')
# We're at command word, so no need to check $right_brace_is_recognised_everywhere
_zsh_highlight_main__stack_pop 'Y' style=reserved-word
if [[ $style == reserved-word ]]; then
next_word+=':always:'
fi
;;
('do')
braces_stack='D'"$braces_stack"
;;
('done')
_zsh_highlight_main__stack_pop 'D' style=reserved-word
;;
('if')
braces_stack=':?'"$braces_stack"
;;
('then')
_zsh_highlight_main__stack_pop ':' style=reserved-word
;;
('elif')
if [[ ${braces_stack[1]} == '?' ]]; then
braces_stack=':'"$braces_stack"
else
style=unknown-token
fi
;;
('else')
if [[ ${braces_stack[1]} == '?' ]]; then
:
else
style=unknown-token
fi
;;
('fi')
_zsh_highlight_main__stack_pop '?' ""
;;
('foreach')
braces_stack='$'"$braces_stack"
;;
('end')
_zsh_highlight_main__stack_pop '$' style=reserved-word
;;
esac
;;
'suffix alias') style=suffix-alias;;
alias) () {
integer insane_alias
case $arg in
# Issue #263: aliases with '=' on their LHS.
#
# There are three cases:
#
# - Unsupported, breaks 'alias -L' output, but invokable:
('='*) :;;
# - Unsupported, not invokable:
(*'='*) insane_alias=1;;
# - The common case:
(*) :;;
esac
if (( insane_alias )); then
style=unknown-token
else
style=alias
_zsh_highlight_main__resolve_alias $arg
local alias_target="$REPLY"
[[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS:#"$alias_target"} && -z ${(M)ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS:#"$arg"} ]] && ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS+=($arg)
fi
}
;;
builtin) style=builtin;;
function) style=function;;
command) style=command;;
hashed) style=hashed-command;;
none) if _zsh_highlight_main_highlighter_check_assign; then
style=assign
if [[ $arg[-1] == '(' ]]; then
in_array_assignment=true
else
# assignment to a scalar parameter.
# (For array assignments, the command doesn't start until the ")" token.)
next_word+=':start:'
fi
elif [[ $arg[0,1] = $histchars[0,1] ]] && (( $#arg[0,2] == 2 )); then
style=history-expansion
elif [[ $arg[0,1] == $histchars[2,2] ]]; then
style=history-expansion
elif [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR:#"$arg"} ]]; then
if [[ $this_word == *':regular:'* ]]; then
# This highlights empty commands (semicolon follows nothing) as an error.
# Zsh accepts them, though.
style=commandseparator
else
style=unknown-token
fi
elif (( in_redirection == 2 )); then
style=redirection
elif [[ $arg[1,2] == '((' ]]; then
# Arithmetic evaluation.
#
# Note: prior to zsh-5.1.1-52-g4bed2cf (workers/36669), the ${(z)...}
# splitter would only output the '((' token if the matching '))' had
# been typed. Therefore, under those versions of zsh, BUFFER="(( 42"
# would be highlighted as an error until the matching "))" are typed.
#
# We highlight just the opening parentheses, as a reserved word; this
# is how [[ ... ]] is highlighted, too.
style=reserved-word
_zsh_highlight_main_add_region_highlight $start_pos $((start_pos + 2)) $style
already_added=1
if [[ $arg[-2,-1] == '))' ]]; then
_zsh_highlight_main_add_region_highlight $((end_pos - 2)) $end_pos $style
already_added=1
fi
elif [[ $arg == '()' ]]; then
# anonymous function
style=reserved-word
elif [[ $arg == $'\x28' ]]; then
# subshell
style=reserved-word
braces_stack='R'"$braces_stack"
elif [[ $arg == $'\x29' ]]; then
# end of subshell
_zsh_highlight_main__stack_pop 'R' style=reserved-word
else
if _zsh_highlight_main_highlighter_check_path; then
style=$REPLY
else
style=unknown-token
fi
fi
;;
*) _zsh_highlight_main_add_region_highlight $start_pos $end_pos arg0_$res arg0
already_added=1
;;
esac
fi
fi
if (( ! already_added )) && [[ $style == unknown-token ]] && # not handled by the 'command word' codepath
{ (( in_redirection )) || [[ $this_word == *':regular:'* ]] || [[ $this_word == *':sudo_opt:'* ]] || [[ $this_word == *':sudo_arg:'* ]] }
then # $arg is a non-command word
case $arg in
$'\x29') # subshell or end of array assignment
if $in_array_assignment; then
style=assign
in_array_assignment=false
next_word+=':start:'
else
_zsh_highlight_main__stack_pop 'R' style=reserved-word
fi;;
$'\x28\x29') # possibly a function definition
if (( multi_func_def )) || false # TODO: or if the previous word was a command word
then
next_word+=':start:'
fi
style=reserved-word
;;
$'\x7d') # right brace
#
# Parsing rule: # {
#
# Additionally, `tt(})' is recognized in any position if neither the
# tt(IGNORE_BRACES) option nor the tt(IGNORE_CLOSE_BRACES) option is set."""
if $right_brace_is_recognised_everywhere; then
_zsh_highlight_main__stack_pop 'Y' style=reserved-word
if [[ $style == reserved-word ]]; then
next_word+=':always:'
fi
else
# Fall through to the catchall case at the end.
fi
;|
'--'*) style=double-hyphen-option;;
'-'*) style=single-hyphen-option;;
"'"*) style=single-quoted-argument;;
'"'*) style=double-quoted-argument
_zsh_highlight_main_add_region_highlight $start_pos $end_pos $style
_zsh_highlight_main_highlighter_highlight_string
already_added=1
;;
\$\'*) style=dollar-quoted-argument
_zsh_highlight_main_add_region_highlight $start_pos $end_pos $style
_zsh_highlight_main_highlighter_highlight_dollar_string
already_added=1
;;
'`'*) style=back-quoted-argument;;
[$][*]) style=default;;
[*?]*|*[^\\][*?]*)
$highlight_glob && style=globbing || style=default;;
*) if false; then
elif [[ $arg = $'\x7d' ]] && $right_brace_is_recognised_everywhere; then
# was handled by the $'\x7d' case above
elif [[ $arg[0,1] = $histchars[0,1] ]] && (( $#arg[0,2] == 2 )); then
style=history-expansion
elif [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR:#"$arg"} ]]; then
if [[ $this_word == *':regular:'* ]]; then
style=commandseparator
else
style=unknown-token
fi
elif (( in_redirection == 2 )); then
style=redirection
else
if _zsh_highlight_main_highlighter_check_path; then
style=$REPLY
else
style=default
fi
fi
;;
esac
fi
if ! (( already_added )); then
_zsh_highlight_main_add_region_highlight $start_pos $end_pos $style
[[ $style == path || $style == path_prefix ]] && _zsh_highlight_main_highlighter_highlight_path_separators
fi
if [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR:#"$arg"} ]]; then
if [[ $arg == ';' ]] && $in_array_assignment; then
# literal newline inside an array assignment
next_word=':regular:'
else
next_word=':start:'
highlight_glob=true
fi
elif
[[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_CONTROL_FLOW:#"$arg"} && $this_word == *':start:'* ]] ||
[[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS:#"$arg"} && $this_word == *':start:'* ]]; then
next_word=':start:'
elif [[ $arg == "repeat" && $this_word == *':start:'* ]]; then
# skip the repeat-count word
in_redirection=2
# The redirection mechanism assumes $this_word describes the word
# following the redirection. Make it so.
#
# That word can be a command word with shortloops (`repeat 2 ls`)
# or a command separator (`repeat 2; ls` or `repeat 2; do ls; done`).
#
# The repeat-count word will be handled like a redirection target.
this_word=':start::regular:'
fi
start_pos=$end_pos
if (( in_redirection == 0 )); then
# This is the default/common codepath.
this_word=$next_word
else
# Stall $this_word.
fi
done
}
# Check if $arg is variable assignment
_zsh_highlight_main_highlighter_check_assign()
{
setopt localoptions extended_glob
[[ $arg == [[:alpha:]_][[:alnum:]_]#(|\[*\])(|[+])=* ]] ||
[[ $arg == [0-9]##(|[+])=* ]]
}
_zsh_highlight_main_highlighter_highlight_path_separators()
{
local pos style_pathsep
style_pathsep=${style}_pathseparator
[[ -z "$ZSH_HIGHLIGHT_STYLES[$style_pathsep]" || "$ZSH_HIGHLIGHT_STYLES[$style]" == "$ZSH_HIGHLIGHT_STYLES[$style_pathsep]" ]] && return 0
for (( pos = start_pos; $pos <= end_pos; pos++ )) ; do
if [[ $BUFFER[pos] == / ]]; then
_zsh_highlight_main_add_region_highlight $((pos - 1)) $pos $style_pathsep
fi
done
}
# Check if $arg is a path.
# If yes, return 0 and in $REPLY the style to use.
# Else, return non-zero (and the contents of $REPLY is undefined).
_zsh_highlight_main_highlighter_check_path()
{
_zsh_highlight_main_highlighter_expand_path $arg;
local expanded_path="$REPLY"
REPLY=path
[[ -z $expanded_path ]] && return 1
[[ -L $expanded_path ]] && return 0
[[ -e $expanded_path ]] && return 0
# Search the path in CDPATH
local cdpath_dir
for cdpath_dir in $cdpath ; do
[[ -e "$cdpath_dir/$expanded_path" ]] && return 0
done
# If dirname($arg) doesn't exist, neither does $arg.
[[ ! -d ${expanded_path:h} ]] && return 1
# If this word ends the buffer, check if it's the prefix of a valid path.
if [[ ${BUFFER[1]} != "-" && $pure_buf_len == $end_pos ]] &&
[[ $WIDGET != zle-line-finish ]]; then
local -a tmp
tmp=( ${expanded_path}*(N) )
(( $#tmp > 0 )) && REPLY=path_prefix && return 0
fi
# It's not a path.
return 1
}
# Highlight special chars inside double-quoted strings
_zsh_highlight_main_highlighter_highlight_string()
{
setopt localoptions noksharrays
local -a match mbegin mend
local MATCH; integer MBEGIN MEND
local i j k style
# Starting quote is at 1, so start parsing at offset 2 in the string.
for (( i = 2 ; i < end_pos - start_pos ; i += 1 )) ; do
(( j = i + start_pos - 1 ))
(( k = j + 1 ))
case "$arg[$i]" in
'$' ) style=dollar-double-quoted-argument
# Look for an alphanumeric parameter name.
if [[ ${arg:$i} =~ ^([A-Za-z_][A-Za-z0-9_]*|[0-9]+) ]] ; then
(( k += $#MATCH )) # highlight the parameter name
(( i += $#MATCH )) # skip past it
elif [[ ${arg:$i} =~ ^[{]([A-Za-z_][A-Za-z0-9_]*|[0-9]+)[}] ]] ; then
(( k += $#MATCH )) # highlight the parameter name and braces
(( i += $#MATCH )) # skip past it
elif [[ $arg[i+1] == '$' ]]; then
# $$ - pid
(( k += 1 )) # highlight both dollar signs
(( i += 1 )) # don't consider the second one as introducing another parameter expansion
elif [[ $arg[i+1] == [-#*@?] ]]; then
# $#, $*, $@, $?, $- - like $$ above
(( k += 1 )) # highlight both dollar signs
(( i += 1 )) # don't consider the second one as introducing another parameter expansion
elif [[ $arg[i+1] == $'\x28' ]]; then
# Highlight just the '$'.
else
continue
fi
;;
"\\") style=back-double-quoted-argument
if [[ \\\`\"\$${histchars[1]} == *$arg[$i+1]* ]]; then
(( k += 1 )) # Color following char too.
(( i += 1 )) # Skip parsing the escaped char.
else
continue
fi
;;
($histchars[1]) # ! - may be a history expansion
if [[ $arg[i+1] != ('='|$'\x28'|$'\x7b'|[[:blank:]]) ]]; then
style=history-expansion
else
continue
fi
;;
*) continue ;;
esac
_zsh_highlight_main_add_region_highlight $j $k $style
done
}
# Highlight special chars inside dollar-quoted strings
_zsh_highlight_main_highlighter_highlight_dollar_string()
{
setopt localoptions noksharrays
local -a match mbegin mend
local MATCH; integer MBEGIN MEND
local i j k style
local AA
integer c
# Starting dollar-quote is at 1:2, so start parsing at offset 3 in the string.
for (( i = 3 ; i < end_pos - start_pos ; i += 1 )) ; do
(( j = i + start_pos - 1 ))
(( k = j + 1 ))
case "$arg[$i]" in
"\\") style=back-dollar-quoted-argument
for (( c = i + 1 ; c <= end_pos - start_pos ; c += 1 )); do
[[ "$arg[$c]" != ([0-9xXuUa-fA-F]) ]] && break
done
AA=$arg[$i+1,$c-1]
# Matching for HEX and OCT values like \0xA6, \xA6 or \012
if [[ "$AA" =~ "^(x|X)[0-9a-fA-F]{1,2}"
|| "$AA" =~ "^[0-7]{1,3}"
|| "$AA" =~ "^u[0-9a-fA-F]{1,4}"
|| "$AA" =~ "^U[0-9a-fA-F]{1,8}"
]]; then
(( k += $#MATCH ))
(( i += $#MATCH ))
else
if (( $#arg > $i+1 )) && [[ $arg[$i+1] == [xXuU] ]]; then
# \x not followed by hex digits is probably an error
style=unknown-token
fi
(( k += 1 )) # Color following char too.
(( i += 1 )) # Skip parsing the escaped char.
fi
;;
*) continue ;;
esac
_zsh_highlight_main_add_region_highlight $j $k $style
done
}
# Called with a single positional argument.
# Perform filename expansion (tilde expansion) on the argument and set $REPLY to the expanded value.
#
# Does not perform filename generation (globbing).
_zsh_highlight_main_highlighter_expand_path()
{
(( $# == 1 )) || print -r -- >&2 "zsh-syntax-highlighting: BUG: _zsh_highlight_main_highlighter_expand_path: called without argument"
# The $~1 syntax normally performs filename generation, but not when it's on the right-hand side of ${x:=y}.
setopt localoptions nonomatch
unset REPLY
: ${REPLY:=${(Q)~1}}
}
# -------------------------------------------------------------------------------------------------
# Main highlighter initialization
# -------------------------------------------------------------------------------------------------
_zsh_highlight_main__precmd_hook() {
_zsh_highlight_main__command_type_cache=()
}
autoload -U add-zsh-hook
if add-zsh-hook precmd _zsh_highlight_main__precmd_hook 2>/dev/null; then
# Initialize command type cache
typeset -gA _zsh_highlight_main__command_type_cache
else
print -r -- >&2 'zsh-syntax-highlighting: Failed to load add-zsh-hook. Some speed optimizations will not be used.'
# Make sure the cache is unset
unset _zsh_highlight_main__command_type_cache
fi

View File

@ -0,0 +1,60 @@
# -------------------------------------------------------------------------------------------------
# Copyright (c) 2010-2011 zsh-syntax-highlighting contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted
# provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this list of conditions
# and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice, this list of
# conditions and the following disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
# may be used to endorse or promote products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# -------------------------------------------------------------------------------------------------
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
# vim: ft=zsh sw=2 ts=2 et
# -------------------------------------------------------------------------------------------------
# List of keyword and color pairs.
typeset -gA ZSH_HIGHLIGHT_PATTERNS
# Whether the pattern highlighter should be called or not.
_zsh_highlight_highlighter_pattern_predicate()
{
_zsh_highlight_buffer_modified
}
# Pattern syntax highlighting function.
_zsh_highlight_highlighter_pattern_paint()
{
setopt localoptions extendedglob
local pattern
for pattern in ${(k)ZSH_HIGHLIGHT_PATTERNS}; do
_zsh_highlight_pattern_highlighter_loop "$BUFFER" "$pattern"
done
}
_zsh_highlight_pattern_highlighter_loop()
{
# This does *not* do its job syntactically, sorry.
local buf="$1" pat="$2"
local -a match mbegin mend
local MATCH; integer MBEGIN MEND
if [[ "$buf" == (#b)(*)(${~pat})* ]]; then
region_highlight+=("$((mbegin[2] - 1)) $mend[2] $ZSH_HIGHLIGHT_PATTERNS[$pat]")
"$0" "$match[1]" "$pat"; return $?
fi
}

View File

@ -0,0 +1,44 @@
# -------------------------------------------------------------------------------------------------
# Copyright (c) 2010-2011 zsh-syntax-highlighting contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted
# provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this list of conditions
# and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice, this list of
# conditions and the following disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors
# may be used to endorse or promote products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# -------------------------------------------------------------------------------------------------
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
# vim: ft=zsh sw=2 ts=2 et
# -------------------------------------------------------------------------------------------------
# Define default styles.
: ${ZSH_HIGHLIGHT_STYLES[root]:=standout}
# Whether the root highlighter should be called or not.
_zsh_highlight_highlighter_root_predicate()
{
_zsh_highlight_buffer_modified
}
# root highlighting function.
_zsh_highlight_highlighter_root_paint()
{
if (( EUID == 0 )) { _zsh_highlight_add_highlight 0 $#BUFFER root }
}

Some files were not shown because too many files have changed in this diff Show More