Zsh Git Relative Path banner
MarkShawn2020 MarkShawn2020

Zsh Git Relative Path

AI community

Description

Zsh Git 相对路径插件 一个简单但实用的 Zsh 插件,它可以在你的命令提示符中显示相对于 Git 项目根目录的当前路径。这个插件是在 AI 的协助下在短短 10 分钟内完成的,展示了 AI 辅助开发的强大能力。

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

Cover

Logo zsh-git-relative-path

Show git-relative paths in your ZSH prompt
Oh My Zsh Plugin

InstallationUsageThemesDevelopment


Features

  • Zero configuration needed
  • Works with any oh-my-zsh theme
  • Special support for robbyrussell, agnoster, avit themes
  • Falls back to normal path when not in a git repo

Prerequisites

Installation

npm install -g @cs-magic-open/zsh-git-relative-path

Done! The plugin auto-configures itself.

Usage

# Before (in /Users/username/projects/my-project/src/components)
username ~/projects/my-project/src/components $

# After (same directory)
username src/components $

Supported Themes

Theme Status
robbyrussell Native support
agnoster Native support
avit Native support
Others Auto-patched via %~, %c, %C replacement

Development

git clone https://github.com/cs-magic-open/zsh-git-relative-path
cd zsh-git-relative-path
npm install -g .

# Debug mode
ZSH_GIT_PATH_DEBUG=1 source ~/.zshrc

License

MIT