diff options
Diffstat (limited to 'zshfunc/vcs-info/VCS_INFO_realpath')
-rw-r--r-- | zshfunc/vcs-info/VCS_INFO_realpath | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/zshfunc/vcs-info/VCS_INFO_realpath b/zshfunc/vcs-info/VCS_INFO_realpath new file mode 100644 index 0000000..ba4a12a --- /dev/null +++ b/zshfunc/vcs-info/VCS_INFO_realpath @@ -0,0 +1,11 @@ +VCS_INFO_realpath () { #{{{ + # a portable 'readlink -f' + # forcing a subshell, to ensure chpwd() is not removed + # from the calling shell (if VCS_INFO_realpath() is called + # manually). + ( + (( ${+functions[chpwd]} )) && unfunction chpwd + setopt chaselinks + cd $1 2>/dev/null && pwd + ) +} |