From 6c181ce8dca6e65afa64e4de89b93c602c72e797 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 18 Mar 2012 21:11:49 -0400 Subject: [PATCH] [Fix #50] Remove duplicate expand dot bindings --- keyboard.zsh | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/keyboard.zsh b/keyboard.zsh index dbcb650..55418df 100644 --- a/keyboard.zsh +++ b/keyboard.zsh @@ -95,7 +95,7 @@ function zle-line-finish() { } zle -N zle-line-finish -# Converts .... to ../... +# Expands .... to ../.. function expand-dot-to-parent-directory-path() { if [[ $LBUFFER = *.. ]]; then LBUFFER+='/..' @@ -157,11 +157,6 @@ zle -N prepend-sudo [[ -n "$keyinfo[Control]" ]] && \ 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; # otherwise, bind to built-in Zsh history search. if (( $+widgets[history-incremental-pattern-search-backward] )); then @@ -193,11 +188,6 @@ bindkey -M vicmd "u" undo [[ -n "$keyinfo[Control]" ]] && \ 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. bindkey -M viins "jk" vi-cmd-mode bindkey -M viins "kj" vi-cmd-mode @@ -294,10 +284,9 @@ for keymap in 'emacs' 'viins'; do [[ -n "$keyinfo[Control]" ]] && \ bindkey -M "$keymap" "$keyinfo[Control]I" expand-or-complete-prefix - # Convert .... to ../.. automatically. + # Expand .... to ../.. if zstyle -t ':omz:editor' dot-expansion; then - # Do not expand during incremental search. - bindkey -M "$keymap" -M isearch . self-insert 2>/dev/null + bindkey -M "$keymap" "." expand-dot-to-parent-directory-path fi # 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 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. zstyle -s ':omz:editor' keymap 'keymap' if [[ "$keymap" == (emacs|) ]]; then