Merging only @onaforeignshore's new date segment from #533.

This commit is contained in:
Ben Hilburn 2017-05-22 22:35:58 -04:00
parent 643e8372db
commit 5332c30430
3 changed files with 30 additions and 3 deletions

View File

@ -88,6 +88,7 @@ The segments that are currently available are:
* [`background_jobs`](#background_jobs) - Indicator for background jobs.
* [`battery`](#battery) - Current battery status.
* [`context`](#context) - Your username and host, conditionalized based on $USER and SSH status.
* [`date`](#date) - System date.
* [`dir`](#dir) - Your current working directory.
* `dir_writable` - Displays a lock icon, if you do not have write permissions on the current folder.
* [`disk_usage`](#disk_usage) - Disk usage of your current partition.
@ -330,6 +331,14 @@ end of the hostname.
|`POWERLEVEL9K_ALWAYS_SHOW_USER`|false|Always show the username, but conditionalize the hostname.|
|`POWERLEVEL9K_CONTEXT_TEMPLATE`|%n@%m|Default context prompt (username@machine). Refer to the [ZSH Documentation](http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html) for all possible expansions, including deeper host depths.|
##### date
The `date` segment shows the current system date.
| Variable | Default Value | Description |
|----------|---------------|-------------|
|`POWERLEVEL9K_DATE_FORMAT`|`%D{%d.%m.%y}`|[ZSH time format](http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html) to use in this segment.|
##### dir
The `dir` segment shows the current working directory. When using the "Awesome
@ -383,7 +392,7 @@ The `truncate_with_package_name` strategy gives your directory path relative to
}
```
the path shown would be `my-cool-project`. If you navigate to `$HOME/projects/my-project/src`, then the path shown would be `my-cool-project/src`. Please note that this currently looks for `.git` directory to determine the root of the project.
The path shown would be `my-cool-project`. If you navigate to `$HOME/projects/my-project/src`, then the path shown would be `my-cool-project/src`. Please note that this currently looks for `.git` directory to determine the root of the project.
If you want to customize the directory separator, you could set:
```zsh
@ -399,7 +408,6 @@ You can also customize the leading tilde character when you are in `$HOME` using
POWERLEVEL9K_HOME_FOLDER_ABBREVIATION="%F{red} $(print_icon 'HOME_ICON') %F{black}"
```
##### disk_usage
The `disk_usage` segment will show the usage level of the partition that your current working directory resides in. It can be configured with the following variables.
@ -502,6 +510,7 @@ segment, as well:
# Output time, date, and a symbol from the "Awesome Powerline Font" set
POWERLEVEL9K_TIME_FORMAT="%D{%H:%M:%S \uE868 %d.%m.%y}"
```
##### vcs
By default, the `vcs` segment will provide quite a bit of information. Further

View File

@ -84,6 +84,8 @@ case $POWERLEVEL9K_MODE in
LOCK_ICON $'\UE138' # 
EXECUTION_TIME_ICON $'\UE89C' # 
SSH_ICON '(ssh)'
DATE_ICON $'\uE184' # 
TIME_ICON $'\uE12E' # 
)
;;
'awesome-fontconfig')
@ -152,6 +154,8 @@ case $POWERLEVEL9K_MODE in
LOCK_ICON $'\UE138' # 
EXECUTION_TIME_ICON $'\uF253'
SSH_ICON '(ssh)'
DATE_ICON $'\uF073 ' # 
TIME_ICON $'\uF017 ' # 
)
;;
'nerdfont-complete'|'nerdfont-fontconfig')
@ -220,6 +224,8 @@ case $POWERLEVEL9K_MODE in
LOCK_ICON $'\UF023' # 
EXECUTION_TIME_ICON $'\uF252' # 
SSH_ICON $'\uF489' # 
DATE_ICON $'\uF073 ' # 
TIME_ICON $'\uF017 ' # 
)
;;
*)
@ -288,6 +294,8 @@ case $POWERLEVEL9K_MODE in
LOCK_ICON $'\UE0A2'
EXECUTION_TIME_ICON 'Dur'
SSH_ICON '(ssh)'
DATE_ICON $'' #
TIME_ICON $'' #
)
;;
esac

View File

@ -1130,6 +1130,16 @@ build_test_stats() {
(( ratio < 50 )) && "$1_prompt_segment" "$2_BAD" "$3" "red" "$DEFAULT_COLOR" "$headline: $ratio%%" "$6"
}
# System date
prompt_date() {
local date_format "%D{%d.%m.%y}"
if [[ -n "$POWERLEVEL9K_DATE_FORMAT" ]]; then
date_format="$POWERLEVEL9K_DATE_FORMAT"
fi
"$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR_INVERTED" "$DEFAULT_COLOR" "${date_format}" "DATE_ICON"
}
# System time
prompt_time() {
local time_format="%D{%H:%M:%S}"
@ -1137,7 +1147,7 @@ prompt_time() {
time_format="$POWERLEVEL9K_TIME_FORMAT"
fi
"$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR_INVERTED" "$DEFAULT_COLOR" "$time_format"
"$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR_INVERTED" "$DEFAULT_COLOR" "$time_format" "TIME_ICON"
}
# todo.sh: shows the number of tasks in your todo.sh file