1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-22 16:20:23 +02:00

users 18531 plus doc etc.: new expand-absolute-path widget

This commit is contained in:
Peter Stephenson 2014-02-28 18:44:49 +00:00
parent e5b55ebf45
commit 52f72086c9
4 changed files with 32 additions and 0 deletions

View file

@ -10,6 +10,7 @@ delete-whole-word-match
down-case-word-match
down-line-or-beginning-search
edit-command-line
expand-absolute-path
forward-word-match
history-beginning-search-menu
history-pattern-search

View file

@ -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