summary refs log tree commit diff
path: root/Functions/Zle/expand-absolute-path
blob: 4887f3c604e0029e7901bac4e819f3c0957fd986 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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:P))
    (( ${#files} )) || return
    REPLY=${(D)files[1]}
  }
fi

modify-current-argument glob-expand-absolute-path