From 5c4e1b0f94fcf61d44b4d0ba86f54dbde98c31fc Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Sun, 4 Jan 2026 19:26:30 +0800 Subject: Add Zsh plugin installation documentation and rename config variables The Zsh plugin now includes a how_to_install.md file with setup instructions. Configuration variable names have been simplified from JVCS_PROMPT_SEGMENT_* to JVCS_* for consistency. --- .cargo/config.toml | 16 ++++++--- scripts/zsh_support/how_to_install.md | 61 +++++++++++++++++++++++++++++++++++ scripts/zsh_support/jvcs.plugin.zsh | 26 ++++++--------- 3 files changed, 83 insertions(+), 20 deletions(-) create mode 100644 scripts/zsh_support/how_to_install.md diff --git a/.cargo/config.toml b/.cargo/config.toml index e74dd80..a5fccaa 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -27,10 +27,6 @@ to = "completions/bash/completion_jv.sh" from = "scripts/completions/bash/completion_jvv.sh" to = "completions/bash/completion_jvv.sh" -[copies.zsh_plugin] -from = "scripts/zsh_support/jvcs.plugin.zsh" -to = "scripts/zsh_support/jvcs.plugin.zsh" - # Entries [copies.entry_bash] from = "scripts/jv_cli.sh" @@ -53,3 +49,15 @@ to = "completions/powershell/completion_jvv.ps1" [copies.entry_powershell] from = "scripts/jv_cli.ps1" to = "jv_cli.ps1" + +################## +### Zsh Plugin ### +################## + +[copies.zsh_plugin] +from = "scripts/zsh_support/jvcs.plugin.zsh" +to = "scripts/zsh_support/jvcs.plugin.zsh" + +[copies.zsh_plugin_installation] +from = "scripts/zsh_support/how_to_install.md" +to = "scripts/zsh_support/how_to_install.md" diff --git a/scripts/zsh_support/how_to_install.md b/scripts/zsh_support/how_to_install.md new file mode 100644 index 0000000..343ea7b --- /dev/null +++ b/scripts/zsh_support/how_to_install.md @@ -0,0 +1,61 @@ +# How to Install + +Before installing, please ensure: + +* [Oh My Zsh](https://ohmyz.sh/) is installed. +* Your current shell is **Zsh**. + +--- + +## Install the Zsh Plugin + +In your terminal, run: + +```bash +./install.sh +``` + +This script will install JVCS's Zsh support files locally and prepare the prompt segment definitions for use by your theme. + +--- + +## Configure Your Zsh Theme + +Open your current Zsh theme file (e.g., `~/.oh-my-zsh/themes/xxx.zsh-theme`) and paste the following content in an appropriate location: + +```bash +# ----------------------------------------------------- # +# DISPLAY_LEVEL +# FULL = 127.0.0.1:25331/account/sheet +# NORMAL = account/sheet +# SHORT = sheet +JVCS_VIEW='NORMAL' + +# Customizable prompt segment elements +JVCS_PREFIX='[' +JVCS_SPLIT='/' +JVCS_SUFFIX=']' + +# JVCS_PROMPT_SEGMENT default style: +# [your_account/your_sheet] + +# Append JVCS prompt segment +PROMPT+='${JVCS_PROMPT_SEGMENT}' +# ----------------------------------------------------- # +``` + +After saving, reload your terminal, or run: + +```bash +source ~/.zshrc +``` + +--- + +## Notes + +* `JVCS_VIEW` controls the view level displayed in the prompt. +* `JVCS_PREFIX / SPLIT / SUFFIX` are used to customize the appearance. +* `JVCS_PROMPT_SEGMENT` is only responsible for displaying the status and does not execute any logic. + +No further configuration is required. diff --git a/scripts/zsh_support/jvcs.plugin.zsh b/scripts/zsh_support/jvcs.plugin.zsh index 6f9d349..2032044 100644 --- a/scripts/zsh_support/jvcs.plugin.zsh +++ b/scripts/zsh_support/jvcs.plugin.zsh @@ -17,20 +17,14 @@ autoload -Uz add-zsh-hook -##################### -### CONFIGURATION ### -##################### - -# DISPLAY_LEVEL -# FULL = 127.0.0.1:25331/account/sheet -# NORMAL = account/sheet -# SHORT = sheet -JVCS_VIEW='NORMAL' +################## +### APPEARANCE ### +################## -# Customizable prompt segment elements -JVCS_PROMPT_SEGMENT_SPLIT='/' -JVCS_PROMPT_SEGMENT_PREFIX='' -JVCS_PROMPT_SEGMENT_SUFFIX='>' +JVCS_VIEW='NORMAL' +JVCS_PREFIX='[' +JVCS_SPLIT='/' +JVCS_SUFFIX=']' ################### ### THEME READS ### @@ -81,13 +75,13 @@ jvcs_render_prompt() { if [[ -n "$JVCS_DISPLAY" ]]; then case "$JVCS_VIEW" in FULL) - JVCS_PROMPT_SEGMENT="%{$fg[white]%}${JVCS_PROMPT_SEGMENT_PREFIX}${JVCS_UPSTREAM}${JVCS_PROMPT_SEGMENT_SPLIT}${JVCS_ACCOUNT}${JVCS_PROMPT_SEGMENT_SPLIT}${JVCS_SHEET}${JVCS_PROMPT_SEGMENT_SUFFIX} %{$reset_color%}" + JVCS_PROMPT_SEGMENT="%{$fg[white]%}${JVCS_PREFIX}${JVCS_UPSTREAM}${JVCS_SPLIT}${JVCS_ACCOUNT}${JVCS_SPLIT}${JVCS_SHEET}${JVCS_SUFFIX} %{$reset_color%}" ;; NORMAL) - JVCS_PROMPT_SEGMENT="%{$fg[white]%}${JVCS_PROMPT_SEGMENT_PREFIX}${JVCS_ACCOUNT}${JVCS_PROMPT_SEGMENT_SPLIT}${JVCS_SHEET}${JVCS_PROMPT_SEGMENT_SUFFIX} %{$reset_color%}" + JVCS_PROMPT_SEGMENT="%{$fg[white]%}${JVCS_PREFIX}${JVCS_ACCOUNT}${JVCS_SPLIT}${JVCS_SHEET}${JVCS_SUFFIX} %{$reset_color%}" ;; SHORT) - JVCS_PROMPT_SEGMENT="%{$fg[white]%}${JVCS_PROMPT_SEGMENT_PREFIX}${JVCS_SHEET}${JVCS_PROMPT_SEGMENT_SUFFIX} %{$reset_color%}" + JVCS_PROMPT_SEGMENT="%{$fg[white]%}${JVCS_PREFIX}${JVCS_SHEET}${JVCS_SUFFIX} %{$reset_color%}" ;; *) JVCS_PROMPT_SEGMENT='' -- cgit