An open API service indexing awesome lists of open source software.

https://github.com/markshawn2020/zsh-git-relative-path

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

ai cursor git llm oh-my-zsh vscode windsurf zsh

Last synced: about 2 months ago
JSON representation

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

Awesome Lists containing this project

README

          


Cover


Logo
zsh-git-relative-path


Show git-relative paths in your ZSH prompt

Oh My Zsh Plugin


Installation
Usage
Themes
Development

---

## 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

- [Oh My Zsh](https://ohmyz.sh/)
- Node.js >= 14.0.0

## Installation

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

Done! The plugin auto-configures itself.

## Usage

```bash
# 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

```bash
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