Hygo AI custom shell.
added a cheatsheet for zsh
2 files changed, +71 -8
+68-7README.md
| @@ -5,14 +5,75 @@ To use HygoShell, follow these steps: | ||
| 5 | 5 | 1. Open your terminal. |
| 6 | 6 | 2. Run the following command to clone the HygoShell repository: |
| 7 | 7 | |
| 8 | - ``` | |
| 9 | - git clone https://github.com/huncholane/hygoshell ~/.hygo | |
| 10 | - ``` | |
| 8 | + ``` | |
| 9 | + git clone https://github.com/huncholane/hygoshell ~/.hygo | |
| 10 | + ``` | |
| 11 | 11 | |
| 12 | 12 | 3. Add the following to your shell config, i.e. .bashrc or .zshrc |
| 13 | 13 | |
| 14 | - ``` | |
| 15 | - source ~/.hygo/.bashrc | |
| 16 | - ``` | |
| 14 | + ``` | |
| 15 | + source ~/.hygo/.bashrc | |
| 16 | + ``` | |
| 17 | 17 | |
| 18 | -Happy coding! | |
| 18 | +### ZSH Prompt Elements | |
| 19 | + | |
| 20 | +| Element | Description | | |
| 21 | +| ------------ | -------------------------------------------------------------- | | |
| 22 | +| `%n` | Username | | |
| 23 | +| `%m` | Hostname (up to first `.`) | | |
| 24 | +| `%M` | Full hostname | | |
| 25 | +| `%~` | Current working directory (relative to home) | | |
| 26 | +| `%d` | Current working directory (absolute path) | | |
| 27 | +| `%/` | Full path of the current working directory | | |
| 28 | +| `%c` | Trailing portion of the current working directory | | |
| 29 | +| `%#` | `#` if root; `%` otherwise | | |
| 30 | +| `%h` | Current history event number | | |
| 31 | +| `%j` | Number of jobs currently managed by the shell | | |
| 32 | +| `%T` | Current time in 24-hour format (HH:MM) | | |
| 33 | +| `%*` | Current time in 12-hour format (HH:MM AM/PM) | | |
| 34 | +| `%D{format}` | Date with custom format, e.g., `%D{%Y-%m-%d}` for `YYYY-MM-DD` | | |
| 35 | + | |
| 36 | +### ZSH Color Codes | |
| 37 | + | |
| 38 | +| Code | Effect | | |
| 39 | +| ----------- | ----------------------- | | |
| 40 | +| `%F{color}` | Sets foreground color | | |
| 41 | +| `%K{color}` | Sets background color | | |
| 42 | +| `%f` | Resets foreground color | | |
| 43 | +| `%k` | Resets background color | | |
| 44 | + | |
| 45 | +#### Common Colors | |
| 46 | + | |
| 47 | +| Color | Code | | |
| 48 | +| ------- | --------- | | |
| 49 | +| Black | `black` | | |
| 50 | +| Red | `red` | | |
| 51 | +| Green | `green` | | |
| 52 | +| Yellow | `yellow` | | |
| 53 | +| Blue | `blue` | | |
| 54 | +| Magenta | `magenta` | | |
| 55 | +| Cyan | `cyan` | | |
| 56 | +| White | `white` | | |
| 57 | +| Default | `default` | | |
| 58 | + | |
| 59 | +#### Bright Colors | |
| 60 | + | |
| 61 | +| Color | Code | | |
| 62 | +| -------------- | --------------- | | |
| 63 | +| Bright Red | `brightred` | | |
| 64 | +| Bright Green | `brightgreen` | | |
| 65 | +| Bright Yellow | `brightyellow` | | |
| 66 | +| Bright Blue | `brightblue` | | |
| 67 | +| Bright Magenta | `brightmagenta` | | |
| 68 | +| Bright Cyan | `brightcyan` | | |
| 69 | +| Bright White | `brightwhite` | | |
| 70 | + | |
| 71 | +### Example Prompts | |
| 72 | + | |
| 73 | +| Example | Code | | |
| 74 | +| -------------------------------- | -------------------------------------------------------------------------------------------------------------------- | | |
| 75 | +| Simple Colorful Prompt | `PROMPT="%F{cyan}%n@%m %F{yellow}%~ %F{green}%# %f"` | | |
| 76 | +| Detailed Prompt with Time & Jobs | `PROMPT="%F{blue}%T %F{magenta}%n@%m %F{yellow}%~ %F{red}jobs:%j %F{green}%# %f"` | | |
| 77 | +| Git Status Prompt | `autoload -Uz vcs_info; precmd() { vcs_info }; PROMPT="%F{blue}%n@%m %F{yellow}%~ %F{cyan}${vcs_info_msg_0_}%f %# "` | | |
| 78 | +| Date, Host, and Directory | `PROMPT="%F{magenta}%D{%Y-%m-%d} %F{cyan}%m %F{yellow}%~ %F{green}%# %f"` | | |
| 79 | +| Background Color Example | `PROMPT="%K{black}%F{green}%n@%m%k %F{yellow}%~ %F{blue}%# %f"` | |
+3-1setup.sh
| @@ -13,9 +13,11 @@ get_git_branch() { | ||
| 13 | 13 | git branch 2>/dev/null | grep '*' | sed 's/* //' |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | +ZSH_ORANGE='%F{214}'` | |
| 16 | 17 | # Set up zsh prompt |
| 17 | 18 | if [ -n "$ZSH_VERSION" ]; then |
| 18 | - PROMPT="%F{214}%n@%m %F{white}%~"$'\n'"%f$ " | |
| 19 | + # PROMPT='%F{214}%n@%m %F{white}%~$(git_branch=$(get_git_branch); if [ -n "$git_branch" ]; then echo " (%git_branch)"; fi)'$'\n''%f$ ' | |
| 20 | + PROMPT`` | |
| 19 | 21 | fi |
| 20 | 22 | |
| 21 | 23 | # Set up bash prompt |