Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shell prompt cwd with 2-3 parts with special git handling #95

Open
bew opened this issue Sep 27, 2024 · 0 comments
Open

Shell prompt cwd with 2-3 parts with special git handling #95

bew opened this issue Sep 27, 2024 · 0 comments

Comments

@bew
Copy link
Owner

bew commented Sep 27, 2024

This CWD formatting should be available in all major shell, and editors if needed.
(IDEA: make a Rust impl usable everywhere? or re-impl everywhere?)

2-3 parts:

  • By default, path is split and only last 2 items are kept: …/nested/dir
  • When the 3rd last item is $HOME, put ~ instead of
  • When the 3rd last item is a Windows drive, put that drive (C:\) instead of

Examples

Given:

  • mybar is a named dir pointing to /foo/bar
  • deeper is a named dir pointing to /foo/bar/somewhere/deeper
  • myrepo is a named dir pointing to /path/to/reponame

Arbitrary path

When in /foo/bar/baz:
Show: ~mybar

When in /foo/bar/baz:
Show: ~mybar/baz

When in /foo/bar/deep/baz:
Show: …/bar/baz (?or ~mybar (bmark)/deep/baz?)

When in /path/to/somewhere:
Show: …/to/somewhere

When in /foo/bar/somewhere/deeper/in/nested/baz:
Show: ~deeper/baz (and NOT ~mybar …/nested/baz)

Git repos

When inside a git repo, show the repo name followed by the last 2 path items.
The repo name should be colored differently from the rest of the path items (with a bg color? customizable?).

MAYBE: Actually I could do this also for named directories 🤔
where the persistent part is the alias for named dir, and the remaining of the path is put on the side 👀

When (git) is mentioned here, it should be replaced by a git icon.

When in /path/to/reponame:
Show: ~myrepo (git)

When in /path/to/other-repo:
Show: …/to/other-repo (git)

When in /path/to/reponame/in/nested:
Show: ~myrepo (git)/in/nested

When in /path/to/reponame/in/nested/dir:
Show: ~myrepo (git)…/in/nested

When in /path/to/other-repo/in/nested:
Show: …/to/other-repo (git)/in/nested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

1 participant