From ded682420b5681604ebff1a83eca3d864a459fdb Mon Sep 17 00:00:00 2001 From: Benoit GALATI Date: Wed, 2 Mar 2016 17:14:34 +0100 Subject: [PATCH 01/94] Fix typo about Symfony2 in README --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c04f5620..80e4d95e 100644 --- a/README.md +++ b/README.md @@ -103,8 +103,8 @@ The segments that are currently available are: * [rspec_stats](#rspec_stats) - Show a ratio of test classes vs code classes for RSpec. * **rust_version** - Display the current rust version. * [status](#status) - The return code of the previous command. -* [symphony2_tests](#symphony2_tests) - Show a ratio of test classes vs code classes for Symfony2. -* **symphony2_version** - Show the current Symfony2 version, if you are in a Symfony2-Project dir. +* [symfony2_tests](#symfony2_tests) - Show a ratio of test classes vs code classes for Symfony2. +* **symfony2_version** - Show the current Symfony2 version, if you are in a Symfony2-Project dir. * [time](#time) - System time. * [todo](http://todotxt.com/) - Shows the number of tasks in your todo.txt tasks file. * [vi_mode](#vi_mode)- Vi editing mode (NORMAL|INSERT). @@ -262,7 +262,7 @@ This segment shows the return code of the last command. |----------|---------------|-------------| |`POWERLEVEL9K_RAM_ELEMENTS`|Both|Specify `ram_free` or `swap_used` to only show one or the other rather than both.| -##### symphony2_tests +##### symfony2_tests See [Unit Test Ratios](#unit-test-ratios), below. From cd5c2e7dcde9adbf70776eba06ea235195fe3cdb Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Thu, 3 Mar 2016 13:30:58 -0800 Subject: [PATCH 02/94] trying to debug color code that won't deref in `vcs_states` --- powerlevel9k.zsh-theme | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index d573f6f9..25ecd968 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -769,8 +769,9 @@ prompt_vcs() { typeset -AH vcs_states vcs_states=( 'clean' 'green' - 'modified' 'red' - 'untracked' 'yellow' + 'modified' 'yellow' + 'untracked' 'green' + 'actionformat' 'red' ) VCS_CHANGESET_PREFIX='' @@ -790,7 +791,8 @@ prompt_vcs() { VCS_DEFAULT_FORMAT="$VCS_CHANGESET_PREFIX%b%c%u%m" zstyle ':vcs_info:*' formats "$VCS_DEFAULT_FORMAT" - zstyle ':vcs_info:*' actionformats "%b %F{red}| %a%f" + zstyle ':vcs_info:*' actionformats "%b %F{${vcs_states['actionformat']}}| %a%f" + # zstyle ':vcs_info:*' actionformats "%b %F{red}| %a%f" zstyle ':vcs_info:*' stagedstr " $(print_icon 'VCS_STAGED_ICON')" zstyle ':vcs_info:*' unstagedstr " $(print_icon 'VCS_UNSTAGED_ICON')" From 9d8041fc7669fc539a4d7afecbe9d2d6024d30ba Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Thu, 3 Mar 2016 13:58:42 -0800 Subject: [PATCH 03/94] Fixed actionformat color coding --- powerlevel9k.zsh-theme | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 25ecd968..72d37318 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -791,8 +791,7 @@ prompt_vcs() { VCS_DEFAULT_FORMAT="$VCS_CHANGESET_PREFIX%b%c%u%m" zstyle ':vcs_info:*' formats "$VCS_DEFAULT_FORMAT" - zstyle ':vcs_info:*' actionformats "%b %F{${vcs_states['actionformat']}}| %a%f" - # zstyle ':vcs_info:*' actionformats "%b %F{red}| %a%f" + zstyle ':vcs_info:*' actionformats "%b %F{${vcs_states[actionformat]}}| %a%f" zstyle ':vcs_info:*' stagedstr " $(print_icon 'VCS_STAGED_ICON')" zstyle ':vcs_info:*' unstagedstr " $(print_icon 'VCS_UNSTAGED_ICON')" From 415194941cdce3b6aec97e7f147d2f07a93dbd70 Mon Sep 17 00:00:00 2001 From: Sudarshan Wadkar Date: Fri, 4 Mar 2016 15:44:58 -0500 Subject: [PATCH 04/94] [WIP] Rebase to origin:next branch --- powerlevel9k.zsh-theme | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 72d37318..2ef4fe3c 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -622,6 +622,17 @@ prompt_rbenv() { fi } +# chruby information +# see https://github.com/postmodern/chruby/issues/245 for chruby_auto issue with ZSH +prompt_chruby() { + local chruby_env + chrb_env="$(chruby 2> /dev/null | grep \* | tr -d '* ')" + # Don't show anything if the chruby did not change the default ruby + if [[ "${chrb_env:-system}" != "system" ]]; then + "$1_prompt_segment" "$0" "$2" "red" "$DEFAULT_COLOR" "${chrb_env}" 'RUBY_ICON' + fi +} + # Print an icon if user is root. prompt_root_indicator() { if [[ "$UID" -eq 0 ]]; then From 88fd11a8657eaefa5477d07538dbbbc24b905d2c Mon Sep 17 00:00:00 2001 From: Sudarshan Wadkar Date: Fri, 4 Mar 2016 15:52:51 -0500 Subject: [PATCH 05/94] Update README.md with `chruby` prompt info --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 353f48ad..14ea5378 100644 --- a/README.md +++ b/README.md @@ -100,7 +100,8 @@ The segments that are currently available are: * **os_icon** - Display a nice little icon, depending on your operating system. * **php_version** - Show the current PHP version. * **ram** - Show free RAM -* [rbenv](#rbenv) - Ruby environment information (if one is active). +* [rbenv](#rbenv) - Ruby environment information using `rbenv` (if one is active). +* [chruby](#chruby) - Ruby environment information using `chruby` (if one is active; also, see postmodern/chruby#245 for issue with auto switching of ruby). * **root_indicator** - An indicator if the user is root. * [rspec_stats](#rspec_stats) - Show a ratio of test classes vs code classes for RSpec. * **rust_version** - Display the current rust version. From c30a13e467da16ca24cd62a123e2c43c69236fcb Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Sat, 5 Mar 2016 15:48:44 -0500 Subject: [PATCH 06/94] readme: re-organizing the segment list --- README.md | 55 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 14ea5378..9ab28c4a 100644 --- a/README.md +++ b/README.md @@ -83,38 +83,53 @@ your `~/.zshrc`: #### Available Prompt Segments The segments that are currently available are: -* [aws](#aws) - The current AWS profile, if active. -* **aws_eb_env** - The current Elastic Beanstalk Environment. +**System Status Segments:** * [background_jobs](#background_jobs) - Indicator for background jobs. * [battery](#battery) - Current battery status. * [context](#context) - Your username and host. -* [custom_command](#custom_command) - A custom command to display the output of. * [dir](#dir) - Your current working directory. -* **go_version** - Show the current GO version. * **history** - The command number for the current line. * [ip](#ip) - Shows the current IP address. -* **load** - Your machines 5 minute load average. -* **node_version** - Show the version number of the installed Node.js. -* **nodeenv** - [nodeenv](https://github.com/ekalinin/nodeenv) prompt for displaying node version and environment name. -* **nvm** - Show the version of Node that is currently active, if it differs from the version used by NVM +* **load** - Your machine's load averages. * **os_icon** - Display a nice little icon, depending on your operating system. -* **php_version** - Show the current PHP version. -* **ram** - Show free RAM -* [rbenv](#rbenv) - Ruby environment information using `rbenv` (if one is active). -* [chruby](#chruby) - Ruby environment information using `chruby` (if one is active; also, see postmodern/chruby#245 for issue with auto switching of ruby). -* **root_indicator** - An indicator if the user is root. -* [rspec_stats](#rspec_stats) - Show a ratio of test classes vs code classes for RSpec. -* **rust_version** - Display the current rust version. +* **ram** - Show free RAM. +* **root_indicator** - An indicator if the user has superuser status. * [status](#status) - The return code of the previous command. * **swap** - Prints the current swap size. -* [symfony2_tests](#symfony2_tests) - Show a ratio of test classes vs code classes for Symfony2. -* **symfony2_version** - Show the current Symfony2 version, if you are in a Symfony2-Project dir. * [time](#time) - System time. -* [todo](http://todotxt.com/) - Shows the number of tasks in your todo.txt tasks file. -* [vi_mode](#vi_mode)- Vi editing mode (NORMAL|INSERT). -* **virtualenv** - Your Python [VirtualEnv](https://virtualenv.pypa.io/en/latest/). +* [vi_mode](#vi_mode)- Your prompt's Vi editing mode (NORMAL|INSERT). + +**Development Environment Segments:** * [vcs](#vcs) - Information about this `git` or `hg` repository (if you are in one). +**Language Segments:** +* **go_version** - Show the current GO version. +* **Javascript / Node.js Segments:** + * **node_version** - Show the version number of the installed Node.js. + * **nodeenv** - [nodeenv](https://github.com/ekalinin/nodeenv) prompt for displaying node version and environment name. + * **nvm** - Show the version of Node that is currently active, if it differs from the version used by NVM +* **PHP Segmenst:** + * **php_version** - Show the current PHP version. + * [symfony2_tests](#symfony2_tests) - Show a ratio of test classes vs code classes for Symfony2. + * **symfony2_version** - Show the current Symfony2 version, if you are in a Symfony2-Project dir. +* **Python Segments:** + * **virtualenv** - Your Python [VirtualEnv](https://virtualenv.pypa.io/en/latest/). +* **Ruby Segments:** + * [chruby](#chruby) - Ruby environment information using `chruby` (if one is active). + * [rbenv](#rbenv) - Ruby environment information using `rbenv` (if one is active). + * [rspec_stats](#rspec_stats) - Show a ratio of test classes vs code classes for RSpec. +* **rust_version** - Display the current rust version. + +**Cloud Segments:** +* **AWS Segments:** + * [aws](#aws) - The current AWS profile, if active. + * **aws_eb_env** - The current Elastic Beanstalk Environment. + +**Other:** +* [custom_command](#custom_command) - Create a custom segment to display the + output of an arbitrary command. +* [todo](http://todotxt.com/) - Shows the number of tasks in your todo.txt tasks file. + ##### aws From 4e28720021e11a04379de9ac545d87c76abe8168 Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Sat, 5 Mar 2016 16:02:51 -0500 Subject: [PATCH 07/94] readme: testing code-as-link in MD code --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9ab28c4a..2ca20513 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ your `~/.zshrc`: The segments that are currently available are: **System Status Segments:** -* [background_jobs](#background_jobs) - Indicator for background jobs. +* [`background_jobs`](#background_jobs) - Indicator for background jobs. * [battery](#battery) - Current battery status. * [context](#context) - Your username and host. * [dir](#dir) - Your current working directory. @@ -108,7 +108,7 @@ The segments that are currently available are: * **node_version** - Show the version number of the installed Node.js. * **nodeenv** - [nodeenv](https://github.com/ekalinin/nodeenv) prompt for displaying node version and environment name. * **nvm** - Show the version of Node that is currently active, if it differs from the version used by NVM -* **PHP Segmenst:** +* **PHP Segments:** * **php_version** - Show the current PHP version. * [symfony2_tests](#symfony2_tests) - Show a ratio of test classes vs code classes for Symfony2. * **symfony2_version** - Show the current Symfony2 version, if you are in a Symfony2-Project dir. From b305b1ccd2d57bdc6ab45a4a62c182d2c798e668 Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Sat, 5 Mar 2016 16:07:03 -0500 Subject: [PATCH 08/94] readme: code-as-links transition in segment list --- README.md | 60 +++++++++++++++++++++++++++---------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 2ca20513..991dbd14 100644 --- a/README.md +++ b/README.md @@ -85,50 +85,50 @@ The segments that are currently available are: **System Status Segments:** * [`background_jobs`](#background_jobs) - Indicator for background jobs. -* [battery](#battery) - Current battery status. -* [context](#context) - Your username and host. -* [dir](#dir) - Your current working directory. -* **history** - The command number for the current line. -* [ip](#ip) - Shows the current IP address. -* **load** - Your machine's load averages. -* **os_icon** - Display a nice little icon, depending on your operating system. -* **ram** - Show free RAM. -* **root_indicator** - An indicator if the user has superuser status. -* [status](#status) - The return code of the previous command. -* **swap** - Prints the current swap size. -* [time](#time) - System time. -* [vi_mode](#vi_mode)- Your prompt's Vi editing mode (NORMAL|INSERT). +* [`battery`](#battery) - Current battery status. +* [`context`](#context) - Your username and host. +* [`dir`](#dir) - Your current working directory. +* `history` - The command number for the current line. +* [`ip`](#ip) - Shows the current IP address. +* `load` - Your machine's load averages. +* `os_icon` - Display a nice little icon, depending on your operating system. +* `ram` - Show free RAM. +* `root_indicator` - An indicator if the user has superuser status. +* [`status`](#status) - The return code of the previous command. +* `swap` - Prints the current swap size. +* [`time`](#time) - System time. +* [`vi_mode`](#vi_mode)- Your prompt's Vi editing mode (NORMAL|INSERT). **Development Environment Segments:** -* [vcs](#vcs) - Information about this `git` or `hg` repository (if you are in one). +* [`vcs`](#vcs) - Information about this `git` or `hg` repository (if you are in one). **Language Segments:** -* **go_version** - Show the current GO version. +* `go_version` - Show the current GO version. * **Javascript / Node.js Segments:** - * **node_version** - Show the version number of the installed Node.js. - * **nodeenv** - [nodeenv](https://github.com/ekalinin/nodeenv) prompt for displaying node version and environment name. - * **nvm** - Show the version of Node that is currently active, if it differs from the version used by NVM + * `node_version` - Show the version number of the installed Node.js. + * `nodeenv` - [nodeenv](https://github.com/ekalinin/nodeenv) prompt for displaying node version and environment name. + * `nvm` - Show the version of Node that is currently active, if it differs from the version used by NVM * **PHP Segments:** - * **php_version** - Show the current PHP version. - * [symfony2_tests](#symfony2_tests) - Show a ratio of test classes vs code classes for Symfony2. - * **symfony2_version** - Show the current Symfony2 version, if you are in a Symfony2-Project dir. + * `php_version` - Show the current PHP version. + * [`symfony2_tests`](#symfony2_tests) - Show a ratio of test classes vs code classes for Symfony2. + * `symfony2_version` - Show the current Symfony2 version, if you are in a Symfony2-Project dir. * **Python Segments:** - * **virtualenv** - Your Python [VirtualEnv](https://virtualenv.pypa.io/en/latest/). + * `virtualenv` - Your Python [VirtualEnv](https://virtualenv.pypa.io/en/latest/). * **Ruby Segments:** - * [chruby](#chruby) - Ruby environment information using `chruby` (if one is active). - * [rbenv](#rbenv) - Ruby environment information using `rbenv` (if one is active). - * [rspec_stats](#rspec_stats) - Show a ratio of test classes vs code classes for RSpec. -* **rust_version** - Display the current rust version. + * [`chruby`](#chruby) - Ruby environment information using `chruby` (if one is active). + * [`rbenv`](#rbenv) - Ruby environment information using `rbenv` (if one is active). + * [`rspec_stats`](#rspec_stats) - Show a ratio of test classes vs code classes for RSpec. +* `rust_version` - Display the current rust version. **Cloud Segments:** * **AWS Segments:** - * [aws](#aws) - The current AWS profile, if active. - * **aws_eb_env** - The current Elastic Beanstalk Environment. + * [`aws`](#aws) - The current AWS profile, if active. + * `aws_eb_env` - The current Elastic Beanstalk Environment. **Other:** -* [custom_command](#custom_command) - Create a custom segment to display the +* [`custom_command`](#custom_command) - Create a custom segment to display the output of an arbitrary command. -* [todo](http://todotxt.com/) - Shows the number of tasks in your todo.txt tasks file. +* [`todo`](http://todotxt.com/) - Shows the number of tasks in your todo.txt tasks file. ##### aws From 8e499946b254c93ec3fed87ccb1dc41cd8e9fbd5 Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Sat, 5 Mar 2016 16:08:14 -0500 Subject: [PATCH 09/94] readme: add horizontal bar --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 991dbd14..30ef1c9b 100644 --- a/README.md +++ b/README.md @@ -130,6 +130,8 @@ The segments that are currently available are: output of an arbitrary command. * [`todo`](http://todotxt.com/) - Shows the number of tasks in your todo.txt tasks file. +--------------------------------------------------------------------------------- + ##### aws From d0e9baf45390ed8b4d9ae3ca007da526c4eb4f12 Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Sat, 5 Mar 2016 16:09:46 -0500 Subject: [PATCH 10/94] readme: more touchup to the segment list --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 30ef1c9b..d46a8dea 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,8 @@ The segments that are currently available are: * [`vcs`](#vcs) - Information about this `git` or `hg` repository (if you are in one). **Language Segments:** -* `go_version` - Show the current GO version. +* **GoLang Segments:** + * `go_version` - Show the current GO version. * **Javascript / Node.js Segments:** * `node_version` - Show the version number of the installed Node.js. * `nodeenv` - [nodeenv](https://github.com/ekalinin/nodeenv) prompt for displaying node version and environment name. @@ -118,7 +119,8 @@ The segments that are currently available are: * [`chruby`](#chruby) - Ruby environment information using `chruby` (if one is active). * [`rbenv`](#rbenv) - Ruby environment information using `rbenv` (if one is active). * [`rspec_stats`](#rspec_stats) - Show a ratio of test classes vs code classes for RSpec. -* `rust_version` - Display the current rust version. +* **Rust Segments:** + * `rust_version` - Display the current rust version. **Cloud Segments:** * **AWS Segments:** From daa7255e85e939293bca28e93c8a058425368243 Mon Sep 17 00:00:00 2001 From: Alex LaFroscia Date: Sat, 5 Mar 2016 22:12:44 -0500 Subject: [PATCH 11/94] Add shortening strategy based on package.json name --- powerlevel9k.zsh-theme | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 2ef4fe3c..89b38e48 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -446,6 +446,42 @@ prompt_dir() { truncate_from_right) current_path=$(pwd | sed -e "s,^$HOME,~," | sed $SED_EXTENDED_REGEX_PARAMETER "s/([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})[^/]+\//\1$POWERLEVEL9K_SHORTEN_DELIMITER\//g") ;; + truncate_with_package_name) + local name repo_path package_path current_dir zero + + # Get the path of the Git repo, which should have the package.json file + if repo_path=$(git rev-parse --git-dir 2>/dev/null); then + if [[ "$repo_path" == ".git" ]]; then + # If the current path is the root of the project, then the package path is + # the current directory and we don't want to append anything to represent + # the path to a subdirectory + package_path="." + subdirectory_path="" + else + # If the current path is something else, get the path to the package.json + # file by finding the repo path and removing the '.git` from the path + package_path=${repo_path:0:-4} + zero='%([BSUbfksu]|([FB]|){*})' + current_dir=$(pwd) + # Then, find the length of the package_path string, and save the + # subdirectory path as a substring of the current directory's path from 0 + # to the length of the package path's string + subdirectory_path="/${current_dir:${#${(S%%)package_path//$~zero/}}}" + fi + fi + + # Parse the 'name' from the package.json; if there are any problems, just + # print the file path + if name=$( cat "$package_path/package.json" 2> /dev/null | grep "\"name\""); then + name=$(echo $name | awk -F ':' '{print $2}' | awk -F '"' '{print $2}') + + # Instead of printing out the full path, print out the name of the package + # from the package.json and append the current subdirectory + current_path="`echo $name | tr -d '"'`$subdirectory_path" + else + current_path='%~' + fi + ;; *) current_path="%$((POWERLEVEL9K_SHORTEN_DIR_LENGTH+1))(c:$POWERLEVEL9K_SHORTEN_DELIMITER/:)%${POWERLEVEL9K_SHORTEN_DIR_LENGTH}c" ;; @@ -572,7 +608,7 @@ prompt_nodeenv() { local nodeenv_path="$NODE_VIRTUAL_ENV" if [[ -n "$nodeenv_path" && "$NODE_VIRTUAL_ENV_DISABLE_PROMPT" != true ]]; then local info="$(node -v)[$(basename "$nodeenv_path")]" - "$1_prompt_segment" "$0" "$2" "black" "green" "$info" 'NODE_ICON' + "$1_prompt_segment" "$0" "$2" "black" "green" "$info" 'NODE_ICON' fi } From 3c95feb0bdefc22a9a37529dc6f48b31a18d3a20 Mon Sep 17 00:00:00 2001 From: sabricot Date: Sun, 6 Mar 2016 18:25:17 +0100 Subject: [PATCH 12/94] Add a docker machine segment --- README.md | 1 + functions/icons.zsh | 3 +++ powerlevel9k.zsh-theme | 11 ++++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d46a8dea..59885529 100644 --- a/README.md +++ b/README.md @@ -126,6 +126,7 @@ The segments that are currently available are: * **AWS Segments:** * [`aws`](#aws) - The current AWS profile, if active. * `aws_eb_env` - The current Elastic Beanstalk Environment. +* `docker_machine` - The current Docker Machine **Other:** * [`custom_command`](#custom_command) - Create a custom segment to display the diff --git a/functions/icons.zsh b/functions/icons.zsh index e7dc3bfa..e40d6060 100644 --- a/functions/icons.zsh +++ b/functions/icons.zsh @@ -51,6 +51,7 @@ case $POWERLEVEL9K_MODE in LOAD_ICON $'\UE190 ' #  SWAP_ICON $'\UE87D' #  RAM_ICON $'\UE1E2 ' #  + SERVER_ICON $'\UE895' #  VCS_UNTRACKED_ICON $'\UE16C' #  VCS_UNSTAGED_ICON $'\UE17C' #  VCS_STAGED_ICON $'\UE168' #  @@ -105,6 +106,7 @@ case $POWERLEVEL9K_MODE in LOAD_ICON $'\UF080 ' #  SWAP_ICON $'\UF0E4' #  RAM_ICON $'\UF0E4' #  + SERVER_ICON $'\UF296' #  VCS_UNTRACKED_ICON $'\UF059' #  VCS_UNSTAGED_ICON $'\UF06A' #  VCS_STAGED_ICON $'\UF055' #  @@ -155,6 +157,7 @@ case $POWERLEVEL9K_MODE in LOAD_ICON 'L' SWAP_ICON 'SWP' RAM_ICON 'RAM' + SERVER_ICON '' VCS_UNTRACKED_ICON '?' VCS_UNSTAGED_ICON $'\u25CF' # ● VCS_STAGED_ICON $'\u271A' # ✚ diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 2ef4fe3c..64ad1391 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -463,6 +463,15 @@ prompt_dir() { fi } +# Docker machine +prompt_docker_machine() { + local docker_machine="$DOCKER_MACHINE_NAME" + + if [[ -n "$docker_machine" ]]; then + "$1_prompt_segment" "$0" "$2" "magenta" "$DEFAULT_COLOR" "$docker_machine" 'SERVER_ICON' + fi +} + # GO prompt prompt_go_version() { local go_version @@ -572,7 +581,7 @@ prompt_nodeenv() { local nodeenv_path="$NODE_VIRTUAL_ENV" if [[ -n "$nodeenv_path" && "$NODE_VIRTUAL_ENV_DISABLE_PROMPT" != true ]]; then local info="$(node -v)[$(basename "$nodeenv_path")]" - "$1_prompt_segment" "$0" "$2" "black" "green" "$info" 'NODE_ICON' + "$1_prompt_segment" "$0" "$2" "black" "green" "$info" 'NODE_ICON' fi } From 8feee5d4ccfe1486ad8b15e8e234f68d1ceb6997 Mon Sep 17 00:00:00 2001 From: sabricot Date: Sun, 6 Mar 2016 18:32:07 +0100 Subject: [PATCH 13/94] Fix typo about docker in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 59885529..f5a689cf 100644 --- a/README.md +++ b/README.md @@ -126,7 +126,7 @@ The segments that are currently available are: * **AWS Segments:** * [`aws`](#aws) - The current AWS profile, if active. * `aws_eb_env` - The current Elastic Beanstalk Environment. -* `docker_machine` - The current Docker Machine +* `docker_machine` - The current Docker Machine. **Other:** * [`custom_command`](#custom_command) - Create a custom segment to display the From f7b7ff21c9885a2a94f174336416dafa8b96c470 Mon Sep 17 00:00:00 2001 From: Sudarshan Wadkar Date: Mon, 14 Mar 2016 20:57:30 -0400 Subject: [PATCH 14/94] Fix NVM prompt to return if not used This commit changes nvm prompt setup to return immediately if no node version is installed/available. Currently, prompt complains for lack of global node version. Specifically, if you install nvm (from brew or manually) and do not have global node installed (or set), then the prompt should not set or show anything. This commit ensures this by immediately returning if `nvm current` returns "none". --- powerlevel9k.zsh-theme | 1 + 1 file changed, 1 insertion(+) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 2ef4fe3c..c69c32c6 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -560,6 +560,7 @@ prompt_node_version() { prompt_nvm() { [[ ! $(type nvm) =~ 'nvm is a shell function'* ]] && return local node_version=$(nvm current) + [[ ${node_version} = "none" ]] && return local nvm_default=$(cat $NVM_DIR/alias/default) [[ -z "${node_version}" ]] && return [[ "$node_version" =~ "$nvm_default" ]] && return From 7fcac16c5fa6ef6953e0fb168707a4e01e9b136d Mon Sep 17 00:00:00 2001 From: Sudarshan Wadkar Date: Wed, 16 Mar 2016 17:25:39 -0400 Subject: [PATCH 15/94] Combine two checks into one --- powerlevel9k.zsh-theme | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index c69c32c6..cb1ab338 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -560,9 +560,8 @@ prompt_node_version() { prompt_nvm() { [[ ! $(type nvm) =~ 'nvm is a shell function'* ]] && return local node_version=$(nvm current) - [[ ${node_version} = "none" ]] && return + [[ -z "${node_version}" ]] || [[ ${node_version} = "none" ]] && return local nvm_default=$(cat $NVM_DIR/alias/default) - [[ -z "${node_version}" ]] && return [[ "$node_version" =~ "$nvm_default" ]] && return $1_prompt_segment "$0" "$2" "green" "011" "${node_version:1}" 'NODE_ICON' From b46a96a7cee43ed35c319e04800a5d043e371163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Maggioni?= Date: Tue, 22 Mar 2016 17:29:34 +0100 Subject: [PATCH 16/94] Git tag not replacing branch --- functions/vcs.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/vcs.zsh b/functions/vcs.zsh index 9d3883ca..847275fa 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -64,7 +64,7 @@ function +vi-git-tagname() { local tag tag=$(git describe --tags --exact-match HEAD 2>/dev/null) - [[ -n "${tag}" ]] && hook_com[branch]="$(print_icon 'VCS_TAG_ICON')${tag}" + [[ -n "${tag}" ]] && hook_com[branch]+=" $(print_icon 'VCS_TAG_ICON')${tag}" } # Show count of stashed changes From 89fefbdf6edb353e557bde8fd484d8d2460518d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Maggioni?= Date: Tue, 22 Mar 2016 17:51:01 +0100 Subject: [PATCH 17/94] DETACHED_HEAD handling --- functions/vcs.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/functions/vcs.zsh b/functions/vcs.zsh index 847275fa..92731d52 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -61,10 +61,12 @@ function +vi-git-remotebranch() { } function +vi-git-tagname() { + if [[ -n "$(git status | grep 'HEAD detached')" ]] ; then local tag tag=$(git describe --tags --exact-match HEAD 2>/dev/null) [[ -n "${tag}" ]] && hook_com[branch]+=" $(print_icon 'VCS_TAG_ICON')${tag}" + fi } # Show count of stashed changes From 4ca6938801daf7158edc3b8e1922aa748d07eb18 Mon Sep 17 00:00:00 2001 From: Alex LaFroscia Date: Thu, 17 Mar 2016 18:00:20 -0400 Subject: [PATCH 18/94] Apply max dir length to package name shortener --- README.md | 11 ++++++++++- functions/utilities.zsh | 6 ++++++ powerlevel9k.zsh-theme | 6 +++--- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d46a8dea..43170580 100644 --- a/README.md +++ b/README.md @@ -242,7 +242,7 @@ Customizations available are: | Variable | Default Value | Description | |----------|---------------|-------------| |`POWERLEVEL9K_SHORTEN_DIR_LENGTH`|`2`|If your shorten strategy, below, is entire directories, this field determines how many directories to leave at the end. If your shorten strategy is by character count, this field determines how many characters to allow per directory string.| -|`POWERLEVEL9K_SHORTEN_STRATEGY`|None|How the directory strings should be truncated. By default, it will truncate whole directories. Other options are `truncate_middle`, which leaves the start and end of the directory strings, and `truncate_from_right`, which cuts starting from the end of the string.| +|`POWERLEVEL9K_SHORTEN_STRATEGY`|None|How the directory strings should be truncated. By default, it will truncate whole directories. Other options are `truncate_middle`, which leaves the start and end of the directory strings, and `truncate_from_right`, which cuts starting from the end of the string. You can also use `truncate_with_package_name` to use the `package.json` `name` field to abbreviate the directory path.| |`POWERLEVEL9K_SHORTEN_DELIMITER`|`..`|Delimiter to use in truncated strings. This can be any string you choose, including an empty string if you wish to have no delimiter.| For example, if you wanted the truncation behavior of the `fish` shell, which @@ -256,6 +256,15 @@ In each case you have to specify the length you want to shorten the directory to. So in some cases `POWERLEVEL9K_SHORTEN_DIR_LENGTH` means characters, in others whole directories. +The `truncate_with_package_name` strategy gives your directory path relative to the root of your project. For example, if you have a project inside `$HOME/projects/my-project` with a `package.json` that looks like: + +```json +{ + "name": "my-cool-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. ##### ip diff --git a/functions/utilities.zsh b/functions/utilities.zsh index 5ca5b431..eed6ccc5 100644 --- a/functions/utilities.zsh +++ b/functions/utilities.zsh @@ -186,3 +186,9 @@ function segmentShouldBeJoined() { return 1 fi } + +# Given a directory path, truncate it according to the settings for +# `truncate_from_right` +function truncatePathFromRight() { + echo $1 | sed $SED_EXTENDED_REGEX_PARAMETER "s/([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})[^/]+\//\1$POWERLEVEL9K_SHORTEN_DELIMITER\//g" +} diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 89b38e48..67406aca 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -444,7 +444,7 @@ prompt_dir() { current_path=$(pwd | sed -e "s,^$HOME,~," | sed $SED_EXTENDED_REGEX_PARAMETER "s/([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})[^/]+([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})\//\1$POWERLEVEL9K_SHORTEN_DELIMITER\2\//g") ;; truncate_from_right) - current_path=$(pwd | sed -e "s,^$HOME,~," | sed $SED_EXTENDED_REGEX_PARAMETER "s/([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})[^/]+\//\1$POWERLEVEL9K_SHORTEN_DELIMITER\//g") + current_path=$(truncatePathFromRight $(pwd | sed -e "s,^$HOME,~,") ) ;; truncate_with_package_name) local name repo_path package_path current_dir zero @@ -466,7 +466,7 @@ prompt_dir() { # Then, find the length of the package_path string, and save the # subdirectory path as a substring of the current directory's path from 0 # to the length of the package path's string - subdirectory_path="/${current_dir:${#${(S%%)package_path//$~zero/}}}" + subdirectory_path=$(truncatePathFromRight "/${current_dir:${#${(S%%)package_path//$~zero/}}}") fi fi @@ -479,7 +479,7 @@ prompt_dir() { # from the package.json and append the current subdirectory current_path="`echo $name | tr -d '"'`$subdirectory_path" else - current_path='%~' + current_path=$(truncatePathFromRight $(pwd | sed -e "s,^$HOME,~,") ) fi ;; *) From 4fdf5df25884ecfaa6668dbc152ee5e7c573d8d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Maggioni?= Date: Tue, 22 Mar 2016 18:24:34 +0100 Subject: [PATCH 19/94] Documentation --- functions/vcs.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/functions/vcs.zsh b/functions/vcs.zsh index 92731d52..af247d9c 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -61,10 +61,13 @@ function +vi-git-remotebranch() { } function +vi-git-tagname() { + # Only show the tag name if we are not in DETACHED_HEAD state, + # since in that case it would already be displayed in the branch segment if [[ -n "$(git status | grep 'HEAD detached')" ]] ; then local tag tag=$(git describe --tags --exact-match HEAD 2>/dev/null) + # Append the tag segment to the branch one [[ -n "${tag}" ]] && hook_com[branch]+=" $(print_icon 'VCS_TAG_ICON')${tag}" fi } From 1ab41d9a6c9e2a4f62e3ebaac71cb2a87dde20cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Maggioni?= Date: Fri, 25 Mar 2016 10:51:33 +0100 Subject: [PATCH 20/94] Better DETACHED_HEAD detection --- functions/vcs.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/vcs.zsh b/functions/vcs.zsh index af247d9c..368251b6 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -63,7 +63,7 @@ function +vi-git-remotebranch() { function +vi-git-tagname() { # Only show the tag name if we are not in DETACHED_HEAD state, # since in that case it would already be displayed in the branch segment - if [[ -n "$(git status | grep 'HEAD detached')" ]] ; then + if [[ -z "$(git symbolic-ref HEAD 2>/dev/null)" ]] ; then local tag tag=$(git describe --tags --exact-match HEAD 2>/dev/null) From 104e774873aea435d3a8462470da6213c38257f8 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Sun, 3 Apr 2016 19:13:58 +0200 Subject: [PATCH 21/94] Fix configurability of actionformat color --- CHANGELOG.md | 5 +++++ powerlevel9k.zsh-theme | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 557f977b..218e1d76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,11 @@ POWERLEVEL9K_VCS_CLEAN_FOREGROUND='cyan' POWERLEVEL9K_VCS_CLEAN_BACKGROUND='white' ``` +The foreground color of actionformat is now configurable via: +```zsh +POWERLEVEL9K_VCS_ACTIONFORMAT_FOREGROUND='green' +``` + ### `aws_eb_env` added This segment displays the current Elastic Beanstalk environment. diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index bba5a6f6..1a620a23 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -778,6 +778,7 @@ prompt_todo() { # VCS segment: shows the state of your repository, if you are in a folder under # version control +set_default POWERLEVEL9K_VCS_ACTIONFORMAT_FOREGROUND "red" prompt_vcs() { autoload -Uz vcs_info @@ -791,7 +792,6 @@ prompt_vcs() { 'clean' 'green' 'modified' 'yellow' 'untracked' 'green' - 'actionformat' 'red' ) VCS_CHANGESET_PREFIX='' @@ -811,7 +811,7 @@ prompt_vcs() { VCS_DEFAULT_FORMAT="$VCS_CHANGESET_PREFIX%b%c%u%m" zstyle ':vcs_info:*' formats "$VCS_DEFAULT_FORMAT" - zstyle ':vcs_info:*' actionformats "%b %F{${vcs_states[actionformat]}}| %a%f" + zstyle ':vcs_info:*' actionformats "%b %F{${POWERLEVEL9K_VCS_ACTIONFORMAT_FOREGROUND}}| %a%f" zstyle ':vcs_info:*' stagedstr " $(print_icon 'VCS_STAGED_ICON')" zstyle ':vcs_info:*' unstagedstr " $(print_icon 'VCS_UNSTAGED_ICON')" From 164c6bd1628aeb526905430e3780bd13d95d5dae Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Mon, 11 Apr 2016 15:27:17 -0400 Subject: [PATCH 22/94] Update CHANGELOG about new package.json shortening strategy --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 218e1d76..a1d13088 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,10 @@ This segment displays the current Elastic Beanstalk environment. The `ram` segment was split up into `ram` and `swap`. The `POWERLEVEL9K_RAM_ELEMENTS` variable is void. +### `dir` Shortening Strategies + +There is now a path shortening strategy that will use the `package.json` file to shorten your directory path. See the documentation for the `dir` segment for more details. + ## v0.3.2 ### `vcs` changes From 154181ffc2830445c30eed74949e700ad2cd5a2a Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Mon, 11 Apr 2016 15:30:09 -0400 Subject: [PATCH 23/94] Catching up CHANGELOG with new segments. --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1d13088..064f5283 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,18 @@ variable is void. There is now a path shortening strategy that will use the `package.json` file to shorten your directory path. See the documentation for the `dir` segment for more details. +### `chruby` Segment + +Added new `chruby` segment to support this version manager. + +### `node`, `nvm` Segments + +Improvements to speed / reliability. + +### `docker` Segment + +Added new `docker` segment that will show your Docker machine. + ## v0.3.2 ### `vcs` changes From ce16b087c6c0f51570903cf89d7e8b7f87287380 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Maggioni?= Date: Mon, 11 Apr 2016 21:37:28 +0200 Subject: [PATCH 24/94] Avoid tag/branch duplication if same value --- functions/vcs.zsh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/functions/vcs.zsh b/functions/vcs.zsh index 368251b6..f112e6a1 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -67,8 +67,12 @@ function +vi-git-tagname() { local tag tag=$(git describe --tags --exact-match HEAD 2>/dev/null) - # Append the tag segment to the branch one - [[ -n "${tag}" ]] && hook_com[branch]+=" $(print_icon 'VCS_TAG_ICON')${tag}" + head=$(git describe --all) + # Make sure that detached head and tag differ in name + if [[ "${head}" != "${tag}" ]]; then + # Append the tag segment to the branch one + [[ -n "${tag}" ]] && hook_com[branch]+=" $(print_icon 'VCS_TAG_ICON')${tag}" + fi fi } From 14e213bd681d9e6733f753cb068fb491a4e174f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Maggioni?= Date: Mon, 11 Apr 2016 23:02:58 +0200 Subject: [PATCH 25/94] Weird conditions handling Become a programmer, they said. It'll be fun, they said. --- functions/vcs.zsh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/functions/vcs.zsh b/functions/vcs.zsh index f112e6a1..074d1e05 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -62,16 +62,20 @@ function +vi-git-remotebranch() { function +vi-git-tagname() { # Only show the tag name if we are not in DETACHED_HEAD state, - # since in that case it would already be displayed in the branch segment - if [[ -z "$(git symbolic-ref HEAD 2>/dev/null)" ]] ; then - local tag + # or if the current branch's HEAD is the same commit as a tag but + # doesn't have the same name + local tag + tag=$(git describe --tags --exact-match HEAD 2>/dev/null) - tag=$(git describe --tags --exact-match HEAD 2>/dev/null) + if [[ -z "$(git symbolic-ref HEAD 2>/dev/null)" || ! -z "${tag}" ]] ; then head=$(git describe --all) - # Make sure that detached head and tag differ in name - if [[ "${head}" != "${tag}" ]]; then - # Append the tag segment to the branch one - [[ -n "${tag}" ]] && hook_com[branch]+=" $(print_icon 'VCS_TAG_ICON')${tag}" + # Make sure that detached head or checked out name differs from tag name + if [[ "${head}" != "${tag}" || + "$(git rev-parse --abbrev-ref HEAD)" != "${tag}" && + "$(git rev-parse --abbrev-ref HEAD)" != "HEAD" && + "$(git rev-list -n 1 HEAD)" == "$(git rev-list -n 1 ${tag})" ]]; then + # Append the tag segment to the branch one + [[ -n "${tag}" ]] && hook_com[branch]+=" $(print_icon 'VCS_TAG_ICON')${tag}" fi fi } From 6fde7bf3fdce11ab38e50bbcc48e96cb22166d42 Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Tue, 12 Apr 2016 09:30:28 -0400 Subject: [PATCH 26/94] git-tagname: reducing conditionals in logic --- functions/vcs.zsh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/functions/vcs.zsh b/functions/vcs.zsh index 074d1e05..c2b8185a 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -67,7 +67,10 @@ function +vi-git-tagname() { local tag tag=$(git describe --tags --exact-match HEAD 2>/dev/null) - if [[ -z "$(git symbolic-ref HEAD 2>/dev/null)" || ! -z "${tag}" ]] ; then + # if [[ -z "$(git symbolic-ref HEAD 2>/dev/null)" || ! -z "${tag}" ]] ; then + 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. head=$(git describe --all) # Make sure that detached head or checked out name differs from tag name if [[ "${head}" != "${tag}" || From 0f4e3e7588fff005a8ad275915f390817f804345 Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Tue, 12 Apr 2016 10:43:34 -0400 Subject: [PATCH 27/94] git-tagname: Now showing hash/branchname when sitting on a tag --- functions/vcs.zsh | 17 ++++++++--------- powerlevel9k.zsh-theme | 4 ++-- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/functions/vcs.zsh b/functions/vcs.zsh index c2b8185a..3a5a6cb5 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -67,18 +67,17 @@ function +vi-git-tagname() { local tag tag=$(git describe --tags --exact-match HEAD 2>/dev/null) - # if [[ -z "$(git symbolic-ref HEAD 2>/dev/null)" || ! -z "${tag}" ]] ; then 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. - head=$(git describe --all) - # Make sure that detached head or checked out name differs from tag name - if [[ "${head}" != "${tag}" || - "$(git rev-parse --abbrev-ref HEAD)" != "${tag}" && - "$(git rev-parse --abbrev-ref HEAD)" != "HEAD" && - "$(git rev-list -n 1 HEAD)" == "$(git rev-list -n 1 ${tag})" ]]; then - # Append the tag segment to the branch one - [[ -n "${tag}" ]] && hook_com[branch]+=" $(print_icon 'VCS_TAG_ICON')${tag}" + if [[ -z $(git symbolic-ref HEAD 2>/dev/null) ]]; then + # DETACHED_HEAD state. Print the commit hash and tag name. + local revision + revision=$(git rev-list -n 1 --abbrev-commit --abbrev=8 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. + hook_com[branch]+=" $(print_icon 'VCS_TAG_ICON')${tag}" fi fi } diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 7da17f99..faae532c 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -832,8 +832,8 @@ prompt_vcs() { VCS_CHANGESET_PREFIX='' if [[ "$POWERLEVEL9K_SHOW_CHANGESET" == true ]]; then - # Default: Just display the first 12 characters of our changeset-ID. - local VCS_CHANGESET_HASH_LENGTH=12 + # Default: Just display the first 8 characters of our changeset-ID. + local VCS_CHANGESET_HASH_LENGTH=8 if [[ -n "$POWERLEVEL9K_CHANGESET_HASH_LENGTH" ]]; then VCS_CHANGESET_HASH_LENGTH="$POWERLEVEL9K_CHANGESET_HASH_LENGTH" fi From a09eda677421bea934a08a0d1bc5196ab973d853 Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Tue, 12 Apr 2016 10:54:10 -0400 Subject: [PATCH 28/94] Fixing comments in vi-git -tagname --- functions/vcs.zsh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/functions/vcs.zsh b/functions/vcs.zsh index 3a5a6cb5..63cdbc75 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -61,9 +61,7 @@ function +vi-git-remotebranch() { } function +vi-git-tagname() { - # Only show the tag name if we are not in DETACHED_HEAD state, - # or if the current branch's HEAD is the same commit as a tag but - # doesn't have the same name + # If we are on a tag, append the tagname to the current branch string. local tag tag=$(git describe --tags --exact-match HEAD 2>/dev/null) @@ -71,12 +69,15 @@ function +vi-git-tagname() { # 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 $(git symbolic-ref HEAD 2>/dev/null) ]]; then - # DETACHED_HEAD state. Print the commit hash and tag name. + # 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=$(git rev-list -n 1 --abbrev-commit --abbrev=8 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. + # 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 From 72315fdc594f8c6945d8a683e2b35985855ff6eb Mon Sep 17 00:00:00 2001 From: orhanbalci <=> Date: Sat, 16 Apr 2016 23:46:32 +0300 Subject: [PATCH 29/94] rust icon added --- functions/icons.zsh | 4 +++- powerlevel9k.zsh-theme | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/functions/icons.zsh b/functions/icons.zsh index e40d6060..17d7a9f6 100644 --- a/functions/icons.zsh +++ b/functions/icons.zsh @@ -120,7 +120,8 @@ case $POWERLEVEL9K_MODE in VCS_REMOTE_BRANCH_ICON ' '$'\UF204 ' #  VCS_GIT_ICON $'\UF113 ' #  VCS_HG_ICON $'\UF0C3 ' #  - ) + RUST_ICON $'\UE6A8' #  + ) ;; *) # Powerline-Patched Font required! @@ -171,6 +172,7 @@ case $POWERLEVEL9K_MODE in VCS_REMOTE_BRANCH_ICON $'\u2192' # → VCS_GIT_ICON '' VCS_HG_ICON '' + RUST_ICON '' ) ;; esac diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 7da17f99..8a0c43fb 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -691,7 +691,7 @@ prompt_rust_version() { rust_version=$(rustc --version 2>&1 | grep -oe "^rustc\s*[^ ]*" | grep -o '[0-9.a-z\\\-]*$') if [[ -n "$rust_version" ]]; then - "$1_prompt_segment" "$0" "$2" "208" "$DEFAULT_COLOR" "Rust $rust_version" + "$1_prompt_segment" "$0" "$2" "208" "$DEFAULT_COLOR" "Rust $rust_version" 'RUST_ICON' fi } # RSpec test ratio From 7b2e995299175a8d2e573413975ff8da43b0a9a2 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Sun, 17 Apr 2016 17:51:31 +0200 Subject: [PATCH 30/94] Fix truncation of changeset in detached tag mode --- functions/vcs.zsh | 2 +- powerlevel9k.zsh-theme | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/functions/vcs.zsh b/functions/vcs.zsh index 63cdbc75..15f0177e 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -74,7 +74,7 @@ function +vi-git-tagname() { # exists, so we have to manually retrieve it and clobber the branch # string. local revision - revision=$(git rev-list -n 1 --abbrev-commit --abbrev=8 HEAD) + revision=$(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. diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index faae532c..ed1c49cb 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -815,7 +815,14 @@ prompt_todo() { # VCS segment: shows the state of your repository, if you are in a folder under # version control set_default POWERLEVEL9K_VCS_ACTIONFORMAT_FOREGROUND "red" +# Default: Just display the first 8 characters of our changeset-ID. +set_default POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH "8" prompt_vcs() { + if [[ -n "$POWERLEVEL9K_CHANGESET_HASH_LENGTH" ]]; then + POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH="$POWERLEVEL9K_CHANGESET_HASH_LENGTH" + fi + + # Load VCS_INFO autoload -Uz vcs_info VCS_WORKDIR_DIRTY=false @@ -832,13 +839,7 @@ prompt_vcs() { VCS_CHANGESET_PREFIX='' if [[ "$POWERLEVEL9K_SHOW_CHANGESET" == true ]]; then - # Default: Just display the first 8 characters of our changeset-ID. - local VCS_CHANGESET_HASH_LENGTH=8 - if [[ -n "$POWERLEVEL9K_CHANGESET_HASH_LENGTH" ]]; then - VCS_CHANGESET_HASH_LENGTH="$POWERLEVEL9K_CHANGESET_HASH_LENGTH" - fi - - VCS_CHANGESET_PREFIX="$(print_icon 'VCS_COMMIT_ICON')%0.$VCS_CHANGESET_HASH_LENGTH""i " + VCS_CHANGESET_PREFIX="$(print_icon 'VCS_COMMIT_ICON')%0.$POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH""i " fi zstyle ':vcs_info:*' enable git hg From c991553fb25f4739a25f15fedef1ead92f44ecf3 Mon Sep 17 00:00:00 2001 From: orhanbalci <=> Date: Sun, 17 Apr 2016 21:51:34 +0300 Subject: [PATCH 31/94] empty rust icon for patched mode --- functions/icons.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/icons.zsh b/functions/icons.zsh index 17d7a9f6..9c9277b6 100644 --- a/functions/icons.zsh +++ b/functions/icons.zsh @@ -69,6 +69,7 @@ case $POWERLEVEL9K_MODE in VCS_REMOTE_BRANCH_ICON ' '$'\UE804 ' #  VCS_GIT_ICON $'\UE20E ' #  VCS_HG_ICON $'\UE1C3 ' #  + RUST_ICON '' ) ;; 'awesome-fontconfig') From 0f7b525173449d815f4f751a264662e6d1767f2e Mon Sep 17 00:00:00 2001 From: orhanbalci Date: Tue, 19 Apr 2016 22:07:29 +0300 Subject: [PATCH 32/94] add rust icon information to README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9e9ff64c..6e91b319 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,7 @@ The segments that are currently available are: * [`rbenv`](#rbenv) - Ruby environment information using `rbenv` (if one is active). * [`rspec_stats`](#rspec_stats) - Show a ratio of test classes vs code classes for RSpec. * **Rust Segments:** - * `rust_version` - Display the current rust version. + * `rust_version` - Display the current rust version and [logo](https://www.rust-lang.org/logos/rust-logo-blk.svg). **Cloud Segments:** * **AWS Segments:** From 67dce19024823647e23675c1fb94529e4b997929 Mon Sep 17 00:00:00 2001 From: orhanbalci <=> Date: Tue, 19 Apr 2016 22:08:11 +0300 Subject: [PATCH 33/94] whitespace fix --- functions/icons.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/icons.zsh b/functions/icons.zsh index 9c9277b6..6de09ee8 100644 --- a/functions/icons.zsh +++ b/functions/icons.zsh @@ -122,7 +122,7 @@ case $POWERLEVEL9K_MODE in VCS_GIT_ICON $'\UF113 ' #  VCS_HG_ICON $'\UF0C3 ' #  RUST_ICON $'\UE6A8' #  - ) + ) ;; *) # Powerline-Patched Font required! From 391b3327eed75ffd0de4534fdb1ee5227395528e Mon Sep 17 00:00:00 2001 From: Jan Laermann Date: Tue, 19 Apr 2016 21:49:57 +0200 Subject: [PATCH 34/94] Added anaconda segment. The segment relies on a lookaround to determine the currently active conda environment. If available ack is preferred, otherwise grep will be used. Recent versions of grep offer `-P` to support perl-regex. Older ones (e.g. those shipped on OSX) will fail. --- README.md | 11 +++++++++++ powerlevel9k.zsh-theme | 12 ++++++++++++ 2 files changed, 23 insertions(+) diff --git a/README.md b/README.md index 6e91b319..637c9b9f 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,7 @@ The segments that are currently available are: * `symfony2_version` - Show the current Symfony2 version, if you are in a Symfony2-Project dir. * **Python Segments:** * `virtualenv` - Your Python [VirtualEnv](https://virtualenv.pypa.io/en/latest/). + * `anaconda` - Your active [Anaconda](https://www.continuum.io/why-anaconda) environment. * **Ruby Segments:** * [`chruby`](#chruby) - Ruby environment information using `chruby` (if one is active). * [`rbenv`](#rbenv) - Ruby environment information using `rbenv` (if one is active). @@ -136,6 +137,16 @@ The segments that are currently available are: --------------------------------------------------------------------------------- +##### anaconda + +This segment shows your active anaconda environment. + +*Note: This segment relies on a perl-regex with lookbehind. +If `ack` is not available the segment will try to use `grep`. +Recent versions of grep offer a `-P` option to handle such things. +On OSX, however, you want to install gnu-grep (e.g. via `brew install grep`) +and alias the newly installed `ggrep` to `grep`. Alternatively, `brew install ack`.* + ##### aws If you would like to display the [current AWS diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 8bba6632..d583eaab 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -288,6 +288,18 @@ right_prompt_segment() { # right-left but reads the opposite, this isn't necessary for the other side. CURRENT_BG='NONE' +# Anaconda Environment +prompt_anaconda() { + if $(hash ack 2>/dev/null); then + local active_conda_env=$(where conda | ack -o '(?<=envs/)[\w-]+(?=/bin)') + else + local active_conda_env=$(where conda | grep -o -P '(?<=envs/)[\w-]+(?=/bin)') + fi + if [[ -n $active_conda_env ]]; then + "$1_prompt_segment" "$0" "$2" "green" "black" "($active_conda_env)" "" + fi +} + # AWS Profile prompt_aws() { local aws_profile="$AWS_DEFAULT_PROFILE" From 92edb26a7878468d6cb988811e41bcb7b8806eac Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Wed, 20 Apr 2016 11:43:57 -0400 Subject: [PATCH 35/94] Making `anaconda` list item a link to full description. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 637c9b9f..b954d03e 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,7 @@ The segments that are currently available are: * `symfony2_version` - Show the current Symfony2 version, if you are in a Symfony2-Project dir. * **Python Segments:** * `virtualenv` - Your Python [VirtualEnv](https://virtualenv.pypa.io/en/latest/). - * `anaconda` - Your active [Anaconda](https://www.continuum.io/why-anaconda) environment. + * [`anaconda`](#anaconda) - Your active [Anaconda](https://www.continuum.io/why-anaconda) environment. * **Ruby Segments:** * [`chruby`](#chruby) - Ruby environment information using `chruby` (if one is active). * [`rbenv`](#rbenv) - Ruby environment information using `rbenv` (if one is active). From 5026a546fb4472d20e9d70df59eb7a8a009b6cb9 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Wed, 20 Apr 2016 18:24:58 +0200 Subject: [PATCH 36/94] Changelog: Add a note about obsolete variables The variables `POWERLEVEL9K_VCS_FOREGROUND` and `POWERLEVEL9K_VCS_DARK_FOREGROUND` are no longer used. --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 064f5283..8eb1958f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,12 @@ The foreground color of actionformat is now configurable via: POWERLEVEL9K_VCS_ACTIONFORMAT_FOREGROUND='green' ``` +Also, the vcs segment uses the foreground color it was configured to. +That said, the variables `POWERLEVEL9K_VCS_FOREGROUND` and +`POWERLEVEL9K_VCS_DARK_FOREGROUND` are no longer used. Instead use +the proper variable `POWERLEVEL9K_VCS__FOREGROUND` to change +foreground color. + ### `aws_eb_env` added This segment displays the current Elastic Beanstalk environment. From aba5e69cf1b99b851d9fa1e60593b21fec5b6fbd Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Wed, 20 Apr 2016 18:26:15 +0200 Subject: [PATCH 37/94] Changelog: Add entry for new anaconda segment --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8eb1958f..a9ba8fb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,11 @@ Improvements to speed / reliability. Added new `docker` segment that will show your Docker machine. +### New segment `anaconda` added + +A new segment `anaconda` was added that shows the current used +anaconda environment. + ## v0.3.2 ### `vcs` changes From 9b87ec6a222b4b86065838b63c9912f81ce76764 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Wed, 20 Apr 2016 18:29:19 +0200 Subject: [PATCH 38/94] Changelog: Update headlines for better readability --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a9ba8fb3..3be0bb6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,7 @@ That said, the variables `POWERLEVEL9K_VCS_FOREGROUND` and the proper variable `POWERLEVEL9K_VCS__FOREGROUND` to change foreground color. -### `aws_eb_env` added +### New segment `aws_eb_env` added This segment displays the current Elastic Beanstalk environment. @@ -34,7 +34,7 @@ variable is void. There is now a path shortening strategy that will use the `package.json` file to shorten your directory path. See the documentation for the `dir` segment for more details. -### `chruby` Segment +### New segment `chruby` added Added new `chruby` segment to support this version manager. @@ -42,7 +42,7 @@ Added new `chruby` segment to support this version manager. Improvements to speed / reliability. -### `docker` Segment +### New segment `docker` added Added new `docker` segment that will show your Docker machine. From 96bc96a46506b0ae3a81ec79ecd695d085b791d8 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Wed, 20 Apr 2016 18:31:36 +0200 Subject: [PATCH 39/94] Changelog: Add a note about the changed shorten delimiter --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3be0bb6b..f929d64c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,7 +32,12 @@ variable is void. ### `dir` Shortening Strategies -There is now a path shortening strategy that will use the `package.json` file to shorten your directory path. See the documentation for the `dir` segment for more details. +There is now a path shortening strategy that will use the `package.json` file to +shorten your directory path. See the documentation for the `dir` segment for more +details. + +Also, the shorten delimiter was changed to an unicode ellipsis. It is configurable +via `POWERLEVEL9K_SHORTEN_DELIMITER`. ### New segment `chruby` added From 6f66381c9dcb0371d898ef5a5d05161b8de7af93 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Wed, 20 Apr 2016 18:33:04 +0200 Subject: [PATCH 40/94] Changelog: Fix name for docker_machine segment --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f929d64c..383ba27c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,9 +47,9 @@ Added new `chruby` segment to support this version manager. Improvements to speed / reliability. -### New segment `docker` added +### New segment `docker_machine` added -Added new `docker` segment that will show your Docker machine. +Added new `docker_machine` segment that will show your Docker machine. ### New segment `anaconda` added From 05736a7ba1217fe046a5ff0a68b36205c151295d Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Wed, 20 Apr 2016 18:35:09 +0200 Subject: [PATCH 41/94] Changelog: Add entry about new `nodeenv` segment --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 383ba27c..41928038 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,10 @@ Added new `chruby` segment to support this version manager. Improvements to speed / reliability. +### New segment `nodeenv` added + +Added new `nodeenv` segment that shows the currently used node environment. + ### New segment `docker_machine` added Added new `docker_machine` segment that will show your Docker machine. From feec4215c7198dce41871499e4fe0ac6526f0158 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Wed, 20 Apr 2016 18:36:34 +0200 Subject: [PATCH 42/94] Changelog: Reformat; first changes then additions --- CHANGELOG.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 41928038..c8d83c99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,10 +39,6 @@ details. Also, the shorten delimiter was changed to an unicode ellipsis. It is configurable via `POWERLEVEL9K_SHORTEN_DELIMITER`. -### New segment `chruby` added - -Added new `chruby` segment to support this version manager. - ### `node`, `nvm` Segments Improvements to speed / reliability. @@ -51,6 +47,10 @@ Improvements to speed / reliability. Added new `nodeenv` segment that shows the currently used node environment. +### New segment `chruby` added + +Added new `chruby` segment to support this version manager. + ### New segment `docker_machine` added Added new `docker_machine` segment that will show your Docker machine. From f2e31fd59a101c88e0e0218fba4e35af92538494 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Thu, 21 Apr 2016 01:32:00 +0200 Subject: [PATCH 43/94] Changelog: Reformat; first changes then additions --- CHANGELOG.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8d83c99..8af380cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,10 +21,6 @@ That said, the variables `POWERLEVEL9K_VCS_FOREGROUND` and the proper variable `POWERLEVEL9K_VCS__FOREGROUND` to change foreground color. -### New segment `aws_eb_env` added - -This segment displays the current Elastic Beanstalk environment. - ### `ram` changes The `ram` segment was split up into `ram` and `swap`. The `POWERLEVEL9K_RAM_ELEMENTS` @@ -47,6 +43,10 @@ Improvements to speed / reliability. Added new `nodeenv` segment that shows the currently used node environment. +### New segment `aws_eb_env` added + +This segment displays the current Elastic Beanstalk environment. + ### New segment `chruby` added Added new `chruby` segment to support this version manager. From f5fe890df49d94611d11685b0d4853d093ef57ef Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Thu, 21 Apr 2016 01:34:31 +0200 Subject: [PATCH 44/94] Changelog: Add a note about `swap` segment --- CHANGELOG.md | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8af380cb..aa06923e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,11 +21,6 @@ That said, the variables `POWERLEVEL9K_VCS_FOREGROUND` and the proper variable `POWERLEVEL9K_VCS__FOREGROUND` to change foreground color. -### `ram` changes - -The `ram` segment was split up into `ram` and `swap`. The `POWERLEVEL9K_RAM_ELEMENTS` -variable is void. - ### `dir` Shortening Strategies There is now a path shortening strategy that will use the `package.json` file to @@ -39,6 +34,16 @@ via `POWERLEVEL9K_SHORTEN_DELIMITER`. Improvements to speed / reliability. +### `ram` changes + +The `ram` segment was split up into `ram` and `swap`. The +`POWERLEVEL9K_RAM_ELEMENTS` variable is obsolete. + +### New segment `swap` added + +Due to the split up of the ram segment, this one was created. It +shows the currently used swap size. + ### New segment `nodeenv` added Added new `nodeenv` segment that shows the currently used node environment. From 72e0274a0895be876651f889856470d568f16b71 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Thu, 21 Apr 2016 01:41:16 +0200 Subject: [PATCH 45/94] Changelog: Add a note about `rbenv` segment --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa06923e..3ca55e58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,11 @@ details. Also, the shorten delimiter was changed to an unicode ellipsis. It is configurable via `POWERLEVEL9K_SHORTEN_DELIMITER`. +### `rbenv` changes + +The `rbenv` segment now makes use of the full rbenv command, so the correct +ruby version is now shown if it differs from the globally one. + ### `node`, `nvm` Segments Improvements to speed / reliability. From 6af098a70902c5a84989e312ef584016b3f62fc3 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Thu, 21 Apr 2016 01:53:27 +0200 Subject: [PATCH 46/94] Changelog: Add a note about vcs untracked state --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ca55e58..d5264587 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ POWERLEVEL9K_VCS_CLEAN_FOREGROUND='cyan' POWERLEVEL9K_VCS_CLEAN_BACKGROUND='white' ``` +Additionaly the vcs segment now has an `untracked` state which +indicates that you have untracked files in your repository. + The foreground color of actionformat is now configurable via: ```zsh POWERLEVEL9K_VCS_ACTIONFORMAT_FOREGROUND='green' From ffd114f1fc2d0fb8e3754d87a7d3dad676694d76 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Thu, 21 Apr 2016 01:55:30 +0200 Subject: [PATCH 47/94] Changelog: Add a note about TravisCI --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d5264587..31174bc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## v0.4.0 (next) +### Development changes + +From now on, development makes use of a CI system "travis". + ### `vcs` changes The default state was renamed to `clean`. If you overrode foreground From 24fac490507996dbd015e11e0c13b8ee05014d50 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Thu, 21 Apr 2016 01:55:55 +0200 Subject: [PATCH 48/94] Changelog: Remove tag "next" for version 0.4.0 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31174bc4..7a3f7444 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## v0.4.0 (next) +## v0.4.0 ### Development changes From 78b4ab0414eb1c3b69a1fd9eae60f520e7fc79d2 Mon Sep 17 00:00:00 2001 From: David McKay Date: Fri, 22 Apr 2016 12:24:30 +0100 Subject: [PATCH 49/94] Improvements to load prompt, now reporting warning and critical at 50% and 70% cpu core utilisation --- powerlevel9k.zsh-theme | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index d583eaab..4fd7ecf4 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -578,30 +578,39 @@ prompt_ip() { prompt_load() { # The load segment can have three different states local current_state="unknown" + local cores + + if [[ "$OS" == "OSX" ]]; then + cores=$(sysctl -a | grep machdep.cpu) + else + cores=$(nproc) + fi + typeset -AH load_states load_states=( 'critical' 'red' 'warning' 'yellow' 'normal' 'green' ) + if [[ "$OS" == "OSX" ]]; then - load_avg_5min=$(sysctl vm.loadavg | grep -o -E '[0-9]+(\.|,)[0-9]+' | head -n 1) + load_avg_1min=$(sysctl vm.loadavg | grep -o -E '[0-9]+(\.|,)[0-9]+' | head -n 1) else - load_avg_5min=$(grep -o "[0-9.]*" /proc/loadavg | head -n 1) + load_avg_1min=$(grep -o "[0-9.]*" /proc/loadavg | head -n 1) fi # Replace comma - load_avg_5min=${load_avg_5min//,/.} + load_avg_1min=${load_avg_1min//,/.} - if [[ "$load_avg_5min" -gt 10 ]]; then + if [[ "$load_avg_1min" -gt $(bc -l <<< "${cores} * 0.7") ]]; then current_state="critical" - elif [[ "$load_avg_5min" -gt 3 ]]; then + elif [[ "$load_avg_1min" -gt $(bc -l <<< "${cores} * 0.5") ]]; then current_state="warning" else current_state="normal" fi - "$1_prompt_segment" "${0}_${current_state}" "$2" "${load_states[$current_state]}" "$DEFAULT_COLOR" "$load_avg_5min" 'LOAD_ICON' + "$1_prompt_segment" "${0}_${current_state}" "$2" "${load_states[$current_state]}" "$DEFAULT_COLOR" "$load_avg_1min" 'LOAD_ICON' } # Node version From d2728f0dd1fd301f6de2250053485553673aafd3 Mon Sep 17 00:00:00 2001 From: David McKay Date: Mon, 25 Apr 2016 07:08:36 +0100 Subject: [PATCH 50/94] Consolidated if statements and fixed OSX cpu cores command --- powerlevel9k.zsh-theme | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 4fd7ecf4..0f321bc3 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -580,12 +580,6 @@ prompt_load() { local current_state="unknown" local cores - if [[ "$OS" == "OSX" ]]; then - cores=$(sysctl -a | grep machdep.cpu) - else - cores=$(nproc) - fi - typeset -AH load_states load_states=( 'critical' 'red' @@ -595,8 +589,10 @@ prompt_load() { if [[ "$OS" == "OSX" ]]; then load_avg_1min=$(sysctl vm.loadavg | grep -o -E '[0-9]+(\.|,)[0-9]+' | head -n 1) + cores=$(sysctl -n hw.physicalcpu) else load_avg_1min=$(grep -o "[0-9.]*" /proc/loadavg | head -n 1) + cores=$(nproc) fi # Replace comma From 1c17acb758d6f07cad1d7f76f937271830482dec Mon Sep 17 00:00:00 2001 From: Clement Bourgeois Date: Fri, 29 Apr 2016 12:13:26 +0200 Subject: [PATCH 51/94] Fix incorrect background jobs number --- powerlevel9k.zsh-theme | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index d583eaab..8fa3646f 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -322,6 +322,10 @@ prompt_aws_eb_env() { set_default POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE true prompt_background_jobs() { local background_jobs_number=${$(jobs -l | wc -l)// /} + local wrong_lines=`jobs -l | awk '/pwd now/{ count++ } END {print count}'` + if [[ wrong_lines -gt 0 ]]; then + background_jobs_number=$(( $background_jobs_number - $wrong_lines )) + fi if [[ background_jobs_number -gt 0 ]]; then local background_jobs_number_print="" if [[ "$POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE" == "true" ]] && [[ "$background_jobs_number" -gt 1 ]]; then From 61a0cee4f513f71c17737abd2fe1d3d5e9aa67e7 Mon Sep 17 00:00:00 2001 From: David McKay Date: Mon, 2 May 2016 15:35:43 +0100 Subject: [PATCH 52/94] Using logical CPUs, as it's a fairer reflection of CPU load --- powerlevel9k.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 0f321bc3..224e34cc 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -589,7 +589,7 @@ prompt_load() { if [[ "$OS" == "OSX" ]]; then load_avg_1min=$(sysctl vm.loadavg | grep -o -E '[0-9]+(\.|,)[0-9]+' | head -n 1) - cores=$(sysctl -n hw.physicalcpu) + cores=$(sysctl -n hw.logicalcpu) else load_avg_1min=$(grep -o "[0-9.]*" /proc/loadavg | head -n 1) cores=$(nproc) From ec25e3b3af394991b36e86dadd1378e449790df4 Mon Sep 17 00:00:00 2001 From: "Thuan (Duong Tien)" Date: Wed, 4 May 2016 21:16:16 +0700 Subject: [PATCH 53/94] [ADD] PYTHON_ICON --- functions/icons.zsh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/functions/icons.zsh b/functions/icons.zsh index 6de09ee8..b4a1f32f 100644 --- a/functions/icons.zsh +++ b/functions/icons.zsh @@ -69,7 +69,8 @@ case $POWERLEVEL9K_MODE in VCS_REMOTE_BRANCH_ICON ' '$'\UE804 ' #  VCS_GIT_ICON $'\UE20E ' #  VCS_HG_ICON $'\UE1C3 ' #  - RUST_ICON '' + RUST_ICON '' + PYTHON_ICON '' ) ;; 'awesome-fontconfig') @@ -121,7 +122,8 @@ case $POWERLEVEL9K_MODE in VCS_REMOTE_BRANCH_ICON ' '$'\UF204 ' #  VCS_GIT_ICON $'\UF113 ' #  VCS_HG_ICON $'\UF0C3 ' #  - RUST_ICON $'\UE6A8' #  + RUST_ICON $'\UE6A8' #  + PYTHON_ICON $'\UE63C' #  ) ;; *) @@ -173,7 +175,8 @@ case $POWERLEVEL9K_MODE in VCS_REMOTE_BRANCH_ICON $'\u2192' # → VCS_GIT_ICON '' VCS_HG_ICON '' - RUST_ICON '' + RUST_ICON '' + PYTHON_ICON '' ) ;; esac From 086cd1fdcf17f722602a72718520582556ceb18e Mon Sep 17 00:00:00 2001 From: "Thuan (Duong Tien)" Date: Wed, 4 May 2016 21:48:46 +0700 Subject: [PATCH 54/94] [ADD] python icon in virtualenv prompt --- powerlevel9k.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index bf313b85..285f4f02 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -930,7 +930,7 @@ prompt_vi_mode() { prompt_virtualenv() { local virtualenv_path="$VIRTUAL_ENV" if [[ -n "$virtualenv_path" && "$VIRTUAL_ENV_DISABLE_PROMPT" != true ]]; then - "$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" "($(basename "$virtualenv_path"))" + "$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" "$(basename "$virtualenv_path")" 'PYTHON_ICON' fi } From 47879f4b7bab7932188f35b2ec2a8ddc26fbdc59 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Tue, 24 May 2016 02:31:52 +0200 Subject: [PATCH 55/94] Refactor location installation path code Now it is possible to set the installation path by setting POWERLEVEL9K_INSTALLATION_PATH. If set, this path will always be used. If it was not set manually, we try to determine the path automatically. --- powerlevel9k.zsh-theme | 55 +++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index bf313b85..16f4589d 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -20,43 +20,44 @@ #zstyle ':vcs_info:*+*:*' debug true #set -o xtrace -# Check if the theme was called as a function (e.g., from prezto) -if [[ $(whence -w prompt_powerlevel9k_setup) =~ "function" ]]; then +# Try to set the installation path +if [[ -n "$POWERLEVEL9K_INSTALLATION_PATH" ]]; then + # If an installation path was set manually, + # it should trump any other location found. + # Do nothing. This is all right, as we use the + # POWERLEVEL9K_INSTALLATION_PATH for further processing. +elif [[ $(whence -w prompt_powerlevel9k_setup) =~ "function" ]]; then + # Check if the theme was called as a function (e.g., from prezto) autoload -U is-at-least if is-at-least 5.0.8; then # Try to find the correct path of the script. - 0=$(whence -v $0 | sed "s/$0 is a shell function from //") + POWERLEVEL9K_INSTALLATION_PATH=$(whence -v $0 | sed "s/$0 is a shell function from //") elif [[ -f "${ZDOTDIR:-$HOME}/.zprezto/modules/prompt/init.zsh" ]]; then # If there is an prezto installation, we assume that powerlevel9k is linked there. - 0="${ZDOTDIR:-$HOME}/.zprezto/modules/prompt/functions/prompt_powerlevel9k_setup" - else - # Fallback: specify an installation path! - if [[ -z "$POWERLEVEL9K_INSTALLATION_PATH" ]]; then - print -P "%F{red}We could not locate the installation path of powerlevel9k.%f" - print -P "Please specify by setting %F{blue}POWERLEVEL9K_INSTALLATION_PATH%f (full path incl. file name) at the very beginning of your ~/.zshrc" - return 1 - elif [[ -L "$POWERLEVEL9K_INSTALLATION_PATH" ]]; then - # Symlink - 0="$POWERLEVEL9K_INSTALLATION_PATH" - elif [[ -f "$POWERLEVEL9K_INSTALLATION_PATH" ]]; then - # File - 0="$POWERLEVEL9K_INSTALLATION_PATH" - elif [[ -d "$POWERLEVEL9K_INSTALLATION_PATH" ]]; then - # Directory - 0="${POWERLEVEL9K_INSTALLATION_PATH}/powerlevel9k.zsh-theme" - fi + POWERLEVEL9K_INSTALLATION_PATH="${ZDOTDIR:-$HOME}/.zprezto/modules/prompt/functions/prompt_powerlevel9k_setup" fi +else + # Last resort: Set installation path is script path + POWERLEVEL9K_INSTALLATION_PATH="$0" fi -# If this theme is sourced as a symlink, we need to locate the true URL -if [[ -L $0 ]]; then - # Script is a symlink - filename="$(realpath -P $0 2>/dev/null || readlink -f $0 2>/dev/null || perl -MCwd=abs_path -le 'print abs_path readlink(shift);' $0 2>/dev/null)" -elif [[ -f $0 ]]; then +# Resolve the instllation path +if [[ -L "$POWERLEVEL9K_INSTALLATION_PATH" ]]; then + # If this theme is sourced as a symlink, we need to locate the real URL + filename="$(realpath -P $POWERLEVEL9K_INSTALLATION_PATH 2>/dev/null || readlink -f $POWERLEVEL9K_INSTALLATION_PATH 2>/dev/null || perl -MCwd=abs_path -le 'print abs_path readlink(shift);' $POWERLEVEL9K_INSTALLATION_PATH 2>/dev/null)" +elif [[ -d "$POWERLEVEL9K_INSTALLATION_PATH" ]]; then + # Directory + filename="${POWERLEVEL9K_INSTALLATION_PATH}/powerlevel9k.zsh-theme" +elif [[ -f "$POWERLEVEL9K_INSTALLATION_PATH" ]]; then # Script is a file - filename="$0" + filename="$POWERLEVEL9K_INSTALLATION_PATH" +elif [[ -z "$POWERLEVEL9K_INSTALLATION_PATH" ]]; then + # Fallback: specify an installation path! + print -P "%F{red}We could not locate the installation path of powerlevel9k.%f" + print -P "Please specify by setting %F{blue}POWERLEVEL9K_INSTALLATION_PATH%f (full path incl. file name) at the very beginning of your ~/.zshrc" + return 1 else - print -P "%F{red}Script location could not be found!%f" + print -P "%F{red}Script location could not be found! Maybe your %F{blue}POWERLEVEL9K_INSTALLATION_PATH%F{red} is not correct?%f" return 1 fi script_location="$(dirname $filename)" From 89fdfa0148fe1c3360a9e2d09fe0f7a5e9b0ceec Mon Sep 17 00:00:00 2001 From: "Mateus \"Doodad\" Medeiros" Date: Tue, 24 May 2016 10:53:48 -0300 Subject: [PATCH 56/94] Make prompt_custom not print the segment if empty Currently you can't make a conditional custom segment. This changes the prompt_custom function responsible for printing custom segments so that it won't print the segment in case the content is empty. With this it becomes possible to make conditional custom prompts simply by making it not print anything when it's not supposed to be shown. --- powerlevel9k.zsh-theme | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index bf313b85..d5c2c8bb 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -444,8 +444,11 @@ prompt_context() { # the output in a segment. prompt_custom() { local command=POWERLEVEL9K_CUSTOM_$3:u + local segment_content="$(eval ${(P)command})" - "$1_prompt_segment" "${0}_${3:u}" "$2" $DEFAULT_COLOR_INVERTED $DEFAULT_COLOR "$(eval ${(P)command})" + if [[ -n $segment_content ]]; then + "$1_prompt_segment" "${0}_${3:u}" "$2" $DEFAULT_COLOR_INVERTED $DEFAULT_COLOR "$segment_content" + fi } # Dir: current working directory From 99429ab26818d539418ac6345679d38f18b32faf Mon Sep 17 00:00:00 2001 From: Sudarshan Wadkar Date: Sat, 14 May 2016 14:00:40 -0400 Subject: [PATCH 57/94] Add new pyenv segment to show active python version This commit provides a new segment `pyenv` to show current python environment. This prompt can be used in place of `virtualenv` segment. However, it is targeted at users of [pyenv](https://github.com/yyuu/pyenv) and not meant to replace the `virtualenv` segment. The prompt works by parsing output of `pyenv version` and displaying the first word of the output as segment text. The design (color etc.) is same as the `virtualenv` segment including the icon. The segment would need to be revisited if `pyenv version` changes its output format. Tested on my personal machines (Mac OSX 10.11.4 and Ubuntu 15.04). --- README.md | 1 + powerlevel9k.zsh-theme | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/README.md b/README.md index b954d03e..bff47f24 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,7 @@ The segments that are currently available are: * **Python Segments:** * `virtualenv` - Your Python [VirtualEnv](https://virtualenv.pypa.io/en/latest/). * [`anaconda`](#anaconda) - Your active [Anaconda](https://www.continuum.io/why-anaconda) environment. + * `pyenv` - Your active python version as reported by the first word of [`pyenv version`](https://github.com/yyuu/pyenv). Note that the segment is not displayed if that word is _system_ i.e. the segment is inactive if you are using system python. * **Ruby Segments:** * [`chruby`](#chruby) - Ruby environment information using `chruby` (if one is active). * [`rbenv`](#rbenv) - Ruby environment information using `rbenv` (if one is active). diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 4206bf51..080c9df1 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -935,6 +935,22 @@ prompt_virtualenv() { fi } +# pyenv: current active python version (with restrictions) +# More information on pyenv (Python version manager like rbenv and rvm): +# https://github.com/yyuu/pyenv +# the prompt parses output of pyenv version and only displays the first word +prompt_pyenv() { + local pyenv_version="$(pyenv version 2>/dev/null)" + pyenv_version="${pyenv_version%% *}" + # XXX: The following should return the same as above. + # This reads better for devs familiar with sed/awk/grep/cut utilities + # Using shell expansion/substitution may hamper future maintainability + #local pyenv_version="$(pyenv version 2>/dev/null | head -n1 | cut -d' ' -f1)" + if [[ -n "$pyenv_version" && "$pyenv_version" != "system" ]]; then + "$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" "$pyenv_version" 'PYTHON_ICON' + fi +} + ################################################################ # Prompt processing and drawing ################################################################ From 19ceb0837251241a0717935e9ed6cb9fef310b52 Mon Sep 17 00:00:00 2001 From: Andrew Scott Date: Sun, 12 Jun 2016 14:01:10 +0100 Subject: [PATCH 58/94] Only match first name in package.json This ensures that the following package.json extract would just give the prompt "foo" rather than "foo\nbar". { "name": "foo", "author": { "name": "bar", } } --- powerlevel9k.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 4206bf51..cb5f68ea 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -489,7 +489,7 @@ prompt_dir() { # Parse the 'name' from the package.json; if there are any problems, just # print the file path - if name=$( cat "$package_path/package.json" 2> /dev/null | grep "\"name\""); then + if name=$( cat "$package_path/package.json" 2> /dev/null | grep -m 1 "\"name\""); then name=$(echo $name | awk -F ':' '{print $2}' | awk -F '"' '{print $2}') # Instead of printing out the full path, print out the name of the package From c3019d11ef2a8e1b550b4d05e22473ef6e3e8596 Mon Sep 17 00:00:00 2001 From: Andrew Scott Date: Thu, 2 Jun 2016 01:49:00 +0100 Subject: [PATCH 59/94] Handle shorting path when in the .git directory `git rev-parse --git-dir` returns just `.` when in the top level of a`.git` directory. This would cause a problem when extracting the package_path. Closes #271 --- powerlevel9k.zsh-theme | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 4206bf51..b3873429 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -475,6 +475,10 @@ prompt_dir() { package_path="." subdirectory_path="" else + # Handle the edge case where $repo_path is '.' due to the current directory being the .git directory. + if [[ "$repo_path" == "." ]]; then + repo_path=$(pwd) + fi # If the current path is something else, get the path to the package.json # file by finding the repo path and removing the '.git` from the path package_path=${repo_path:0:-4} From d720b725e8644072a240be924eec09d1f0d21edb Mon Sep 17 00:00:00 2001 From: Andrew Scott Date: Tue, 14 Jun 2016 11:58:33 +0100 Subject: [PATCH 60/94] Use git's show-toplevel to get top level directory --- powerlevel9k.zsh-theme | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index b3873429..0bbeb7c5 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -467,30 +467,18 @@ prompt_dir() { local name repo_path package_path current_dir zero # Get the path of the Git repo, which should have the package.json file - if repo_path=$(git rev-parse --git-dir 2>/dev/null); then - if [[ "$repo_path" == ".git" ]]; then - # If the current path is the root of the project, then the package path is - # the current directory and we don't want to append anything to represent - # the path to a subdirectory - package_path="." - subdirectory_path="" - else - # Handle the edge case where $repo_path is '.' due to the current directory being the .git directory. - if [[ "$repo_path" == "." ]]; then - repo_path=$(pwd) - fi - # If the current path is something else, get the path to the package.json - # file by finding the repo path and removing the '.git` from the path - package_path=${repo_path:0:-4} - zero='%([BSUbfksu]|([FB]|){*})' - current_dir=$(pwd) - # Then, find the length of the package_path string, and save the - # subdirectory path as a substring of the current directory's path from 0 - # to the length of the package path's string - subdirectory_path=$(truncatePathFromRight "/${current_dir:${#${(S%%)package_path//$~zero/}}}") - fi + if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == "true" ]]; then + package_path=$(git rev-parse --show-toplevel) + elif [[ $(git rev-parse --is-inside-git-dir 2> /dev/null) == "true" ]]; then + package_path=${$(pwd)%%/.git*} fi + zero='%([BSUbfksu]|([FB]|){*})' + current_dir=$(pwd) + # Then, find the length of the package_path string, and save the + # subdirectory path as a substring of the current directory's path from 0 + # to the length of the package path's string + subdirectory_path=$(truncatePathFromRight "${current_dir:${#${(S%%)package_path//$~zero/}}}") # Parse the 'name' from the package.json; if there are any problems, just # print the file path if name=$( cat "$package_path/package.json" 2> /dev/null | grep "\"name\""); then From 19ccfa64eb37541793c16e68ab7c519819d91ba6 Mon Sep 17 00:00:00 2001 From: Dan Miller Date: Thu, 16 Jun 2016 22:33:09 -0700 Subject: [PATCH 61/94] Add option for non-verbose battery --- powerlevel9k.zsh-theme | 2 ++ 1 file changed, 2 insertions(+) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index d5c2c8bb..c4b74c9c 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -419,6 +419,8 @@ prompt_battery() { set_default POWERLEVEL9K_BATTERY_VERBOSE true if [[ "$POWERLEVEL9K_BATTERY_VERBOSE" == true ]]; then message="$bat_percent%%$remain" + else + message="$bat_percent%%" fi # Draw the prompt_segment From d39e57f4d73b0c7c8bd4d7363e3bf98fdbde5dd2 Mon Sep 17 00:00:00 2001 From: Dan Miller Date: Thu, 16 Jun 2016 22:35:53 -0700 Subject: [PATCH 62/94] Update README with POWERLEVEL9K_BATTERY_VERBOSE option --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b954d03e..5b4a45d1 100644 --- a/README.md +++ b/README.md @@ -177,6 +177,7 @@ requires `acpi` on Linux). |`POWERLEVEL9K_BATTERY_DISCONNECTED`|`$DEFAULT_COLOR`|Color to indicate absence of battery.| |`POWERLEVEL9K_BATTERY_LOW_THRESHOLD`|`10`|Threshold to consider battery level critical.| |`POWERLEVEL9K_BATTERY_LOW_COLOR`|`"red"`|Color to indicate critically low charge level.| +|`POWERLEVEL9K_BATTERY_VERBOSE`|`true`|Display time remaining next to battery level.| Note that you can [modify the `_FOREGROUND` color](https://github.com/bhilburn/powerlevel9k/wiki/Stylizing-Your-Prompt#segment-color-customization) From f50ac9edd8ff5ab5b0fcfbe4c54ab3e5dedcca72 Mon Sep 17 00:00:00 2001 From: Marin Gilles Date: Thu, 23 Jun 2016 07:51:02 +0200 Subject: [PATCH 63/94] Changed python icon to snake --- functions/icons.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/icons.zsh b/functions/icons.zsh index b4a1f32f..c2565f26 100644 --- a/functions/icons.zsh +++ b/functions/icons.zsh @@ -70,7 +70,7 @@ case $POWERLEVEL9K_MODE in VCS_GIT_ICON $'\UE20E ' #  VCS_HG_ICON $'\UE1C3 ' #  RUST_ICON '' - PYTHON_ICON '' + PYTHON_ICON $'\U1F40D' # 🐍 ) ;; 'awesome-fontconfig') @@ -123,7 +123,7 @@ case $POWERLEVEL9K_MODE in VCS_GIT_ICON $'\UF113 ' #  VCS_HG_ICON $'\UF0C3 ' #  RUST_ICON $'\UE6A8' #  - PYTHON_ICON $'\UE63C' #  + PYTHON_ICON $'\U1F40D' # 🐍 ) ;; *) From 20b4d2b43e91c2e347eed057acb62269d66aac25 Mon Sep 17 00:00:00 2001 From: "Mateus \"Doodad\" Medeiros" Date: Tue, 24 May 2016 10:53:48 -0300 Subject: [PATCH 64/94] Make prompt_custom not print the segment if empty Currently you can't make a conditional custom segment. This changes the prompt_custom function responsible for printing custom segments so that it won't print the segment in case the content is empty. With this it becomes possible to make conditional custom prompts simply by making it not print anything when it's not supposed to be shown. --- powerlevel9k.zsh-theme | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index ef6d0a5a..088a7372 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -445,8 +445,11 @@ prompt_context() { # the output in a segment. prompt_custom() { local command=POWERLEVEL9K_CUSTOM_$3:u + local segment_content="$(eval ${(P)command})" - "$1_prompt_segment" "${0}_${3:u}" "$2" $DEFAULT_COLOR_INVERTED $DEFAULT_COLOR "$(eval ${(P)command})" + if [[ -n $segment_content ]]; then + "$1_prompt_segment" "${0}_${3:u}" "$2" $DEFAULT_COLOR_INVERTED $DEFAULT_COLOR "$segment_content" + fi } # Dir: current working directory From d7c449be34ffdd3449a7e984442fcc5d9552154e Mon Sep 17 00:00:00 2001 From: "ruifeng.shan" Date: Fri, 17 Jun 2016 18:08:39 +0800 Subject: [PATCH 65/94] revise mac battery error when mac default date use linux's --- powerlevel9k.zsh-theme | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 088a7372..8fa623a1 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -360,7 +360,7 @@ prompt_battery() { local time_remaining=$(echo $raw_data | grep TimeRemaining | awk '{ print $5 }') if [[ -n $time_remaining ]]; then # this value is set to a very high number when the system is calculating - [[ $time_remaining -gt 10000 ]] && local tstring="..." || local tstring=${(f)$(date -u -r $(($time_remaining * 60)) +%k:%M)} + [[ $time_remaining -gt 10000 ]] && local tstring="..." || local tstring=${(f)$(/bin/date -u -r $(($time_remaining * 60)) +%k:%M)} fi # Get charge values @@ -1088,3 +1088,4 @@ powerlevel9k_init() { } powerlevel9k_init "$@" + From 4666bd49e631cf61befd959c55e2a83a5b87a932 Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Thu, 7 Jul 2016 13:51:26 -0400 Subject: [PATCH 66/94] Now printing a warning if $LANG is set incorrectly. --- powerlevel9k.zsh-theme | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 8fa623a1..2b4f0dbd 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -1052,13 +1052,23 @@ powerlevel9k_init() { # Display a warning if the terminal does not support 256 colors local term_colors term_colors=$(echotc Co) - if (( term_colors < 256 )); then + if (( $term_colors < 256 )); then print -P "%F{red}WARNING!%f Your terminal appears to support less 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 + # If the terminal `LANG` is set to `C`, this theme will not work at all. + local term_lang + term_lang=$(echo $LANG) + if [[ $term_lang == 'C' ]]; then + print -P "\t%F{red}WARNING!%f Your terminal's 'LANG' is set to 'C', which breaks this theme!" + print -P "\t%F{red}WARNING!%f Please set your 'LANG' to a UTF-8 language, like 'en_US.UTF-8'" + print -P "\t%F{red}WARNING!%f _before_ loading this theme in your \~\.zshrc. Putting" + print -P "\t%F{red}WARNING!%f %F{blue}export LANG=\"en_US.UTF-8\"%f at the top of your \~\/.zshrc is sufficient." + fi + # Display a warning if deprecated segments are in use. typeset -AH deprecated_segments # old => new From ef2d01a2aa4ce3c6edcef990f780b8babcae8d07 Mon Sep 17 00:00:00 2001 From: Chris Hudson Date: Thu, 7 Jul 2016 22:40:26 +0100 Subject: [PATCH 67/94] Added POWERLEVEL9K_VCS_HIDE_TAGS variable to control displaying of vcs tags in segment --- README.md | 4 +++- functions/vcs.zsh | 38 ++++++++++++++++++++------------------ 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index bff47f24..63908782 100644 --- a/README.md +++ b/README.md @@ -348,8 +348,10 @@ customization is provided via: |`POWERLEVEL9K_SHOW_CHANGESET`|`false`|Set to `true` to display the hash / changeset in the segment.| |`POWERLEVEL9K_CHANGESET_HASH_LENGTH`|`12`|How many characters of the hash / changeset to display in the segment.| |`POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY`|`true`|Set to `false` to not reflect submodule status in the top-level repository prompt.| +|`POWERLEVEL9K_VCS_HIDE_TAGS`|unset|Set to `true` to stop tags being displayed in the segment.| -**vcs Symbols** + +##### vcs symbols The `vcs` segment uses various symbols to tell you the state of your repository. These symbols depend on your installed font and selected `POWERLEVEL9K_MODE` diff --git a/functions/vcs.zsh b/functions/vcs.zsh index 15f0177e..b2d87d30 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -61,24 +61,26 @@ function +vi-git-remotebranch() { } function +vi-git-tagname() { - # If we are on a tag, append the tagname to the current branch string. - local tag - tag=$(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 $(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=$(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}" + if [[ -z "${POWERLEVE9K_VCS_HIDE_TAGS}" ]]; then + # If we are on a tag, append the tagname to the current branch string. + local tag + tag=$(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 $(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=$(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 } From 3291b4d476fdd43a2a111f811f99f1ee088843e4 Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Tue, 12 Jul 2016 20:28:01 -0400 Subject: [PATCH 68/94] Merging ability to hide tags from VCS segment. --- README.md | 2 +- functions/vcs.zsh | 43 ++++++++++++++++++++++--------------------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 63908782..164b484f 100644 --- a/README.md +++ b/README.md @@ -348,7 +348,7 @@ customization is provided via: |`POWERLEVEL9K_SHOW_CHANGESET`|`false`|Set to `true` to display the hash / changeset in the segment.| |`POWERLEVEL9K_CHANGESET_HASH_LENGTH`|`12`|How many characters of the hash / changeset to display in the segment.| |`POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY`|`true`|Set to `false` to not reflect submodule status in the top-level repository prompt.| -|`POWERLEVEL9K_VCS_HIDE_TAGS`|unset|Set to `true` to stop tags being displayed in the segment.| +|`POWERLEVEL9K_VCS_HIDE_TAGS`|`false`|Set to `true` to stop tags being displayed in the segment.| ##### vcs symbols diff --git a/functions/vcs.zsh b/functions/vcs.zsh index b2d87d30..657a0f3f 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -60,29 +60,30 @@ function +vi-git-remotebranch() { fi } +set_default POWERLEVEL9K_VCS_HIDE_TAGS false function +vi-git-tagname() { - if [[ -z "${POWERLEVE9K_VCS_HIDE_TAGS}" ]]; then - # If we are on a tag, append the tagname to the current branch string. - local tag - tag=$(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 $(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=$(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 + if [[ "$POWERLEVE9K_VCS_HIDE_TAGS" == "false" ]]; then + # If we are on a tag, append the tagname to the current branch string. + local tag + tag=$(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 $(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=$(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 - fi } # Show count of stashed changes From 9d172f58c2fe8502e005b413cf22cf99df015907 Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Tue, 12 Jul 2016 21:07:51 -0400 Subject: [PATCH 69/94] Finally adding a license to powerlevel9k --- LICENSE | 20 ++++++++++++++++++++ README.md | 3 +++ 2 files changed, 23 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..5466ba8d --- /dev/null +++ b/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2014-2016 Ben Hilburn + +MIT LICENSE + +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. diff --git a/README.md b/README.md index 6583624c..d2e40da0 100644 --- a/README.md +++ b/README.md @@ -402,3 +402,6 @@ portion of the wiki to get going. [The Wiki also has a ton of other useful information!](https://github.com/bhilburn/powerlevel9k/wiki) + +### License +MIT From ec53035b1314ad56918d65b7fce833d1ecbe3548 Mon Sep 17 00:00:00 2001 From: Andrew Scott Date: Thu, 11 Aug 2016 21:26:11 +0100 Subject: [PATCH 70/94] Handle spaces in path when shortening --- powerlevel9k.zsh-theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 2a875f34..a1d18cb1 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -466,7 +466,7 @@ prompt_dir() { current_path=$(pwd | sed -e "s,^$HOME,~," | sed $SED_EXTENDED_REGEX_PARAMETER "s/([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})[^/]+([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})\//\1$POWERLEVEL9K_SHORTEN_DELIMITER\2\//g") ;; truncate_from_right) - current_path=$(truncatePathFromRight $(pwd | sed -e "s,^$HOME,~,") ) + current_path=$(truncatePathFromRight "$(pwd | sed -e "s,^$HOME,~,")" ) ;; truncate_with_package_name) local name repo_path package_path current_dir zero @@ -493,7 +493,7 @@ prompt_dir() { # from the package.json and append the current subdirectory current_path="`echo $name | tr -d '"'`$subdirectory_path" else - current_path=$(truncatePathFromRight $(pwd | sed -e "s,^$HOME,~,") ) + current_path=$(truncatePathFromRight "$(pwd | sed -e "s,^$HOME,~,")" ) fi ;; *) From 8a62fceb7b114d3121cd3d67c03a99e945eadcce Mon Sep 17 00:00:00 2001 From: Lion Krischer Date: Fri, 15 Jul 2016 16:26:37 +0200 Subject: [PATCH 71/94] Much faster conda env detection - no more file I/O needed. --- powerlevel9k.zsh-theme | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index a1d18cb1..57058a70 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -291,13 +291,8 @@ CURRENT_BG='NONE' # Anaconda Environment prompt_anaconda() { - if $(hash ack 2>/dev/null); then - local active_conda_env=$(where conda | ack -o '(?<=envs/)[\w-]+(?=/bin)') - else - local active_conda_env=$(where conda | grep -o -P '(?<=envs/)[\w-]+(?=/bin)') - fi - if [[ -n $active_conda_env ]]; then - "$1_prompt_segment" "$0" "$2" "green" "black" "($active_conda_env)" "" + if ! [ -z ${CONDA_ENV_PATH+x} ]; then + "$1_prompt_segment" "$0" "$2" "green" "black" "($(basename $CONDA_ENV_PATH))" "" fi } From c382c538f0a74a5c551f741ced723ac39fdb3aa2 Mon Sep 17 00:00:00 2001 From: Lion Krischer Date: Fri, 15 Jul 2016 17:02:46 +0200 Subject: [PATCH 72/94] Make the conda prompt fully configurable --- powerlevel9k.zsh-theme | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 57058a70..4aeb68a4 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -292,7 +292,13 @@ CURRENT_BG='NONE' # Anaconda Environment prompt_anaconda() { if ! [ -z ${CONDA_ENV_PATH+x} ]; then - "$1_prompt_segment" "$0" "$2" "green" "black" "($(basename $CONDA_ENV_PATH))" "" + # config - can be overwritten in users' zshrc file. + defined POWERLEVEL9K_ANACONDA_BG_COLOR || POWERLEVEL9K_ANACONDA_BG_COLOR=green + defined POWERLEVEL9K_ANACONDA_FG_COLOR || POWERLEVEL9K_ANACONDA_FG_COLOR=black + defined POWERLEVEL9K_ANACONDA_PREFIX || POWERLEVEL9K_ANACONDA_PREFIX="" + defined POWERLEVEL9K_ANACONDA_LEFT_DELIMITER || POWERLEVEL9K_ANACONDA_LEFT_DELIMITER="(" + defined POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER || POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER=")" + "$1_prompt_segment" "$0" "$2" "$POWERLEVEL9K_ANACONDA_BG_COLOR" "$POWERLEVEL9K_ANACONDA_FG_COLOR" "$POWERLEVEL9K_ANACONDA_PREFIX$POWERLEVEL9K_ANACONDA_LEFT_DELIMITER$(basename $CONDA_ENV_PATH)$POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER" "" fi } From fb211bc04cce1f3bd46a6d7c6463ef4b24691438 Mon Sep 17 00:00:00 2001 From: Lion Krischer Date: Fri, 15 Jul 2016 17:20:00 +0200 Subject: [PATCH 73/94] Document all the conda prompt changes --- README.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d2e40da0..8478fb3a 100644 --- a/README.md +++ b/README.md @@ -140,13 +140,18 @@ The segments that are currently available are: ##### anaconda -This segment shows your active anaconda environment. +This segment shows your active anaconda environment. It relies on the +`CONDA_ENV_PATH` environment variable to be set which happens when you properly +`source activate` an environment. -*Note: This segment relies on a perl-regex with lookbehind. -If `ack` is not available the segment will try to use `grep`. -Recent versions of grep offer a `-P` option to handle such things. -On OSX, however, you want to install gnu-grep (e.g. via `brew install grep`) -and alias the newly installed `ggrep` to `grep`. Alternatively, `brew install ack`.* + +| Variable | Default Value | Description | +|----------|---------------|-------------| +|`POWERLEVEL9K_ANACONDA_BG_COLOR`|"green"|Background color of the segment.| +|`POWERLEVEL9K_ANACONDA_FG_COLOR`|"black"|Foreground color of the segment.| +|`POWERLEVEL9K_ANACONDA_PREFIX`|""|Prefix before the environment name.| +|`POWERLEVEL9K_ANACONDA_LEFT_DELIMITER`|"("|The left delimiter just before the environment name.| +|`POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER`|")"|The right delimiter just after the environment name.| ##### aws From 97e5684e5272429ae40acd4528716f64585be0a5 Mon Sep 17 00:00:00 2001 From: Lion Krischer Date: Tue, 26 Jul 2016 11:39:00 +0200 Subject: [PATCH 74/94] Adapting to newer conda version --- powerlevel9k.zsh-theme | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 4aeb68a4..1f3d1ad6 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -291,14 +291,17 @@ CURRENT_BG='NONE' # Anaconda Environment prompt_anaconda() { - if ! [ -z ${CONDA_ENV_PATH+x} ]; then + # Depending on the conda version, either might be set. This + # variant works even if both are set. + _path=$CONDA_ENV_PATH$CONDA_PREFIX + if ! [ -z "$_path" ]; then # config - can be overwritten in users' zshrc file. defined POWERLEVEL9K_ANACONDA_BG_COLOR || POWERLEVEL9K_ANACONDA_BG_COLOR=green defined POWERLEVEL9K_ANACONDA_FG_COLOR || POWERLEVEL9K_ANACONDA_FG_COLOR=black defined POWERLEVEL9K_ANACONDA_PREFIX || POWERLEVEL9K_ANACONDA_PREFIX="" defined POWERLEVEL9K_ANACONDA_LEFT_DELIMITER || POWERLEVEL9K_ANACONDA_LEFT_DELIMITER="(" defined POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER || POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER=")" - "$1_prompt_segment" "$0" "$2" "$POWERLEVEL9K_ANACONDA_BG_COLOR" "$POWERLEVEL9K_ANACONDA_FG_COLOR" "$POWERLEVEL9K_ANACONDA_PREFIX$POWERLEVEL9K_ANACONDA_LEFT_DELIMITER$(basename $CONDA_ENV_PATH)$POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER" "" + "$1_prompt_segment" "$0" "$2" "$POWERLEVEL9K_ANACONDA_BG_COLOR" "$POWERLEVEL9K_ANACONDA_FG_COLOR" "$POWERLEVEL9K_ANACONDA_PREFIX$POWERLEVEL9K_ANACONDA_LEFT_DELIMITER$(basename $_path)$POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER" "" fi } From 50b978ddc8a8fd6f6372a66043526147eaba5046 Mon Sep 17 00:00:00 2001 From: Lion Krischer Date: Wed, 31 Aug 2016 00:21:01 +0200 Subject: [PATCH 75/94] Using default color setters --- README.md | 4 ++-- powerlevel9k.zsh-theme | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8478fb3a..f1d1bbeb 100644 --- a/README.md +++ b/README.md @@ -147,8 +147,8 @@ This segment shows your active anaconda environment. It relies on the | Variable | Default Value | Description | |----------|---------------|-------------| -|`POWERLEVEL9K_ANACONDA_BG_COLOR`|"green"|Background color of the segment.| -|`POWERLEVEL9K_ANACONDA_FG_COLOR`|"black"|Foreground color of the segment.| +|`POWERLEVEL9K_ANACONDA_BACKGROUND`|"green"|Background color of the segment.| +|`POWERLEVEL9K_ANACONDA_FOREGROUND`|"black"|Foreground color of the segment.| |`POWERLEVEL9K_ANACONDA_PREFIX`|""|Prefix before the environment name.| |`POWERLEVEL9K_ANACONDA_LEFT_DELIMITER`|"("|The left delimiter just before the environment name.| |`POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER`|")"|The right delimiter just after the environment name.| diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 1f3d1ad6..93927f72 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -296,12 +296,10 @@ prompt_anaconda() { _path=$CONDA_ENV_PATH$CONDA_PREFIX if ! [ -z "$_path" ]; then # config - can be overwritten in users' zshrc file. - defined POWERLEVEL9K_ANACONDA_BG_COLOR || POWERLEVEL9K_ANACONDA_BG_COLOR=green - defined POWERLEVEL9K_ANACONDA_FG_COLOR || POWERLEVEL9K_ANACONDA_FG_COLOR=black defined POWERLEVEL9K_ANACONDA_PREFIX || POWERLEVEL9K_ANACONDA_PREFIX="" defined POWERLEVEL9K_ANACONDA_LEFT_DELIMITER || POWERLEVEL9K_ANACONDA_LEFT_DELIMITER="(" defined POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER || POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER=")" - "$1_prompt_segment" "$0" "$2" "$POWERLEVEL9K_ANACONDA_BG_COLOR" "$POWERLEVEL9K_ANACONDA_FG_COLOR" "$POWERLEVEL9K_ANACONDA_PREFIX$POWERLEVEL9K_ANACONDA_LEFT_DELIMITER$(basename $_path)$POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER" "" + "$1_prompt_segment" "$0" "$2" "$3" "$4" "$POWERLEVEL9K_ANACONDA_PREFIX$POWERLEVEL9K_ANACONDA_LEFT_DELIMITER$(basename $_path)$POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER" "" fi } From 35beead4308a164797fe4bd9026d860628064888 Mon Sep 17 00:00:00 2001 From: Lion Krischer Date: Wed, 31 Aug 2016 00:23:38 +0200 Subject: [PATCH 76/94] Using set_default function --- powerlevel9k.zsh-theme | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 93927f72..c956cac8 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -296,9 +296,9 @@ prompt_anaconda() { _path=$CONDA_ENV_PATH$CONDA_PREFIX if ! [ -z "$_path" ]; then # config - can be overwritten in users' zshrc file. - defined POWERLEVEL9K_ANACONDA_PREFIX || POWERLEVEL9K_ANACONDA_PREFIX="" - defined POWERLEVEL9K_ANACONDA_LEFT_DELIMITER || POWERLEVEL9K_ANACONDA_LEFT_DELIMITER="(" - defined POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER || POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER=")" + set_default POWERLEVEL9K_ANACONDA_PREFIX "" + set_default POWERLEVEL9K_ANACONDA_LEFT_DELIMITER "(" + set_default POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER ")" "$1_prompt_segment" "$0" "$2" "$3" "$4" "$POWERLEVEL9K_ANACONDA_PREFIX$POWERLEVEL9K_ANACONDA_LEFT_DELIMITER$(basename $_path)$POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER" "" fi } From 9bc55ab175f2bf48e6673327df7e814de35f9d1e Mon Sep 17 00:00:00 2001 From: Lion Krischer Date: Wed, 31 Aug 2016 00:31:33 +0200 Subject: [PATCH 77/94] Using default way of setting icons and updating doc --- README.md | 15 +++++++++------ powerlevel9k.zsh-theme | 3 +-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index f1d1bbeb..2d031706 100644 --- a/README.md +++ b/README.md @@ -140,19 +140,22 @@ The segments that are currently available are: ##### anaconda -This segment shows your active anaconda environment. It relies on the -`CONDA_ENV_PATH` environment variable to be set which happens when you properly -`source activate` an environment. +This segment shows your active anaconda environment. It relies on either the +`CONDA_ENV_PATH` or the `CONDA_PREFIX` (depending on the `conda` version) +environment variable to be set which happens when you properly `source +activate` an environment. +Special configuration variables: | Variable | Default Value | Description | |----------|---------------|-------------| -|`POWERLEVEL9K_ANACONDA_BACKGROUND`|"green"|Background color of the segment.| -|`POWERLEVEL9K_ANACONDA_FOREGROUND`|"black"|Foreground color of the segment.| -|`POWERLEVEL9K_ANACONDA_PREFIX`|""|Prefix before the environment name.| |`POWERLEVEL9K_ANACONDA_LEFT_DELIMITER`|"("|The left delimiter just before the environment name.| |`POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER`|")"|The right delimiter just after the environment name.| +Additionally the following segment specific parameters can be used to customize +it: `POWERLEVEL9K_PYTHON_ICON`, `POWERLEVEL9K_ANACONDA_BACKGROUND`, and +`POWERLEVEL9K_ANACONDA_FOREGROUND`. + ##### aws If you would like to display the [current AWS diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index c956cac8..b9af0cfa 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -296,10 +296,9 @@ prompt_anaconda() { _path=$CONDA_ENV_PATH$CONDA_PREFIX if ! [ -z "$_path" ]; then # config - can be overwritten in users' zshrc file. - set_default POWERLEVEL9K_ANACONDA_PREFIX "" set_default POWERLEVEL9K_ANACONDA_LEFT_DELIMITER "(" set_default POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER ")" - "$1_prompt_segment" "$0" "$2" "$3" "$4" "$POWERLEVEL9K_ANACONDA_PREFIX$POWERLEVEL9K_ANACONDA_LEFT_DELIMITER$(basename $_path)$POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER" "" + "$1_prompt_segment" "$0" "$2" "$3" "$4" "$POWERLEVEL9K_ANACONDA_LEFT_DELIMITER$(basename $_path)$POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER" 'PYTHON_ICON' fi } From 55f061c04d469805faafadb85f18e9eb1cf0eb3f Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Thu, 11 Aug 2016 15:50:13 -0400 Subject: [PATCH 78/94] Enabling subversion support for the `vcs` segment. --- powerlevel9k.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index a1d18cb1..78db2c1d 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -861,7 +861,7 @@ prompt_vcs() { VCS_CHANGESET_PREFIX="$(print_icon 'VCS_COMMIT_ICON')%0.$POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH""i " fi - zstyle ':vcs_info:*' enable git hg + zstyle ':vcs_info:*' enable git hg svn zstyle ':vcs_info:*' check-for-changes true VCS_DEFAULT_FORMAT="$VCS_CHANGESET_PREFIX%b%c%u%m" From 62e41ada1fe6db11cd08e6fee73532aa5af50254 Mon Sep 17 00:00:00 2001 From: Christian Rebischke Date: Thu, 25 Aug 2016 23:13:15 +0200 Subject: [PATCH 79/94] added vi-svn-detect-changes() in functions/vcs.zsh --- functions/vcs.zsh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/functions/vcs.zsh b/functions/vcs.zsh index 657a0f3f..66c6a0d2 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -113,6 +113,8 @@ function +vi-vcs-detect-changes() { vcs_visual_identifier='VCS_GIT_ICON' 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 @@ -121,3 +123,15 @@ function +vi-vcs-detect-changes() { VCS_WORKDIR_DIRTY=false fi } + +function +vi-svn-detect-changes() { + local svn_status=$(svn status) + if [[ -n "$(echo "$svn_status" | grep \^\?)" ]]; then + VCS_WORKDIR_DIRTY=true + elif [[ -n "$(echo "$svn_status" | grep \^\A)" ]]; then + VCS_WORKDIR_HALF_DIRTY=true + else + VCS_WORKDIR_DIRTY=false + VCS_WORKDIR_HALF_DIRTY=false + fi +} From 31589a5097107da29a48b4aaf151f52df23fdfee Mon Sep 17 00:00:00 2001 From: Christian Rebischke Date: Thu, 25 Aug 2016 23:15:55 +0200 Subject: [PATCH 80/94] added svn hooks.. hope this works --- powerlevel9k.zsh-theme | 2 ++ 1 file changed, 2 insertions(+) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 78db2c1d..3d7a913a 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -876,6 +876,8 @@ prompt_vcs() { zstyle ':vcs_info:git*+set-message:*' hooks $POWERLEVEL9K_VCS_GIT_HOOKS defined POWERLEVEL9K_VCS_HG_HOOKS || POWERLEVEL9K_VCS_HG_HOOKS=(vcs-detect-changes) zstyle ':vcs_info:hg*+set-message:*' hooks $POWERLEVEL9K_VCS_HG_HOOKS + defined POWERLEVEL9K_VCS_SVN_HOOKS || POWERLEVEL9K_VCS_SVN_HOOKS=(svn-detect-changes) + zstyle ':vcs_info:svn*+set-message:*' hooks $POWERLEVEL9K_VCS_SVN_HOOKS # For Hg, only show the branch name zstyle ':vcs_info:hg*:*' branchformat "$(print_icon 'VCS_BRANCH_ICON')%b" From e134c70bc16c3b58d02bcb58b11fc402d005562e Mon Sep 17 00:00:00 2001 From: Christian Rebischke Date: Thu, 25 Aug 2016 23:31:00 +0200 Subject: [PATCH 81/94] swapped half and full dirty in svn-detect-changes --- functions/vcs.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/vcs.zsh b/functions/vcs.zsh index 66c6a0d2..6cea3e8c 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -127,9 +127,9 @@ function +vi-vcs-detect-changes() { function +vi-svn-detect-changes() { local svn_status=$(svn status) if [[ -n "$(echo "$svn_status" | grep \^\?)" ]]; then - VCS_WORKDIR_DIRTY=true - elif [[ -n "$(echo "$svn_status" | grep \^\A)" ]]; then VCS_WORKDIR_HALF_DIRTY=true + elif [[ -n "$(echo "$svn_status" | grep \^\A)" ]]; then + VCS_WORKDIR_DIRTY=true else VCS_WORKDIR_DIRTY=false VCS_WORKDIR_HALF_DIRTY=false From 3b0da2c3489fd65543d9b116d4aaa7d1405fff32 Mon Sep 17 00:00:00 2001 From: Christian Rebischke Date: Thu, 25 Aug 2016 23:51:16 +0200 Subject: [PATCH 82/94] fixed svn-detect-changes().. the svn prompt has now the same behaviour as the git prompt.. --- functions/vcs.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/functions/vcs.zsh b/functions/vcs.zsh index 6cea3e8c..50b58fbf 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -127,11 +127,11 @@ function +vi-vcs-detect-changes() { function +vi-svn-detect-changes() { local svn_status=$(svn status) if [[ -n "$(echo "$svn_status" | grep \^\?)" ]]; then + hook_com[unstaged]+=" $(print_icon 'VCS_STASH_ICON')" VCS_WORKDIR_HALF_DIRTY=true - elif [[ -n "$(echo "$svn_status" | grep \^\A)" ]]; then + fi + if [[ -n "$(echo "$svn_status" | grep \^\A)" ]]; then VCS_WORKDIR_DIRTY=true - else - VCS_WORKDIR_DIRTY=false - VCS_WORKDIR_HALF_DIRTY=false + hook_com[unstaged]+=" $(print_icon 'VCS_STAGED_ICON')" fi } From 683ca10e369ae6699197e81f6fd5aec44c05c4f1 Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Tue, 30 Aug 2016 20:29:36 -0400 Subject: [PATCH 83/94] vcs: adding detection of unstaged / staged for svn repos --- functions/icons.zsh | 7 +++++-- functions/vcs.zsh | 12 ++++++++---- powerlevel9k.zsh-theme | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/functions/icons.zsh b/functions/icons.zsh index c2565f26..3542ce81 100644 --- a/functions/icons.zsh +++ b/functions/icons.zsh @@ -69,6 +69,7 @@ case $POWERLEVEL9K_MODE in VCS_REMOTE_BRANCH_ICON ' '$'\UE804 ' #  VCS_GIT_ICON $'\UE20E ' #  VCS_HG_ICON $'\UE1C3 ' #  + VCS_SVN_ICON '(svn) ' RUST_ICON '' PYTHON_ICON $'\U1F40D' # 🐍 ) @@ -122,7 +123,8 @@ case $POWERLEVEL9K_MODE in VCS_REMOTE_BRANCH_ICON ' '$'\UF204 ' #  VCS_GIT_ICON $'\UF113 ' #  VCS_HG_ICON $'\UF0C3 ' #  - RUST_ICON $'\UE6A8' #  + VCS_SVN_ICON '(svn) ' + RUST_ICON $'\UE6A8' #  PYTHON_ICON $'\U1F40D' # 🐍 ) ;; @@ -175,7 +177,8 @@ case $POWERLEVEL9K_MODE in VCS_REMOTE_BRANCH_ICON $'\u2192' # → VCS_GIT_ICON '' VCS_HG_ICON '' - RUST_ICON '' + VCS_SVN_ICON '' + RUST_ICON '' PYTHON_ICON '' ) ;; diff --git a/functions/vcs.zsh b/functions/vcs.zsh index 50b58fbf..9418df81 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -113,8 +113,8 @@ function +vi-vcs-detect-changes() { vcs_visual_identifier='VCS_GIT_ICON' elif [[ "${hook_com[vcs]}" == "hg" ]]; then vcs_visual_identifier='VCS_HG_ICON' -# elif [[ "${hook_com[vcs]}" == "svn" ]]; then -# vcs_visual_identifier='VCS_SVN_ICON' + elif [[ "${hook_com[vcs]}" == "svn" ]]; then + vcs_visual_identifier='VCS_SVN_ICON' fi if [[ -n "${hook_com[staged]}" ]] || [[ -n "${hook_com[unstaged]}" ]]; then @@ -127,11 +127,15 @@ function +vi-vcs-detect-changes() { function +vi-svn-detect-changes() { local svn_status=$(svn status) if [[ -n "$(echo "$svn_status" | grep \^\?)" ]]; then - hook_com[unstaged]+=" $(print_icon 'VCS_STASH_ICON')" + 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 - hook_com[unstaged]+=" $(print_icon 'VCS_STAGED_ICON')" fi } diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 3d7a913a..bf09b4ce 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -876,7 +876,7 @@ prompt_vcs() { zstyle ':vcs_info:git*+set-message:*' hooks $POWERLEVEL9K_VCS_GIT_HOOKS defined POWERLEVEL9K_VCS_HG_HOOKS || POWERLEVEL9K_VCS_HG_HOOKS=(vcs-detect-changes) zstyle ':vcs_info:hg*+set-message:*' hooks $POWERLEVEL9K_VCS_HG_HOOKS - defined POWERLEVEL9K_VCS_SVN_HOOKS || POWERLEVEL9K_VCS_SVN_HOOKS=(svn-detect-changes) + defined POWERLEVEL9K_VCS_SVN_HOOKS || POWERLEVEL9K_VCS_SVN_HOOKS=(vcs-detect-changes svn-detect-changes) zstyle ':vcs_info:svn*+set-message:*' hooks $POWERLEVEL9K_VCS_SVN_HOOKS # For Hg, only show the branch name From 520eed12482b276e630d66b01a3f5852c96b6b1f Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Thu, 11 Aug 2016 16:17:03 -0400 Subject: [PATCH 84/94] Removing `zle-*` overrides, appear fixed in new ZSH. --- powerlevel9k.zsh-theme | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index e81aa6f2..19886435 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -1029,30 +1029,6 @@ $(print_icon 'MULTILINE_SECOND_PROMPT_PREFIX')" fi } -function zle-line-init { - powerlevel9k_prepare_prompts - if (( ${+terminfo[smkx]} )); then - printf '%s' ${terminfo[smkx]} - fi - zle reset-prompt - zle -R -} - -function zle-line-finish { - powerlevel9k_prepare_prompts - if (( ${+terminfo[rmkx]} )); then - printf '%s' ${terminfo[rmkx]} - fi - zle reset-prompt - zle -R -} - -function zle-keymap-select { - powerlevel9k_prepare_prompts - zle reset-prompt - zle -R -} - powerlevel9k_init() { # Display a warning if the terminal does not support 256 colors local term_colors @@ -1096,10 +1072,6 @@ powerlevel9k_init() { # prepare prompts add-zsh-hook precmd powerlevel9k_prepare_prompts - - zle -N zle-line-init - zle -N zle-line-finish - zle -N zle-keymap-select } powerlevel9k_init "$@" From c4fdc8f70804fea6f543e6bbf3964301e2537e36 Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Thu, 11 Aug 2016 15:40:05 -0400 Subject: [PATCH 85/94] Improved speed of `prompt_vcs` by 50%-66%. --- functions/utilities.zsh | 16 +++++++++++++++- powerlevel9k.zsh-theme | 23 +++++++++++++++-------- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/functions/utilities.zsh b/functions/utilities.zsh index eed6ccc5..c9bd2e46 100644 --- a/functions/utilities.zsh +++ b/functions/utilities.zsh @@ -122,6 +122,20 @@ if [[ "$OS" == 'OSX' ]]; then 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 @@ -131,7 +145,7 @@ print_deprecation_warning() { raw_deprecated_segments=(${(kvP@)1}) for key in ${(@k)raw_deprecated_segments}; do - if [[ -n "${POWERLEVEL9K_LEFT_PROMPT_ELEMENTS[(r)$key]}" ]] || [[ -n "${POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS[(r)$key]}" ]]; then + 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 diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 19886435..0860cff4 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -837,7 +837,7 @@ prompt_todo() { set_default POWERLEVEL9K_VCS_ACTIONFORMAT_FOREGROUND "red" # Default: Just display the first 8 characters of our changeset-ID. set_default POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH "8" -prompt_vcs() { +powerlevel9k_vcs_init() { if [[ -n "$POWERLEVEL9K_CHANGESET_HASH_LENGTH" ]]; then POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH="$POWERLEVEL9K_CHANGESET_HASH_LENGTH" fi @@ -849,8 +849,7 @@ prompt_vcs() { VCS_WORKDIR_HALF_DIRTY=false # The vcs segment can have three different states - defaults to 'clean'. - local current_state="" - typeset -AH vcs_states + typeset -gAH vcs_states vcs_states=( 'clean' 'green' 'modified' 'yellow' @@ -890,6 +889,12 @@ prompt_vcs() { if [[ "$POWERLEVEL9K_SHOW_CHANGESET" == true ]]; then zstyle ':vcs_info:*' get-revision true fi +} + +prompt_vcs() { + VCS_WORKDIR_DIRTY=false + VCS_WORKDIR_HALF_DIRTY=false + current_state="" # Actually invoke vcs_info manually to gather all information. vcs_info @@ -954,11 +959,8 @@ prompt_pyenv() { ################################################################ # Prompt processing and drawing ################################################################ - # Main prompt build_left_prompt() { - defined POWERLEVEL9K_LEFT_PROMPT_ELEMENTS || POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir rbenv vcs) - local index=1 for element in "${POWERLEVEL9K_LEFT_PROMPT_ELEMENTS[@]}"; do # Remove joined information in direct calls @@ -980,8 +982,6 @@ build_left_prompt() { # Right prompt build_right_prompt() { - defined POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS || POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status root_indicator background_jobs history time) - local index=1 for element in "${POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS[@]}"; do # Remove joined information in direct calls @@ -1050,6 +1050,9 @@ powerlevel9k_init() { print -P "\t%F{red}WARNING!%f %F{blue}export LANG=\"en_US.UTF-8\"%f at the top of your \~\/.zshrc is sufficient." fi + defined POWERLEVEL9K_LEFT_PROMPT_ELEMENTS || POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir rbenv vcs) + defined POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS || POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status root_indicator background_jobs history time) + # Display a warning if deprecated segments are in use. typeset -AH deprecated_segments # old => new @@ -1067,6 +1070,10 @@ powerlevel9k_init() { # initialize colors autoload -U colors && colors + if segment_in_use "vcs"; then + powerlevel9k_vcs_init + fi + # initialize hooks autoload -Uz add-zsh-hook From 3f1f11a1f1fa18d8bb250b03c45ca6fc49bfbfd9 Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Mon, 26 Sep 2016 13:54:43 -0400 Subject: [PATCH 86/94] bugfix: typo in "POWERLEVEL9K" broke the VCS tag display --- functions/vcs.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/vcs.zsh b/functions/vcs.zsh index 9418df81..f1ff8891 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -62,7 +62,7 @@ function +vi-git-remotebranch() { set_default POWERLEVEL9K_VCS_HIDE_TAGS false function +vi-git-tagname() { - if [[ "$POWERLEVE9K_VCS_HIDE_TAGS" == "false" ]]; then + if [[ "$POWERLEVEL9K_VCS_HIDE_TAGS" == "false" ]]; then # If we are on a tag, append the tagname to the current branch string. local tag tag=$(git describe --tags --exact-match HEAD 2>/dev/null) From 9b7fffe1a8d213c8de734836c5bcd5d5c5ad0a4c Mon Sep 17 00:00:00 2001 From: Arav Singhal Date: Fri, 30 Sep 2016 21:32:22 +0530 Subject: [PATCH 87/94] Make status prompt show OK in non-verbose mode * The status prompt now shows the OK icon even in non-verbose mode. A toggle may be added to this effect in the future. --- powerlevel9k.zsh-theme | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 0860cff4..08100a41 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -740,16 +740,14 @@ prompt_rvm() { # Status: return code if verbose, otherwise just an icon if an error occurred set_default POWERLEVEL9K_STATUS_VERBOSE true prompt_status() { - if [[ "$POWERLEVEL9K_STATUS_VERBOSE" == true ]]; then - if [[ "$RETVAL" -ne 0 ]]; then + if [[ "$RETVAL" -ne 0 ]]; then + if [[ "$POWERLEVEL9K_STATUS_VERBOSE" == true ]]; then "$1_prompt_segment" "$0_ERROR" "$2" "red" "226" "$RETVAL" 'CARRIAGE_RETURN_ICON' else - "$1_prompt_segment" "$0_OK" "$2" "$DEFAULT_COLOR" "046" "" 'OK_ICON' - fi - else - if [[ "$RETVAL" -ne 0 ]]; then "$1_prompt_segment" "$0_ERROR" "$2" "$DEFAULT_COLOR" "red" "" 'FAIL_ICON' fi + else + "$1_prompt_segment" "$0_OK" "$2" "$DEFAULT_COLOR" "046" "" 'OK_ICON' fi } @@ -1082,4 +1080,3 @@ powerlevel9k_init() { } powerlevel9k_init "$@" - From 894699351d59fe1b7b8d7d1b368a2d1515aa93bb Mon Sep 17 00:00:00 2001 From: Jack Q Date: Wed, 5 Oct 2016 09:08:32 +0800 Subject: [PATCH 88/94] fix load and ram indicator support for BSD --- powerlevel9k.zsh-theme | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 0860cff4..87678149 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -590,9 +590,13 @@ prompt_load() { 'normal' 'green' ) - if [[ "$OS" == "OSX" ]]; then + if [[ "$OS" == "OSX" ]] || [[ "$OS" == "BSD" ]]; then load_avg_1min=$(sysctl vm.loadavg | grep -o -E '[0-9]+(\.|,)[0-9]+' | head -n 1) - cores=$(sysctl -n hw.logicalcpu) + if [[ "$OS" == "OSX" ]]; then + cores=$(sysctl -n hw.logicalcpu) + else + cores=$(sysctl -n hw.ncpu) + fi else load_avg_1min=$(grep -o "[0-9.]*" /proc/loadavg | head -n 1) cores=$(nproc) @@ -665,8 +669,13 @@ prompt_ram() { # Convert pages into Bytes ramfree=$(( ramfree * 4096 )) else - ramfree=$(grep -o -E "MemFree:\s+[0-9]+" /proc/meminfo | grep -o "[0-9]*") - base='K' + if [[ "$OS" == "BSD" ]]; then + ramfree=$(vmstat | grep -E '([0-9]+\w+)+' | awk '{print $5}') + base='M' + else + ramfree=$(grep -o -E "MemFree:\s+[0-9]+" /proc/meminfo | grep -o "[0-9]*") + base='K' + fi fi "$1_prompt_segment" "$0" "$2" "yellow" "$DEFAULT_COLOR" "$(printSizeHumanReadable "$ramfree" $base)" 'RAM_ICON' From ef1e2c99b609d6a420ee8370064a5ed4a588e71a Mon Sep 17 00:00:00 2001 From: bsidhipong Date: Sun, 16 Oct 2016 22:28:43 -0500 Subject: [PATCH 89/94] Changed \u and \U to reflect number of hex digits to follow Some unicode icon strings were set with \uHHHHH which showed the wrong characters on some implementations of zsh (linux and macOS). Changed \uHHHHH to \UHHHHH and conversely changed \UHHHH to \uHHHH. --- functions/icons.zsh | 180 ++++++++++++++++++++++---------------------- 1 file changed, 90 insertions(+), 90 deletions(-) diff --git a/functions/icons.zsh b/functions/icons.zsh index 3542ce81..2f30cff2 100644 --- a/functions/icons.zsh +++ b/functions/icons.zsh @@ -20,55 +20,55 @@ case $POWERLEVEL9K_MODE in # 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_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' #  - RUBY_ICON $'\UE847 ' #  - AWS_ICON $'\UE895' #  + LEFT_SUBSEGMENT_SEPARATOR $'\uE0B1' #  + RIGHT_SUBSEGMENT_SEPARATOR $'\uE0B3' #  + CARRIAGE_RETURN_ICON $'\u21B5' # ↵ + ROOT_ICON $'\uE801' #  + RUBY_ICON $'\uE847 ' #  + AWS_ICON $'\uE895' #  AWS_EB_ICON $'\U1F331 ' # 🌱 - BACKGROUND_JOBS_ICON $'\UE82F ' #  - TEST_ICON $'\UE891' #  - TODO_ICON $'\U2611' # ☑ - BATTERY_ICON $'\UE894' #  - OK_ICON $'\U2713' # ✓ - FAIL_ICON $'\U2718' # ✘ + BACKGROUND_JOBS_ICON $'\uE82F ' #  + TEST_ICON $'\uE891' #  + TODO_ICON $'\u2611' # ☑ + BATTERY_ICON $'\uE894' #  + OK_ICON $'\u2713' # ✓ + FAIL_ICON $'\u2718' # ✘ SYMFONY_ICON 'SF' - NODE_ICON $'\U2B22' # ⬢ - MULTILINE_FIRST_PROMPT_PREFIX $'\U256D'$'\U2500' - MULTILINE_SECOND_PROMPT_PREFIX $'\U2570'$'\U2500 ' - APPLE_ICON $'\UE26E' #  + NODE_ICON $'\u2B22' # ⬢ + MULTILINE_FIRST_PROMPT_PREFIX $'\u256D'$'\U2500' + MULTILINE_SECOND_PROMPT_PREFIX $'\u2570'$'\U2500 ' + APPLE_ICON $'\uE26E' #  FREEBSD_ICON $'\U1F608 ' # 😈 - LINUX_ICON $'\UE271' #  + LINUX_ICON $'\uE271' #  SUNOS_ICON $'\U1F31E ' # 🌞 - HOME_ICON $'\UE12C' #  - HOME_SUB_ICON $'\UE18D' #  - FOLDER_ICON $'\UE818' #  - NETWORK_ICON $'\UE1AD' #  - 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 ' '$'\UE804 ' #  - VCS_GIT_ICON $'\UE20E ' #  - VCS_HG_ICON $'\UE1C3 ' #  + HOME_ICON $'\uE12C' #  + HOME_SUB_ICON $'\uE18D' #  + FOLDER_ICON $'\uE818' #  + NETWORK_ICON $'\uE1AD' #  + 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 ' '$'\uE804 ' #  + VCS_GIT_ICON $'\uE20E ' #  + VCS_HG_ICON $'\uE1C3 ' #  VCS_SVN_ICON '(svn) ' RUST_ICON '' PYTHON_ICON $'\U1F40D' # 🐍 @@ -78,53 +78,53 @@ case $POWERLEVEL9K_MODE in # fontconfig with awesome-font required! See # https://github.com/gabrielelana/awesome-terminal-fonts icons=( - LEFT_SEGMENT_SEPARATOR $'\UE0B0' #  - RIGHT_SEGMENT_SEPARATOR $'\UE0B2' #  + 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' # ↵ + LEFT_SUBSEGMENT_SEPARATOR $'\uE0B1' #  + RIGHT_SUBSEGMENT_SEPARATOR $'\uE0B3' #  + CARRIAGE_RETURN_ICON $'\u21B5' # ↵ ROOT_ICON $'\uF201' #  - RUBY_ICON $'\UF219 ' #  - AWS_ICON $'\UF296' #  + RUBY_ICON $'\uF219 ' #  + AWS_ICON $'\uF296' #  AWS_EB_ICON $'\U1F331 ' # 🌱 - BACKGROUND_JOBS_ICON $'\UF013 ' #  - TEST_ICON $'\UF291' #  - TODO_ICON $'\U2611' # ☑ - BATTERY_ICON $'\u1F50B' # 🔋 - OK_ICON $'\UF23A' #  - FAIL_ICON $'\UF281' #  + BACKGROUND_JOBS_ICON $'\uF013 ' #  + TEST_ICON $'\uF291' #  + TODO_ICON $'\u2611' # ☑ + BATTERY_ICON $'\U1F50B' # 🔋 + OK_ICON $'\uF23A' #  + FAIL_ICON $'\uF281' #  SYMFONY_ICON 'SF' - NODE_ICON $'\U2B22' # ⬢ - MULTILINE_FIRST_PROMPT_PREFIX $'\U256D'$'\U2500' # ╭─ - MULTILINE_SECOND_PROMPT_PREFIX $'\U2570'$'\U2500 ' # ╰─ - APPLE_ICON $'\UF179' #  + NODE_ICON $'\u2B22' # ⬢ + MULTILINE_FIRST_PROMPT_PREFIX $'\u256D'$'\U2500' # ╭─ + MULTILINE_SECOND_PROMPT_PREFIX $'\u2570'$'\U2500 ' # ╰─ + APPLE_ICON $'\uF179' #  FREEBSD_ICON $'\U1F608 ' # 😈 - LINUX_ICON $'\UF17C' #  - SUNOS_ICON $'\UF185 ' #  - HOME_ICON $'\UF015' #  - HOME_SUB_ICON $'\UF07C' #  - FOLDER_ICON $'\UF115' #  - NETWORK_ICON $'\UF09E' #  - LOAD_ICON $'\UF080 ' #  - SWAP_ICON $'\UF0E4' #  - RAM_ICON $'\UF0E4' #  - SERVER_ICON $'\UF296' #  - 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 ' '$'\UF204 ' #  - VCS_GIT_ICON $'\UF113 ' #  - VCS_HG_ICON $'\UF0C3 ' #  + LINUX_ICON $'\uF17C' #  + SUNOS_ICON $'\uF185 ' #  + HOME_ICON $'\uF015' #  + HOME_SUB_ICON $'\uF07C' #  + FOLDER_ICON $'\uF115' #  + NETWORK_ICON $'\uF09E' #  + LOAD_ICON $'\uF080 ' #  + SWAP_ICON $'\uF0E4' #  + RAM_ICON $'\uF0E4' #  + SERVER_ICON $'\uF296' #  + 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 ' '$'\uF204 ' #  + VCS_GIT_ICON $'\uF113 ' #  + VCS_HG_ICON $'\uF0C3 ' #  VCS_SVN_ICON '(svn) ' - RUST_ICON $'\UE6A8' #  + RUST_ICON $'\uE6A8' #  PYTHON_ICON $'\U1F40D' # 🐍 ) ;; @@ -135,17 +135,17 @@ case $POWERLEVEL9K_MODE in 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' # ↵ + LEFT_SUBSEGMENT_SEPARATOR $'\uE0B1' #  + RIGHT_SUBSEGMENT_SEPARATOR $'\uE0B3' #  + CARRIAGE_RETURN_ICON $'\u21B5' # ↵ ROOT_ICON $'\u26A1' # ⚡ RUBY_ICON '' AWS_ICON 'AWS:' AWS_EB_ICON $'\U1F331 ' # 🌱 BACKGROUND_JOBS_ICON $'\u2699' # ⚙ TEST_ICON '' - TODO_ICON $'\U2611' # ☑ - BATTERY_ICON $'\u1F50B' # 🔋 + TODO_ICON $'\u2611' # ☑ + BATTERY_ICON $'\U1F50B' # 🔋 OK_ICON $'\u2713' # ✓ FAIL_ICON $'\u2718' # ✘ SYMFONY_ICON 'SF' From bddbdd62e841d6e008e95fe2f0909d5b32e623a8 Mon Sep 17 00:00:00 2001 From: Matt Traynham Date: Wed, 19 Oct 2016 09:35:23 -0400 Subject: [PATCH 90/94] Fix '+vi-svn-detect-changes:local:1: not valid in this context' --- functions/vcs.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/vcs.zsh b/functions/vcs.zsh index 9418df81..a0aa2b6c 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -125,7 +125,7 @@ function +vi-vcs-detect-changes() { } function +vi-svn-detect-changes() { - local svn_status=$(svn status) + 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 From cde591ce2e8034a181a2321365ee662f54dc2d63 Mon Sep 17 00:00:00 2001 From: Arav Singhal Date: Thu, 27 Oct 2016 11:42:21 +0530 Subject: [PATCH 91/94] Add toggle for showing OK in non verbose status Adds the toggle POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE for more customizability. If POWERLEVEL9K_STATUS_VERBOSE is false and POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE is true, the status prompt will show the OK visual identifier like in verbose mode. The prompt will show the OK identifier even if POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE is false in verbose mode. --- powerlevel9k.zsh-theme | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 08100a41..eae2cd73 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -739,6 +739,7 @@ prompt_rvm() { # Status: return code if verbose, otherwise just an icon if an error occurred set_default POWERLEVEL9K_STATUS_VERBOSE true +set_default POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE false prompt_status() { if [[ "$RETVAL" -ne 0 ]]; then if [[ "$POWERLEVEL9K_STATUS_VERBOSE" == true ]]; then @@ -746,7 +747,7 @@ prompt_status() { else "$1_prompt_segment" "$0_ERROR" "$2" "$DEFAULT_COLOR" "red" "" 'FAIL_ICON' fi - else + elif [[ "$POWERLEVEL9K_STATUS_VERBOSE" == true || "$POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE" == true ]]; then "$1_prompt_segment" "$0_OK" "$2" "$DEFAULT_COLOR" "046" "" 'OK_ICON' fi } From b129cd09e00202a7f3c1d43e3e60a9e2da1e076c Mon Sep 17 00:00:00 2001 From: Arav Singhal Date: Thu, 27 Oct 2016 12:11:33 +0530 Subject: [PATCH 92/94] Describe OK in non-verbose toggle in README --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2d031706..8cdf7be2 100644 --- a/README.md +++ b/README.md @@ -317,7 +317,8 @@ This segment shows the return code of the last command. | Variable | Default Value | Description | |----------|---------------|-------------| -|`POWERLEVEL9K_STATUS_VERBOSE`|`true`|Set to false if you wish to hide this segment when the last command completed successfully.| +|`POWERLEVEL9K_STATUS_VERBOSE`|`true`|Set to false if you wish to not show the error code when the last command returned an error and optionally hide this segment when the last command completed successfully by setting `POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE` to false.| +|`POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE`|`false`|Set to true if you wish to show this segment when the last command completed successfully in non-verbose mode.| ##### ram From 1edb74ba91912ea9acefe091f854eaa8de8ce14e Mon Sep 17 00:00:00 2001 From: Arav Singhal Date: Thu, 27 Oct 2016 13:01:02 +0530 Subject: [PATCH 93/94] Consider delimiter length in dir truncate right Truncating the path from the right now takes in account the delimiter length, so that directories with names shorter than truncated name + delimiter are displayed properly. For example, if SHORTEN_DIR_LENGTH is 4 and the delimiter is "..", "../tests/.." and "../custom/.." are not incorrectly "truncated" to "../test../.." and "../cust../..", both of which are longer or the same length as the original. --- functions/utilities.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/functions/utilities.zsh b/functions/utilities.zsh index c9bd2e46..f27c7f99 100644 --- a/functions/utilities.zsh +++ b/functions/utilities.zsh @@ -204,5 +204,7 @@ function segmentShouldBeJoined() { # Given a directory path, truncate it according to the settings for # `truncate_from_right` function truncatePathFromRight() { - echo $1 | sed $SED_EXTENDED_REGEX_PARAMETER "s/([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})[^/]+\//\1$POWERLEVEL9K_SHORTEN_DELIMITER\//g" + local delim_len=${#POWERLEVEL9K_SHORTEN_DELIMITER} + echo $1 | sed $SED_EXTENDED_REGEX_PARAMETER \ + "s@(([^/]{$((POWERLEVEL9K_SHORTEN_DIR_LENGTH))})([^/]{$delim_len}))[^/]+/@\2$POWERLEVEL9K_SHORTEN_DELIMITER/@g" } From 8d7a4e462ae93169be59c07a06c269fc254aa96b Mon Sep 17 00:00:00 2001 From: Arav Singhal Date: Thu, 27 Oct 2016 13:23:22 +0530 Subject: [PATCH 94/94] Update test for required behavior --- test/segments/dir.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/segments/dir.spec b/test/segments/dir.spec index 035addea..840a298b 100755 --- a/test/segments/dir.spec +++ b/test/segments/dir.spec @@ -60,7 +60,7 @@ function testTruncationFromRightWorks() { mkdir -p $FOLDER cd $FOLDER - assertEquals "%K{blue} %F{black}/tm…/po…/1/12/12…/12…/12…/12…/12…/12…/123456789 %k%F{blue}%f " "$(build_left_prompt)" + assertEquals "%K{blue} %F{black}/tmp/po…/1/12/123/12…/12…/12…/12…/12…/123456789 %k%F{blue}%f " "$(build_left_prompt)" cd - rm -fr /tmp/powerlevel9k-test