[Fix #50] Remove duplicate expand dot bindings

This commit is contained in:
Sorin Ionescu 2012-03-18 21:11:49 -04:00
parent 12a4117525
commit 6c181ce8dc

View file

@ -95,7 +95,7 @@ function zle-line-finish() {
} }
zle -N zle-line-finish zle -N zle-line-finish
# Converts .... to ../... # Expands .... to ../..
function expand-dot-to-parent-directory-path() { function expand-dot-to-parent-directory-path() {
if [[ $LBUFFER = *.. ]]; then if [[ $LBUFFER = *.. ]]; then
LBUFFER+='/..' LBUFFER+='/..'
@ -157,11 +157,6 @@ zle -N prepend-sudo
[[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Control]" ]] && \
bindkey -M emacs "$keyinfo[Control]X$keyinfo[Control]E" edit-command-line bindkey -M emacs "$keyinfo[Control]X$keyinfo[Control]E" edit-command-line
# Expand .... to ../..
if zstyle -t ':omz:editor' dot-expansion; then
bindkey -M emacs "." expand-dot-to-parent-directory-path
fi
# Bind to history substring search plugin if enabled; # Bind to history substring search plugin if enabled;
# otherwise, bind to built-in Zsh history search. # otherwise, bind to built-in Zsh history search.
if (( $+widgets[history-incremental-pattern-search-backward] )); then if (( $+widgets[history-incremental-pattern-search-backward] )); then
@ -193,11 +188,6 @@ bindkey -M vicmd "u" undo
[[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Control]" ]] && \
bindkey -M vicmd "$keyinfo[Control]R" redo bindkey -M vicmd "$keyinfo[Control]R" redo
# Expand .... to ../..
if zstyle -t ':omz:editor' dot-expansion; then
bindkey -M viins "." expand-dot-to-parent-directory-path
fi
# Switch to command mode. # Switch to command mode.
bindkey -M viins "jk" vi-cmd-mode bindkey -M viins "jk" vi-cmd-mode
bindkey -M viins "kj" vi-cmd-mode bindkey -M viins "kj" vi-cmd-mode
@ -294,10 +284,9 @@ for keymap in 'emacs' 'viins'; do
[[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Control]" ]] && \
bindkey -M "$keymap" "$keyinfo[Control]I" expand-or-complete-prefix bindkey -M "$keymap" "$keyinfo[Control]I" expand-or-complete-prefix
# Convert .... to ../.. automatically. # Expand .... to ../..
if zstyle -t ':omz:editor' dot-expansion; then if zstyle -t ':omz:editor' dot-expansion; then
# Do not expand during incremental search. bindkey -M "$keymap" "." expand-dot-to-parent-directory-path
bindkey -M "$keymap" -M isearch . self-insert 2>/dev/null
fi fi
# Display an indicator when completing. # Display an indicator when completing.
@ -310,6 +299,11 @@ for keymap in 'emacs' 'viins'; do
bindkey -M "$keymap" "$keyinfo[Control]X$keyinfo[Control]S" prepend-sudo bindkey -M "$keymap" "$keyinfo[Control]X$keyinfo[Control]S" prepend-sudo
done done
# Do not expand .... to ../.. during incremental search.
if zstyle -t ':omz:editor' dot-expansion; then
bindkey -M isearch . self-insert 2> /dev/null
fi
# Set the key layout. # Set the key layout.
zstyle -s ':omz:editor' keymap 'keymap' zstyle -s ':omz:editor' keymap 'keymap'
if [[ "$keymap" == (emacs|) ]]; then if [[ "$keymap" == (emacs|) ]]; then