[#50] Split widget definition from widget binding

This commit is contained in:
Sorin Ionescu 2012-03-18 19:00:12 -04:00
parent a51cfb43a6
commit 6c341cfe35
1 changed files with 21 additions and 17 deletions

View File

@ -95,6 +95,26 @@ function zle-line-finish() {
}
zle -N zle-line-finish
# Converts .... to ../...
function expand-dot-to-parent-directory-path() {
if [[ $LBUFFER = *.. ]]; then
LBUFFER+='/..'
else
LBUFFER+='.'
fi
}
zle -N expand-dot-to-parent-directory-path
# Displays an indicator when completing.
function expand-or-complete-prefix-with-indicator() {
local indicator
zstyle -s ':omz:completion' indicator 'indicator'
print -Pn "$indicator"
zle expand-or-complete-prefix
zle redisplay
}
zle -N expand-or-complete-prefix-with-indicator
zstyle -s ':omz:editor' keymap 'keymap'
if [[ "$keymap" == (emacs|) ]]; then
# Use Emacs key bindings.
@ -272,27 +292,11 @@ fi
# Convert .... to ../.. automatically.
if zstyle -t ':omz:editor' dot-expansion; then
function expand-dot-to-parent-directory-path() {
if [[ $LBUFFER = *.. ]]; then
LBUFFER+=/..
else
LBUFFER+=.
fi
}
zle -N expand-dot-to-parent-directory-path
# Do not expand .... to ../.. during incremental search.
# Do not expand during incremental search.
bindkey -M isearch . self-insert 2>/dev/null
fi
# Display an indicator when completing.
function expand-or-complete-prefix-with-indicator() {
local indicator
zstyle -s ':omz:completion' indicator 'indicator'
print -Pn "$indicator"
zle expand-or-complete-prefix
zle redisplay
}
zle -N expand-or-complete-prefix-with-indicator
[[ -n "$keyinfo[Control]" ]] && \
bindkey "$keyinfo[Control]I" expand-or-complete-prefix-with-indicator