[
  {
    "path": "COPYRIGHT",
    "content": "Short version for non-laywers:\n  The shellder project is dual-licensed under Apache 2.0 and MIT terms.\n\nLonger version:\n  Copyright 2015-2020 Hyeon Kim\n\n  Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n  http://www.apache.org/licenses/LICENSE-2.0> or the MIT license\n  <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your\n  option. This file may not be copied, modified, or distributed\n  except according to those terms.\n"
  },
  {
    "path": "LICENSE-APACHE",
    "content": "\n                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [yyyy] [name of copyright owner]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "LICENSE-MIT",
    "content": "Copyright (c) 2015-2020, Hyeon Kim\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "**UNMAINTAINED**: I don't use MSYS2 anymore so I don't maintain this project\nanymore. If you want to use shellder, consider the alternatives below:\n\n1.  [powerlevel10k](https://github.com/romkatv/powerlevel10k)\n    - Lowest latency. Utilizes async tasks and gitstatusd.\n    - Only for ZSH\n    - Not suits with MSYS2 or Cygwin since it's a big shell scripts. (But who uses MSYS2/Cygwin while we have WSL2?)\n2.  [starship](https://starship.rs/)\n    - Higher latency than powerlevel10k, but still it's faster than most shell themes.\n    - Compatible with many shell environments (i.e. Powershell, bash, tcsh, fish, ...)\n    - No slowdown in MSYS2 or Cygwin since it's a Rust binary not a shell script.\n\n&nbsp;\n\n--------\n\n&nbsp;\n\n<img align=left width=175px height=175px\nsrc=\"https://raw.githubusercontent.com/simnalamburt/i/master/shellder/shellder.png\">\n\nshellder\n========\n1. **No solarized** ― xterm256 colors are beautiful enough\n2. **zsh** + **fish** support\n3. **Speed** ― Carefully optimized for slow environments like MSYS2\n\n&nbsp;\n\n![screenshot image of shellder](https://raw.githubusercontent.com/simnalamburt/i/master/shellder/screenshot.png)\n\nInstallation\n--------\nYou can install shellder via various plugin managers.\n\n### Zsh, [zinit]\n```zsh\n# ~/.zshrc\nzinit light simnalamburt/shellder\n```\n\n### Fish, [chips]\n```yaml\n# ~/.config/chips/plugin.yaml\ngithub:\n- simnalamburt/shellder\n```\n\n### Fish, [oh-my-fish]\n```yaml\n# ~/.config/chips/plugin.yaml\ngithub:\n- simnalamburt/shellder\n```\n\n&nbsp;\n\nConfiguration\n-------\nYou can turn off Fish-like path shrinking by adding the following to your `~/.zshrc`:\n\n```zsh\n# ~/.zshrc\nexport SHELLDER_KEEP_PATH=1\n```\n\nTo control path shrinking in fish shell, set `fish_prompt_pwd_dir_length` or `fish_prompt_pwd_full_dirs` environment variable. See [prompt_pwd](https://fishshell.com/docs/current/cmds/prompt_pwd.html) for the further details.\n\n&nbsp;\n\n## Fonts\nYou'll need a powerline patched font. If you don't have one, download one or\npatch some fonts on you own.\n\n- https://github.com/powerline/fonts\n- https://github.com/ryanoasis/nerd-fonts\n\n&nbsp;\n\n--------\n*shellder* is primarily distributed under the terms of both the [MIT license]\nand the [Apache License (Version 2.0)]. See [COPYRIGHT] for details.\n\n[zinit]: https://github.com/zdharma/zinit\n[chips]: https://github.com/xtendo-org/chips\n[oh-my-fish]: https://github.com/oh-my-fish/oh-my-fish\n[MIT license]: LICENSE-MIT\n[Apache License (Version 2.0)]: LICENSE-APACHE\n[COPYRIGHT]: COPYRIGHT\n"
  },
  {
    "path": "fish_mode_prompt.fish",
    "content": "function fish_mode_prompt\n    if test \"$fish_key_bindings\" = \"fish_vi_key_bindings\"\n        or test \"$fish_key_bindings\" = \"fish_hybrid_key_bindings\"\n        switch $fish_bind_mode\n            case default\n                prompt_segment blue black \"N\"\n            case insert\n                prompt_segment green black \"I\"\n            case replace_one\n                prompt_segment red black \"R\"\n            case visual\n                prompt_segment magenta black \"V\"\n        end\n    end\nend\n"
  },
  {
    "path": "fish_prompt.fish",
    "content": "# Set these options in your config.fish (if you want to :])\n#\n#     set -g theme_display_user yes\n#     set -g theme_hostname never\n#     set -g theme_hostname always\n#     set -g default_user your_normal_user\n\n\n\n# Backward compatibility\n#\n# Note: Do not depend on these behavior. These can be removed in anytime by the\n# author in the name of code readability.\nif set -q theme_hide_hostname\n  # Existing $theme_hostname will always override $theme_hide_hostname\n  if not set -q theme_hostname\n    if [ \"theme_hide_hostname\" = \"yes\" ]\n      set -g theme_hostname never\n    end\n    if [ \"theme_hide_hostname\" = \"no\" ]\n      set -g theme_hostname always\n    end\n  end\nend\n\n\n#\n# Segments functions\n#\nset -g current_bg NONE\nset -g segment_separator \\uE0B0\n\nfunction prompt_segment -d \"Function to draw a segment\"\n  set -l bg\n  set -l fg\n  if [ -n \"$argv[1]\" ]\n    set bg $argv[1]\n  else\n    set bg normal\n  end\n  if [ -n \"$argv[2]\" ]\n    set fg $argv[2]\n  else\n    set fg normal\n  end\n  if [ \"$current_bg\" != 'NONE' -a \"$argv[1]\" != \"$current_bg\" ]\n    set_color -b $bg\n    set_color $current_bg\n    echo -n \"$segment_separator \"\n    set_color -b $bg\n    set_color $fg\n  else\n    set_color -b $bg\n    set_color $fg\n    echo -n \" \"\n  end\n  set current_bg $argv[1]\n  if [ -n \"$argv[3]\" ]\n    echo -n -s $argv[3] \" \"\n  end\nend\n\nfunction prompt_finish -d \"Close open segments\"\n  if [ -n $current_bg ]\n    set_color -b normal\n    set_color $current_bg\n    echo -n \"$segment_separator \"\n  end\n  set_color normal\n  set -g current_bg NONE\nend\n\n\n#\n# Components\n#\nfunction prompt_virtual_env -d \"Display Python virtual environment\"\n  if test \"$VIRTUAL_ENV\"\n    prompt_segment white black (basename $VIRTUAL_ENV)\n  end\nend\n\n\nfunction prompt_user -d \"Display current user if different from $default_user\"\n  set -l BG 444444\n  set -l FG BCBCBC\n\n  if [ \"$theme_display_user\" = \"yes\" ]\n    if [ \"$USER\" != \"$default_user\" -o -n \"$SSH_CLIENT\" ]\n      set USER (whoami)\n      get_hostname\n      if [ $HOSTNAME_PROMPT ]\n        set USER_PROMPT $USER@$HOSTNAME_PROMPT\n      else\n        set USER_PROMPT $USER\n      end\n      prompt_segment $BG $FG $USER_PROMPT\n    end\n  else\n    get_hostname\n    if [ $HOSTNAME_PROMPT ]\n      prompt_segment $BG $FG $HOSTNAME_PROMPT\n    end\n  end\nend\n\nfunction get_hostname -d \"Set current hostname to prompt variable $HOSTNAME_PROMPT if connected via SSH\"\n  set -g HOSTNAME_PROMPT \"\"\n  if [ \"$theme_hostname\" = \"always\" -o \\( \"$theme_hostname\" != \"never\" -a -n \"$SSH_CLIENT\" \\) ]\n    set -g HOSTNAME_PROMPT (hostname)\n  end\nend\n\n\nfunction prompt_dir -d \"Display the current directory\"\n  prompt_segment 1C1C1C FFFFFF (prompt_pwd)\nend\n\n\nfunction prompt_hg -d \"Display mercurial state\"\n  set -l branch\n  set -l state\n  if command hg id >/dev/null 2>&1\n    if command hg prompt >/dev/null 2>&1\n      set branch (command hg prompt \"{branch}\")\n      set state (command hg prompt \"{status}\")\n      set branch_symbol \\uE0A0\n      if [ \"$state\" = \"!\" ]\n        prompt_segment red white \"$branch_symbol $branch ±\"\n      else if [ \"$state\" = \"?\" ]\n          prompt_segment yellow black \"$branch_symbol $branch ±\"\n        else\n          prompt_segment green black \"$branch_symbol $branch\"\n      end\n    end\n  end\nend\n\n\nfunction prompt_git -d \"Display the current git state\"\n  set -l ref\n  if command git rev-parse --is-inside-work-tree >/dev/null 2>&1\n    set ref (command git symbolic-ref HEAD 2> /dev/null)\n    if [ $status -gt 0 ]\n      set -l branch (command git show-ref --head -s --abbrev |head -n1 2> /dev/null)\n      set ref \"➦ $branch \"\n    end\n    set branch_symbol \\uE0A0\n    set -l branch (echo $ref | sed  \"s-refs/heads/-$branch_symbol -\")\n\n    set -l BG PROMPT\n    set -l dirty (command git status --porcelain --ignore-submodules=dirty 2> /dev/null)\n    if [ \"$dirty\" = \"\" ]\n      set BG green\n      set PROMPT \"$branch\"\n    else\n      set BG yellow\n      set dirty ''\n\n      # Check if there's any commit in the repo\n      set -l empty 0\n      git rev-parse --quiet --verify HEAD > /dev/null 2>&1; or set empty 1\n\n      set -l target\n      if [ $empty = 1 ]\n        # The repo is empty\n        set target '4b825dc642cb6eb9a060e54bf8d69288fbee4904'\n      else\n        # The repo is not emtpy\n        set target 'HEAD'\n\n        # Check for unstaged change only when the repo is not empty\n        set -l unstaged 0\n        git diff --no-ext-diff --ignore-submodules=dirty --quiet --exit-code; or set unstaged 1\n        if [ $unstaged = 1 ]; set dirty $dirty'●'; end\n      end\n\n      # Check for staged change\n      set -l staged 0\n      git diff-index --cached --quiet --exit-code --ignore-submodules=dirty $target; or set staged 1\n      if [ $staged = 1 ]; set dirty $dirty'✚'; end\n\n      # Check for dirty\n      if [ \"$dirty\" = \"\" ]\n        set PROMPT \"$branch\"\n      else\n        set PROMPT \"$branch $dirty\"\n      end\n    end\n    prompt_segment $BG black $PROMPT\n  end\nend\n\n\nfunction prompt_svn -d \"Display the current svn state\"\n  set -l ref\n  if command svn ls . >/dev/null 2>&1\n    set branch (svn_get_branch)\n    set branch_symbol \\uE0A0\n    set revision (svn_get_revision)\n    prompt_segment green black \"$branch_symbol $branch:$revision\"\n  end\nend\n\nfunction svn_get_branch -d \"get the current branch name\"\n  svn info 2> /dev/null | awk -F/ \\\n      '/^URL:/ { \\\n        for (i=0; i<=NF; i++) { \\\n          if ($i == \"branches\" || $i == \"tags\" ) { \\\n            print $(i+1); \\\n            break;\\\n          }; \\\n          if ($i == \"trunk\") { print $i; break; } \\\n        } \\\n      }'\nend\n\nfunction svn_get_revision -d \"get the current revision number\"\n  svn info 2> /dev/null | sed -n 's/Revision:\\ //p'\nend\n\n\nfunction prompt_status -d \"the symbols for a non zero exit status, root and background jobs\"\n    if [ $RETVAL -ne 0 ]\n      prompt_segment black red \"✘\"\n    end\n\n    # if superuser (uid == 0)\n    set -l uid (id -u $USER)\n    if [ $uid -eq 0 ]\n      prompt_segment black yellow \"⚡\"\n    end\n\n    # Jobs display\n    if [ (jobs -l | wc -l) -gt 0 ]\n      prompt_segment black cyan \"⚙\"\n    end\nend\n\nif printf '%s\\n' '2.2.0' $FISH_VERSION | sort --check=silent --version-sort\n  # Current version ≥ 2.2.0\n  function __exists -a name -d \"Check if a function or program does exist.\"\n    command -v \"$name\" ^/dev/null >&2\n  end\nelse\n  # Current version < 2.2.0\n  function __exists -a name -d \"Check if a function or program does exist.\"\n    type \"$name\" ^/dev/null >&2\n  end\nend\n\n\n#\n# Prompt\n#\nfunction fish_prompt\n  set -g RETVAL $status\n  prompt_status\n  prompt_virtual_env\n  prompt_user\n  prompt_dir\n  __exists hg;  and prompt_hg\n  __exists git; and prompt_git\n  __exists svn; and prompt_svn\n  prompt_finish\nend\n"
  },
  {
    "path": "shellder.zsh-theme",
    "content": "# vim:ft=zsh ts=2 sw=2 sts=2\n\n#\n# Segment drawing\n#\nCURRENT_BG='NONE'\n\n#\n# color scheme\n#\nSHELLDER_CONTEXT_BG=${SHELLDER_CONTEXT_BG:-238}\nSHELLDER_CONTEXT_FG=${SHELLDER_CONTEXT_FG:-250}\n\nSHELLDER_DIRECTORY_BG=${SHELLDER_DIRECTORY_BG:-234}\nSHELLDER_DIRECTORY_FG=${SHELLDER_DIRECTORY_FG:-231}\n\nSHELLDER_GIT_CLEAN_BG=${SHELLDER_GIT_CLEAN_BG:-034}\nSHELLDER_GIT_CLEAN_FG=${SHELLDER_GIT_CLEAN_FG:-'black'}\n\nSHELLDER_GIT_UNTRACKED_BG=${SHELLDER_GIT_UNTRACKED_BG:-226}\nSHELLDER_GIT_UNTRACKED_FG=${SHELLDER_GIT_UNTRACKED_FG:-'black'}\n\nSHELLDER_GIT_UNPUSHED_BG=${SHELLDER_GIT_UNPUSHED_BG:-48}\nSHELLDER_GIT_UNPUSHED_FG=${SHELLDER_GIT_UNPUSHED_FG:-'black'}\n\nSHELLDER_GIT_MODIFIED_BG=${SHELLDER_GIT_MODIFIED_BG:-172}\nSHELLDER_GIT_MODIFIED_FG=${SHELLDER_GIT_MODIFIED_FG:-'black'}\n\nSHELLDER_GIT_STAGED_BG=${SHELLDER_GIT_STAGED_BG:-166}\nSHELLDER_GIT_STAGED_FG=${SHELLDER_GIT_STAGED_FG:-'black'}\n\nSHELLDER_GIT_ADDED_BG=${SHELLDER_GIT_ADDED_BG:-218}\nSHELLDER_GIT_ADDED_FG=${SHELLDER_GIT_ADDED_FG:-'black'}\n\nSHELLDER_VIRTUALENV_BG=${SHELLDER_VIRTUALENV_BG:-017}\nSHELLDER_VIRTUALENV_FG=${SHELLDER_VIRTUALENV_FG:-189}\n\nSHELLDER_STATUS_BG=${SHELLDER_STATUS_BG:-236}\nSHELLDER_STATUS_FG=${SHELLDER_STATUS_FG:-'default'}\n\n# Special Powerline characters\nset_separator() {\n  local LC_ALL='' LC_CTYPE='en_US.UTF-8'\n  SEGMENT_SEPARATOR=$'\\ue0b0'\n}\nset_separator\n\n# Begin a segment\n# Takes two arguments, background and foreground. Both can be omitted,\n# rendering default background/foreground.\nprompt_segment() {\n  local bg fg\n  [[ -n $1 ]] && bg=\"%K{$1}\" || bg='%k'\n  [[ -n $2 ]] && fg=\"%F{$2}\" || fg='%f'\n  if [[ \"$CURRENT_BG\" != 'NONE' && $1 != \"$CURRENT_BG\" ]]; then\n    echo -n \" %{$bg%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR%{$fg%} \"\n  else\n    echo -n \"%{$bg%}%{$fg%} \"\n  fi\n  CURRENT_BG=$1\n  [[ -n $3 ]] && echo -n \"$3\"\n}\n\n# End the prompt, closing any open segments\nprompt_end() {\n  if [[ -n \"$CURRENT_BG\" ]]; then\n    echo -n \" %{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR\"\n  else\n    echo -n '%{%k%}'\n  fi\n  echo -n '%{%f%}'\n  CURRENT_BG=''\n}\n\n\n#\n# Prompt functions\n#\n\n# Context: user@hostname (who am I and where am I)\nprompt_context() {\n  local prompt\n  if [[ -n \"$SSH_CLIENT\" ]]; then\n    if [[ \"$USER\" != \"$DEFAULT_USER\" ]]; then\n      prompt=\"%(!.%{%F{yellow}%}.)$USER@%m\"\n    else\n      prompt='%(!.%{%F{yellow}%}.)%m'\n    fi\n    prompt_segment \"$SHELLDER_CONTEXT_BG\" \"$SHELLDER_CONTEXT_FG\" \"$prompt\"\n  fi\n}\n\n# Git: branch/detached head, dirty status\nprompt_git() {\n  local repo_path\n  local GIT_STATUS\n\n  repo_path=$(git rev-parse --git-dir 2>/dev/null)\n\n  if [[ -n $repo_path ]]; then\n    local PL_BRANCH_CHAR dirty bgcolor fgcolor mode ref\n\n    set_branch_char() {\n      local LC_ALL='' LC_CTYPE='en_US.UTF-8'\n      PL_BRANCH_CHAR=$'\\ue0a0' # \n    }\n    set_branch_char\n\n    GIT_STATUS=$(\n      command git status --porcelain --ignore-submodules=dirty 2>/dev/null |\n        sed -e 's/^ //g'\n    )\n    modified=$(<<< \"$GIT_STATUS\" grep '^M')\n    untracked=$(<<< \"$GIT_STATUS\" grep '^?')\n    added=$(<<< \"$GIT_STATUS\" grep '^A')\n    staged=$(git diff --name-only --cached)\n    unpushed=$(command git cherry 2>/dev/null)\n\n    if [[ -n $added ]]; then\n      bgcolor=$SHELLDER_GIT_ADDED_BG\n      fgcolor=$SHELLDER_GIT_ADDED_FG\n    elif [[ -n $staged ]]; then\n      bgcolor=$SHELLDER_GIT_STAGED_BG\n      fgcolor=$SHELLDER_GIT_STAGED_FG\n    elif [[ -n $modified ]]; then\n      bgcolor=$SHELLDER_GIT_MODIFIED_BG\n      fgcolor=$SHELLDER_GIT_MODIFIED_FG\n    elif [[ -n $untracked ]]; then\n      bgcolor=$SHELLDER_GIT_UNTRACKED_BG\n      fgcolor=$SHELLDER_GIT_UNTRACKED_FG\n    elif [[ -n $unpushed ]]; then\n      bgcolor=$SHELLDER_GIT_UNPUSHED_BG\n      fgcolor=$SHELLDER_GIT_UNPUSHED_FG\n    else\n      bgcolor=$SHELLDER_GIT_CLEAN_BG\n      fgcolor=$SHELLDER_GIT_CLEAN_FG\n    fi\n    prompt_segment \"$bgcolor\" \"$fgcolor\"\n\n    if [[ -e \"${repo_path}/BISECT_LOG\" ]]; then\n      mode=' <B>'\n    elif [[ -e \"${repo_path}/MERGE_HEAD\" ]]; then\n      mode=' >M<'\n    elif [[ -e \"${repo_path}/rebase\" || -e \"${repo_path}/rebase-apply\" || -e \"${repo_path}/rebase-merge\" || -e \"${repo_path}/../.dotest\" ]]; then\n      mode=' >R>'\n    fi\n\n    # vcs_info is too slow with MSYS2 (~300ms with i7-6770K + SSD)\n    if [[ -z $MSYS ]]; then\n      autoload -Uz vcs_info\n      zstyle ':vcs_info:*' enable git\n      zstyle ':vcs_info:*' check-for-changes true\n      zstyle ':vcs_info:*' stagedstr '✚'\n      zstyle ':vcs_info:*' unstagedstr '●'\n      zstyle ':vcs_info:*' formats ' %u%c'\n      zstyle ':vcs_info:*' actionformats ' %u%c'\n      vcs_info\n    else\n      if [[ -n $dirty ]]; then\n        vcs_info_msg_0_=' !'\n      fi\n    fi\n\n    ref=$(git symbolic-ref HEAD 2> /dev/null) || ref=\"➦ $(git rev-parse --short HEAD 2> /dev/null)\"\n    echo -n \"${ref/refs\\/heads\\//$PL_BRANCH_CHAR }${vcs_info_msg_0_%% }${mode}\"\n  fi\n}\n\nprompt_hg() {\n  local rev\n  if hg id >/dev/null 2>&1; then\n    if hg prompt >/dev/null 2>&1; then\n      if [[ $(hg prompt '{status|unknown}') = '?' ]]; then\n        # if files are not added\n        prompt_segment red white\n        st='±'\n      elif [[ -n $(hg prompt '{status|modified}') ]]; then\n        # if any modification\n        prompt_segment yellow black\n        st='±'\n      else\n        # if working copy is clean\n        prompt_segment green black\n      fi\n      echo -n \"$(hg prompt '☿ {rev}@{branch}')\" \"$st\"\n    else\n      st=''\n      rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g')\n      branch=$(hg id -b 2>/dev/null)\n      if hg st | grep -q \"^\\?\"; then\n        prompt_segment red black\n        st='±'\n      elif hg st | grep -q '^[MA]'; then\n        prompt_segment yellow black\n        st='±'\n      else\n        prompt_segment green black\n      fi\n      echo -n \"☿ $rev@$branch\" $st\n    fi\n  fi\n}\n\n# Turn '/some/quite/very/long/path' into '/s/q/v/l/path'\nfunction shrinked_path() {\n  local paths=(${PWD/$HOME/\\~}) 'cur_dir'\n  paths=(${(s:/:)paths})\n  for idx in {1..$#paths}; do\n    if [[ idx -lt $#paths ]]; then\n      cur_dir+=\"${paths[idx]:0:1}\"\n    else\n      cur_dir+=\"${paths[idx]}\"\n    fi\n    cur_dir+='/'\n  done\n  echo \"${cur_dir: :-1}\"\n}\n\n# Dir: current working directory\nprompt_dir() {\n  local dir\n  if [[ -n $SHELLDER_KEEP_PATH ]]; then\n    dir='%~'\n  else\n    dir=$(shrinked_path)\n  fi\n  prompt_segment \"$SHELLDER_DIRECTORY_BG\" \"$SHELLDER_DIRECTORY_FG\" \"$dir\"\n}\n\n# Virtualenv: current working virtualenv\nprompt_virtualenv() {\n  local virtualenv_path=\"$VIRTUAL_ENV\"\n  if [[ -n $virtualenv_path && -n $VIRTUAL_ENV_DISABLE_PROMPT ]]; then\n    prompt_segment \"$SHELLDER_VIRTUALENV_BG\" \"$SHELLDER_VIRTUALENV_FG\" \"$(basename \"$virtualenv_path\")\"\n  fi\n}\n\n# Status: error + root + background jobs\nprompt_status() {\n  local symbols\n  symbols=()\n  [[ $RETVAL -ne 0 ]] && symbols+=\"%{%F{yellow}%}$RETVAL\"\n  [[ $UID -eq 0 ]] && symbols+='%{%F{yellow}%}⚡'\n  [[ $(jobs -l | wc -l) -gt 0 ]] && symbols+='%{%F{cyan}%}⚙'\n\n  [[ -n \"$symbols\" ]] && prompt_segment \"$SHELLDER_STATUS_BG\" \"$SHELLDER_STATUS_FG\" \"$symbols\"\n}\n\n\n#\n# Prompt\n#\nbuild_prompt() {\n  RETVAL=$?\n  prompt_status\n  prompt_virtualenv\n  prompt_context\n  prompt_dir\n  prompt_git\n  prompt_hg\n  prompt_end\n}\n\nexport VIRTUAL_ENV_DISABLE_PROMPT='true'\nPROMPT='%{%f%b%k%}$(build_prompt) '\n"
  }
]