# Arc Plugin for Oh My Zsh Provides prompt functions and aliases for Arc VCS, similar to the built-in git plugin. ## Installation ```bash git clone https://github.com/dkryaklin/arc-zsh-plugin.git ~/.oh-my-zsh/custom/plugins/arc ``` ### Option 1: Oh My Zsh plugin Add `arc` to your plugins in `~/.zshrc`: ```bash plugins=(... arc) ``` ### Option 2: Direct source ```bash source ~/.oh-my-zsh/custom/plugins/arc/arc.plugin.zsh ``` ## Usage in Prompt Add `$(arc_prompt_info)` to your `PROMPT` or `RPROMPT` in `~/.zshrc`: ```bash # Example: Add to right prompt RPROMPT='$(arc_prompt_info)' # Example: Add to main prompt PROMPT='%{$fg[cyan]%}%c%{$reset_color%} $(arc_prompt_info) %# ' ``` ## Available Functions | Function | Description | |----------|-------------| | `arc_prompt_info` | Main prompt function: `arc:(branch) ✗` | | `arc_prompt_short` | Just branch name: `(branch)` | | `arc_prompt_status` | Detailed counts: `+2 ~3 ?1` | | `arc_current_branch` | Returns current branch name | | `arc_is_repo` | Returns 0 if in arc repo | | `arc_is_dirty` | Returns 0 if there are changes | | `arc_has_staged` | Returns 0 if there are staged files | | `arc_has_untracked` | Returns 0 if there are untracked files | | `arc_clear_cache` | Manually clear status cache | ## Status Symbols | Symbol | Meaning | |--------|---------| | ✔ | Clean (no changes) | | ✗ | Dirty (modified files) | | ● | Staged changes | | ? | Untracked files | | ✖ | Merge conflicts | ## Aliases | Alias | Command | |-------|---------| | `arst` | `arc status` | | `arbr` | `arc branch` | | `arco` | `arc checkout` | | `arcob` | `arc checkout -b` | | `ardf` | `arc diff` | | `arlg` | `arc log` | | `arad` | `arc add` | | `arcm` | `arc commit -m` | | `arcam` | `arc commit -a -m` | | `arpl` | `arc pull` | | `arps` | `arc push` | | `arsb` | `arc submit` | | `arsbm` | `arc submit -m` | | `arrb` | `arc rebase` | | `arstash` | `arc stash push` | | `arstashp` | `arc stash pop` | ## Configuration Customize symbols and colors in your `~/.zshrc` (before loading the plugin): ```bash # Change prefix/suffix ARC_PROMPT_PREFIX="%{$fg[blue]%}[" ARC_PROMPT_SUFFIX="%{$reset_color%}]" # Change symbols ARC_PROMPT_DIRTY=" *" ARC_PROMPT_CLEAN="" ARC_PROMPT_STAGED=" +" ARC_PROMPT_UNTRACKED=" ?" # Cache timeout in seconds (default: 2) # Increase if arc is slow in your repo ARC_STATUS_CACHE_TIMEOUT=5 ``` ## Performance Arc can be slower than git in large monorepos. The plugin includes: - **Status caching**: Results are cached for 2 seconds (configurable) - **Auto cache clear**: Cache is cleared after arc commands (commit, checkout, etc.) - **Manual clear**: Call `arc_clear_cache` if needed ## Troubleshooting **Prompt not updating after arc commands?** ```bash arc_clear_cache ``` **Arc commands are slow?** Increase cache timeout: ```bash ARC_STATUS_CACHE_TIMEOUT=10 ``` **Colors not showing?** Make sure you have colors enabled: ```bash autoload -U colors && colors ```