mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-08 12:01:21 +02:00
users 18531 plus doc etc.: new expand-absolute-path widget
This commit is contained in:
parent
e5b55ebf45
commit
52f72086c9
4 changed files with 32 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
2014-02-28 Peter Stephenson <p.stephenson@samsung.com>
|
||||
|
||||
* users/18531 plus doc etc.: Doc/Zsh/contrib.yo,
|
||||
Functions/Zle/.distfiles, Functions/Zle/expand-absolute-path:
|
||||
new expand-absolute-path ZLE widget.
|
||||
|
||||
2014-02-24 Peter Stephenson <p.stephenson@samsung.com>
|
||||
|
||||
* Hong Xu: 32492: Completion/Unix/Command/_npm: fix outdated
|
||||
|
|
|
@ -1873,6 +1873,12 @@ Edit the command line using your visual editor, as in tt(ksh).
|
|||
|
||||
example(bindkey -M vicmd v edit-command-line)
|
||||
)
|
||||
tindex(expand-absolute-path)
|
||||
item(tt(expand-absolute-path))(
|
||||
Expand the file name under the cursor to an absolute path, resolving
|
||||
symbolic links. Where possible, the initial path segment is turned
|
||||
into a named directory or reference to a user's home directory.
|
||||
)
|
||||
tindex(history-beginning-search-backward-end)
|
||||
tindex(history-beginning-search-forward-end)
|
||||
item(tt(history-search-end))(
|
||||
|
|
|
@ -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
|
||||
|
|
19
Functions/Zle/expand-absolute-path
Normal file
19
Functions/Zle/expand-absolute-path
Normal 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
|
Loading…
Reference in a new issue