Would love to have an option to truncate the cwd to the repo here
(stolen option from the Spaceship theme, link below)
Desired behavior:
add BULLET_TRAIN_TRUNC_REPO option
if inside a git repo, dir prompt starts there
follow rules of BULLETTRAIN_DIR_EXTEND, but starting at git repo:
[0] gitrepo...baz || [1] gitrepo...foo/bar/baz || [2] gitrepo/src/foo/bar/baz
I've gotten it to work with just truncating to the current repo if inside a git repo, but my bash skills are minimal. I'd be happy to make a PR if anyone can help point me in the right direction or if I manage to get it working on my own.
Current code:
not setup as an option
does start dir at repo if inside
outputs entire remaining path from repo regardless of BULLETTRAIN_DIR_EXTEND
prompt_dir() {
...
if $(git rev-parse --is-inside-work-tree >/dev/null >2&1); then
local git_root=$(git rev-parse --show-toplevel)
dir="$git_root:t${$(expr $pwd( -P) : "$git_root\(.*\)")}"
elif [[ $BULLETTRAIN_DIR_EXTENDED == 0 ]]; then
...
Would love to have an option to truncate the cwd to the repo here (stolen option from the Spaceship theme, link below)
Desired behavior:
[0] gitrepo...baz || [1] gitrepo...foo/bar/baz || [2] gitrepo/src/foo/bar/baz
I've gotten it to work with just truncating to the current repo if inside a git repo, but my bash skills are minimal. I'd be happy to make a PR if anyone can help point me in the right direction or if I manage to get it working on my own.
Current code:
<3 BULLETTRAIN, thanks!!
https://github.com/denysdovhan/spaceship-prompt/blob/master/sections/dir.zsh#L27 https://github.com/denysdovhan/spaceship-prompt/blob/master/lib/utils.zsh#L23