Repository: ChesterYue/ohmyzsh-theme-passion
Branch: main
Commit: 7f06398c0a3c
Files: 6
Total size: 18.9 KB
Directory structure:
gitextract_ket5bkj2/
├── LICENSE
├── README.md
├── demo/
│ └── README.md
├── image/
│ └── image.sketch
├── passion.zsh-theme
└── passsion.itermcolors
================================================
FILE CONTENTS
================================================
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2020 ChesterYue
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.
================================================
FILE: README.md
================================================
# ohmyzsh-theme-passion
## Introduction
An oh-my-zsh theme;

### Feature
* real time prompt;
* command running time cost prompt;
* command running error hint;
* git status prompt;
## Usage
### Basic Zsh Theme
#### Install
1. clone repo: ```git clone https://github.com/ChesterYue/ohmyzsh-theme-passion```;
2. copy theme: ```cp ./ohmyzsh-theme-passion/passion.zsh-theme ~/.oh-my-zsh/themes/passion.zsh-theme```;
3. modify rc: open ```~/.zshrc``` find ```ZSH_THEME``` edit to ```ZSH_THEME="passion"```;
4. execute rc: ```source ~/.zshrc```;
* see also: [Overriding and adding themes](https://github.com/ohmyzsh/ohmyzsh/wiki/Customization#overriding-and-adding-themes);
#### Trouble Shooting
##### macOS, command not found: gdate
* passion.zsh-theme depends on cmd ```gdate``` to get current time in milliseconds. get ```gdate``` on macOS by running ```brew install coreutils``` then ```source ~/.zshrc```;
* see also: [#12](https://github.com/ChesterYue/ohmyzsh-theme-passion/issues/12);
##### Linux, command not found: bc
* passion.zsh-theme depends on cmd ```bc``` to calculate the command running time cost. [get bc on Linux](https://www.tecmint.com/bc-command-examples/#:~:text=If%20you%20don%E2%80%99t%20have%20bc%20on%20your%20system%2C,command%20prompt%20and%20simply%20start%20calculating%20your%20expressions.) then ```source ~/.zshrc```;
* see also: [#13](https://github.com/ChesterYue/ohmyzsh-theme-passion/issues/13);
##### Centos 7, shell exit
* may caused by [set timer to zsh prompt](https://github.com/ChesterYue/ohmyzsh-theme-passion/blob/8f71c43c2df91810249ab00ff40fc4ca63207467/passion.zsh-theme#L197-L208);
* see also: [#4](https://github.com/ChesterYue/ohmyzsh-theme-passion/issues/4);
<details> <!-- markdownlint-disable-line -->
<summary><h3>Extra Preferences</h3></summary> <!-- markdownlint-disable-line -->
#### Zsh Plugins
1. [zsh-autosuggestions](https://github.com/zsh-users/zsh-autosuggestions);
2. [zsh-syntax-highlighting](https://github.com/zsh-users/zsh-syntax-highlighting);
#### iTerm2 Preferences
##### Color
<!-- cspell:disable-next-line -->
* iTerm2: settings -> Profiles -> Colors -> Color Presets -> import ```./passion.itermcolors``` 
* alternate terminal: try [Alternate terminal installation and configuration](https://iterm2colorschemes.com/);
##### Status Bar
* iTerm2: settings -> Appearance && settings -> Profiles -> Session -> Configure Status Bar  
##### Font
* install [JetBrains Mono](https://www.jetbrains.com/lp/mono/);
* iTerm2: settings -> Appearance && settings -> Profiles -> Text -> Font 
</details> <!-- markdownlint-disable-line -->
================================================
FILE: demo/README.md
================================================
# demo
## warning
make sure image refed by [External-themes](https://github.com/ohmyzsh/ohmyzsh/wiki/External-themes) exist;
## iTerm title
Settings - Profiles - Window - Custom tab title - ohmyzsh-theme-passion
## cmd
``` shell
# mkdir demo; cd demo; mkdir demo-git; cd demo-git; git init;
# git config --local user.name / user.email ...
# cd ..
echo real time prompt
echo command running time cost prompt
test command running error hint
cd demo-git
echo git status prompt
touch test.txt
git st
git add -A
git ci -m "test"
# enter twice
```
================================================
FILE: passion.zsh-theme
================================================
# gdate for macOS
# REF: https://apple.stackexchange.com/questions/135742/time-in-milliseconds-since-epoch-in-the-terminal
if [[ "$OSTYPE" == "darwin"* ]]; then
{
gdate
} || {
echo "\n$fg_bold[yellow]passion.zsh-theme depends on cmd [gdate] to get current time in milliseconds$reset_color"
echo "$fg_bold[yellow][gdate] is not installed by default in macOS$reset_color"
echo "$fg_bold[yellow]to get [gdate] by running:$reset_color"
echo "$fg_bold[green]brew install coreutils;$reset_color";
echo "$fg_bold[yellow]\nREF: https://github.com/ChesterYue/ohmyzsh-theme-passion#macos\n$reset_color"
}
fi
# time
function real_time() {
local color="%{$fg_no_bold[cyan]%}"; # color in PROMPT need format in %{XXX%} which is not same with echo
local time="[$(date +%H:%M:%S)]";
local color_reset="%{$reset_color%}";
echo "${color}${time}${color_reset}";
}
# login_info
function login_info() {
local color="%{$fg_no_bold[cyan]%}"; # color in PROMPT need format in %{XXX%} which is not same with echo
local ip
if [[ "$OSTYPE" == "linux-gnu" ]]; then
# Linux
ip="$(ifconfig | grep ^eth1 -A 1 | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' | head -1)";
elif [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
ip="$(ifconfig | grep ^en1 -A 4 | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' | head -1)";
elif [[ "$OSTYPE" == "cygwin" ]]; then
# POSIX compatibility layer and Linux environment emulation for Windows
elif [[ "$OSTYPE" == "msys" ]]; then
# Lightweight shell and GNU utilities compiled for Windows (part of MinGW)
elif [[ "$OSTYPE" == "win32" ]]; then
# I'm not sure this can happen.
elif [[ "$OSTYPE" == "freebsd"* ]]; then
# ...
else
# Unknown.
fi
local color_reset="%{$reset_color%}";
echo "${color}[%n@${ip}]${color_reset}";
}
# directory
function directory() {
local color="%{$fg_no_bold[cyan]%}";
# REF: https://stackoverflow.com/questions/25944006/bash-current-working-directory-with-replacing-path-to-home-folder
local directory="${PWD/#$HOME/~}";
local color_reset="%{$reset_color%}";
echo "${color}[${directory}]${color_reset}";
}
# git
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_no_bold[cyan]%}[";
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} ";
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg_no_bold[red]%}✖%{$fg_no_bold[cyan]%}]";
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_no_bold[cyan]%}]";
function update_git_status() {
GIT_STATUS=$(_omz_git_prompt_info);
}
function git_status() {
echo "${GIT_STATUS}"
}
# command
function update_command_status() {
local arrow="";
local color_reset="%{$reset_color%}";
local reset_font="%{$fg_no_bold[white]%}";
COMMAND_RESULT=$1;
export COMMAND_RESULT=$COMMAND_RESULT
if $COMMAND_RESULT;
then
arrow="%{$fg_bold[red]%}❱%{$fg_bold[yellow]%}❱%{$fg_bold[green]%}❱";
else
arrow="%{$fg_bold[red]%}❱❱❱";
fi
COMMAND_STATUS="${arrow}${reset_font}${color_reset}";
}
update_command_status true;
function command_status() {
echo "${COMMAND_STATUS}"
}
# output command execute after
output_command_execute_after() {
if [ "$COMMAND_TIME_BEGIN" = "-20200325" ] || [ "$COMMAND_TIME_BEGIN" = "" ];
then
return 1;
fi
# cmd
local cmd="$(fc -ln -1)";
local color_cmd="";
if $1;
then
color_cmd="$fg_no_bold[green]";
else
color_cmd="$fg_bold[red]";
fi
local color_reset="$reset_color";
cmd="${color_cmd}${cmd}${color_reset}"
# time
local time="[$(date +%H:%M:%S)]"
local color_time="$fg_no_bold[cyan]";
time="${color_time}${time}${color_reset}";
# cost
local time_end="$(current_time_millis)";
local cost=$(bc -l <<<"${time_end}-${COMMAND_TIME_BEGIN}");
COMMAND_TIME_BEGIN="-20200325"
local length_cost=${#cost};
if [ "$length_cost" = "4" ];
then
cost="0${cost}"
fi
cost="[cost ${cost}s]"
local color_cost="$fg_no_bold[cyan]";
cost="${color_cost}${cost}${color_reset}";
echo -e "${time} ${cost} ${cmd}";
echo -e "";
}
# command execute before
# REF: http://zsh.sourceforge.net/Doc/Release/Functions.html
preexec() { # cspell:disable-line
COMMAND_TIME_BEGIN="$(current_time_millis)";
}
current_time_millis() {
local time_millis;
if [[ "$OSTYPE" == "linux-gnu" ]]; then
# Linux
time_millis="$(date +%s.%3N)";
elif [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
time_millis="$(gdate +%s.%3N)";
elif [[ "$OSTYPE" == "cygwin" ]]; then
# POSIX compatibility layer and Linux environment emulation for Windows
elif [[ "$OSTYPE" == "msys" ]]; then
# Lightweight shell and GNU utilities compiled for Windows (part of MinGW)
elif [[ "$OSTYPE" == "win32" ]]; then
# I'm not sure this can happen.
elif [[ "$OSTYPE" == "freebsd"* ]]; then
# ...
else
# Unknown.
fi
echo $time_millis;
}
# command execute after
# REF: http://zsh.sourceforge.net/Doc/Release/Functions.html
precmd() { # cspell:disable-line
# last_cmd
local last_cmd_return_code=$?;
local last_cmd_result=true;
if [ "$last_cmd_return_code" = "0" ];
then
last_cmd_result=true;
else
last_cmd_result=false;
fi
# update_git_status
update_git_status;
# update_command_status
update_command_status $last_cmd_result;
# output command execute after
output_command_execute_after $last_cmd_result;
}
# set option
setopt PROMPT_SUBST; # cspell:disable-line
# timer
#REF: https://stackoverflow.com/questions/26526175/zsh-menu-completion-causes-problems-after-zle-reset-prompt
TMOUT=1;
TRAPALRM() { # cspell:disable-line
# $(git_prompt_info) cost too much time which will raise stutters when inputting. so we need to disable it in this occurrence.
# if [ "$WIDGET" != "expand-or-complete" ] && [ "$WIDGET" != "self-insert" ] && [ "$WIDGET" != "backward-delete-char" ]; then
# black list will not enum it completely. even some pipe broken will appear.
# so we just put a white list here.
if [ "$WIDGET" = "" ] || [ "$WIDGET" = "accept-line" ] ; then
zle reset-prompt;
fi
}
# prompt
# PROMPT='$(real_time) $(login_info) $(directory) $(git_status)$(command_status) ';
PROMPT='$(real_time) $(directory) $(git_status)$(command_status) ';
================================================
FILE: passsion.itermcolors
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.0</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.0</real>
<key>Red Component</key>
<real>0.0</real>
</dict>
<key>Ansi 1 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.44705623388290405</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.43135684728622437</real>
<key>Red Component</key>
<real>0.99215370416641235</real>
</dict>
<key>Ansi 10 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.66666203737258911</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.77253597974777222</real>
<key>Red Component</key>
<real>0.23532116413116455</real>
</dict>
<key>Ansi 11 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.403959721326828</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.98755413293838501</real>
<key>Red Component</key>
<real>0.99950617551803589</real>
</dict>
<key>Ansi 12 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.97254163026809692</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.68626147508621216</real>
<key>Red Component</key>
<real>0.41177588701248169</real>
</dict>
<key>Ansi 13 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.66274034976959229</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.43920052051544189</real>
<key>Red Component</key>
<real>0.9333309531211853</real>
</dict>
<key>Ansi 14 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.78430771827697754</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.55293065309524536</real>
<key>Red Component</key>
<real>0.27844303846359253</real>
</dict>
<key>Ansi 15 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.99999994039535522</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.99999994039535522</real>
<key>Red Component</key>
<real>1</real>
</dict>
<key>Ansi 2 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.60783892869949341</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.73332113027572632</real>
<key>Red Component</key>
<real>0.11377807706594467</real>
</dict>
<key>Ansi 3 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.20784869790077209</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.94115859270095825</real>
<key>Red Component</key>
<real>0.99608057737350464</real>
</dict>
<key>Ansi 4 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.97254163026809692</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.68626147508621216</real>
<key>Red Component</key>
<real>0.41177588701248169</real>
</dict>
<key>Ansi 5 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.65097540616989136</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.39606726169586182</real>
<key>Red Component</key>
<real>0.65097981691360474</real>
</dict>
<key>Ansi 6 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.90196079015731812</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.67843139171600342</real>
<key>Red Component</key>
<real>0.19607843458652496</real>
</dict>
<key>Ansi 7 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.78104287385940552</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.78104287385940552</real>
<key>Red Component</key>
<real>0.78104299306869507</real>
</dict>
<key>Ansi 8 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.40781933069229126</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.40781933069229126</real>
<key>Red Component</key>
<real>0.40781933069229126</real>
</dict>
<key>Ansi 9 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.44313725829124451</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.42745098471641541</real>
<key>Red Component</key>
<real>0.99215686321258545</real>
</dict>
<key>Background Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.12156862765550613</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.11764705926179886</real>
<key>Red Component</key>
<real>0.11372549086809158</real>
</dict>
<key>Badge Color</key>
<dict>
<key>Alpha Component</key>
<real>0.5</real>
<key>Blue Component</key>
<real>0.0</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.1491314172744751</real>
<key>Red Component</key>
<real>1</real>
</dict>
<key>Bold Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.99999994039535522</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.99999994039535522</real>
<key>Red Component</key>
<real>1</real>
</dict>
<key>Cursor Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.78104287385940552</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.78104287385940552</real>
<key>Red Component</key>
<real>0.78104299306869507</real>
</dict>
<key>Cursor Guide Color</key>
<dict>
<key>Alpha Component</key>
<real>0.25</real>
<key>Blue Component</key>
<real>1</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.9268307089805603</real>
<key>Red Component</key>
<real>0.70213186740875244</real>
</dict>
<key>Cursor Text Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.99999994039535522</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.99999994039535522</real>
<key>Red Component</key>
<real>1</real>
</dict>
<key>Foreground Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.61176472902297974</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.61176472902297974</real>
<key>Red Component</key>
<real>0.61176472902297974</real>
</dict>
<key>Link Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.73423302173614502</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.35916060209274292</real>
<key>Red Component</key>
<real>0.0</real>
</dict>
<key>Selected Text Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.0</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.0</real>
<key>Red Component</key>
<real>0.0</real>
</dict>
<key>Selection Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>1</real>
<key>Color Space</key>
<string>sRGB</string>
<key>Green Component</key>
<real>0.86968445777893066</real>
<key>Red Component</key>
<real>0.75813823938369751</real>
</dict>
</dict>
</plist>
gitextract_ket5bkj2/ ├── LICENSE ├── README.md ├── demo/ │ └── README.md ├── image/ │ └── image.sketch ├── passion.zsh-theme └── passsion.itermcolors
Condensed preview — 6 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (21K chars).
[
{
"path": "LICENSE",
"chars": 1067,
"preview": "MIT License\n\nCopyright (c) 2020 ChesterYue\n\nPermission is hereby granted, free of charge, to any person obtaining a copy"
},
{
"path": "README.md",
"chars": 2782,
"preview": "# ohmyzsh-theme-passion\n\n## Introduction\n\nAn oh-my-zsh theme;\n\n\n### Feature\n\n* real time pro"
},
{
"path": "demo/README.md",
"chars": 551,
"preview": "# demo\n\n## warning\n\nmake sure image refed by [External-themes](https://github.com/ohmyzsh/ohmyzsh/wiki/External-themes) "
},
{
"path": "passion.zsh-theme",
"chars": 6515,
"preview": "\n# gdate for macOS\n# REF: https://apple.stackexchange.com/questions/135742/time-in-milliseconds-since-epoch-in-the-termi"
},
{
"path": "passsion.itermcolors",
"chars": 8458,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
}
]
// ... and 1 more files (download for full content)
About this extraction
This page contains the full source code of the ChesterYue/ohmyzsh-theme-passion GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 6 files (18.9 KB), approximately 6.7k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.