diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2009-01-30 21:50:50 +0100 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2009-01-30 21:50:50 +0100 |
commit | e878c394b2f23b6559c2fa888deb7ae9ce73c4a4 (patch) | |
tree | abcdc35f0530d29f6940866a72706d18af6d79a5 /etc/completions | |
parent | b01d636d4e5ea11a15ebdbc6144a746a4ca80713 (diff) |
Almost finished __git_files
Only remaining problem:
If the current relative path is shorter than a file's relative path, some ../'s might be missed
Diffstat (limited to 'etc/completions')
-rw-r--r-- | etc/completions/__git_files | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/etc/completions/__git_files b/etc/completions/__git_files index 808fe8e..dd2040d 100644 --- a/etc/completions/__git_files +++ b/etc/completions/__git_files @@ -18,7 +18,7 @@ if [[ -z $gitdir ]] { } if [[ ! -d .git ]] { - dirdiff=${PWD#${gitdir%/.git}} + dirdiff=${PWD#${gitdir%/.git}/} for ((i = 1; i <= $#files; i++)) { prefix='' item=(${(s:/:)files[$i]}) @@ -30,7 +30,12 @@ if [[ ! -d .git ]] { prefix+='../' } } - files[$i]=${prefix}${(j:/:)item} + files[$i]=${prefix} + for j in $item; { + [[ -n $j ]] && files[$i]+="$j/" + } + files[$i]=${files[$i]%/} + echo $files[$i] >> /tmp/bar } } _wanted files expl 'index file' _multi_parts $@ - / files |