diff options
author | Peter Stephenson <pws@zsh.org> | 2014-02-28 18:44:49 +0000 |
---|---|---|
committer | Peter Stephenson <pws@zsh.org> | 2014-02-28 18:44:49 +0000 |
commit | 52f72086c93d4b5faec06665bc352246d3f4ec3f (patch) | |
tree | 7a1ea19af006f39727e309b82d23a4ad5e1de1e6 /Functions/Zle/expand-absolute-path | |
parent | e5b55ebf4546b82a1cc5c2b03d404da046a28df2 (diff) | |
download | zsh-52f72086c93d4b5faec06665bc352246d3f4ec3f.tar.gz zsh-52f72086c93d4b5faec06665bc352246d3f4ec3f.tar.xz zsh-52f72086c93d4b5faec06665bc352246d3f4ec3f.zip |
users 18531 plus doc etc.: new expand-absolute-path widget
Diffstat (limited to 'Functions/Zle/expand-absolute-path')
-rw-r--r-- | Functions/Zle/expand-absolute-path | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Functions/Zle/expand-absolute-path b/Functions/Zle/expand-absolute-path new file mode 100644 index 000000000..b85757600 --- /dev/null +++ b/Functions/Zle/expand-absolute-path @@ -0,0 +1,19 @@ +# expand-absolute-path +# This is a ZLE widget to expand the absolute path to a file, +# using directory naming to shorten the path where possible. + +emulate -L zsh +setopt extendedglob cbases + +autoload -Uz modify-current-argument + +if (( ! ${+functions[glob-expand-absolute-path]} )); then + glob-expand-absolute-path() { + local -a files + files=(${~1}(N:A)) + (( ${#files} )) || return + REPLY=${(D)files[1]} + } +fi + +modify-current-argument glob-expand-absolute-path |