Permalink
Browse files

ZSH USERS NOTE BACKWARD COMPATIBILITY WARNING!

use cool PWD functionality in zsh precmd (and avoid a subshell) at
the expense of a kind of clunky if/else. Thanks @sorin-ionescu.
  • Loading branch information...
rupa committed Aug 30, 2012
1 parent 3d896ea commit 9bf5feb86ac05ad32cd8fbf46d459eb415eed749
Showing with 9 additions and 3 deletions.
  1. +9 −3 z.sh
View
12 z.sh
@@ -188,9 +188,15 @@ if complete &> /dev/null; then
elif compctl &> /dev/null; then
[ "$_Z_NO_PROMPT_COMMAND" ] || {
# populate directory list, avoid clobbering any other precmds
- _z_precmd() {
- _z --add "$(pwd $_Z_RESOLVE_SYMLINKS)"
- }
+ if [ "$_Z_NO_RESOLVE_SYMLINKS" ]; then
+ _z_precmd() {
+ _z --add "${PWD:a}"
+ }
+ else
+ _z_precmd() {
+ _z --add "${PWD:A}"
+ }
+ fi
precmd_functions+=(_z_precmd)
}
# zsh tab completion

0 comments on commit 9bf5feb

Please sign in to comment.