Bind to the emacs keymap, not main.

main
Sorin Ionescu 13 years ago
parent ad731e4830
commit 9ad18fe7a7

@ -70,55 +70,55 @@ if zstyle -m ':omz:editor' keymap 'emacs'; then
bindkey -e bindkey -e
[[ -n "$keyinfo[Escape]" ]] && \ [[ -n "$keyinfo[Escape]" ]] && \
bindkey "$keyinfo[Escape]b" emacs-backward-word bindkey -M emacs "$keyinfo[Escape]b" emacs-backward-word
[[ -n "$keyinfo[Escape]" ]] && \ [[ -n "$keyinfo[Escape]" ]] && \
bindkey "$keyinfo[Escape]f" emacs-forward-word bindkey -M emacs "$keyinfo[Escape]f" emacs-forward-word
[[ -n "$keyinfo[Escape]" ]] && [[ -n "$keyinfo[Left]" ]] && \ [[ -n "$keyinfo[Escape]" ]] && [[ -n "$keyinfo[Left]" ]] && \
bindkey "$keyinfo[Escape]$keyinfo[Left]" emacs-backward-word bindkey -M emacs "$keyinfo[Escape]$keyinfo[Left]" emacs-backward-word
[[ -n "$keyinfo[Escape]" ]] && [[ -n "$keyinfo[Right]" ]] && \ [[ -n "$keyinfo[Escape]" ]] && [[ -n "$keyinfo[Right]" ]] && \
bindkey "$keyinfo[Escape]$keyinfo[Right]" emacs-forward-word bindkey -M emacs "$keyinfo[Escape]$keyinfo[Right]" emacs-forward-word
# Kill to the beginning of the line. # Kill to the beginning of the line.
[[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Control]" ]] && \
bindkey "$keyinfo[Control]u" backward-kill-line bindkey -M emacs "$keyinfo[Control]u" backward-kill-line
# Kill to the beginning of the word. # Kill to the beginning of the word.
[[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Control]" ]] && \
bindkey "$keyinfo[Control]w" backward-kill-word bindkey -M emacs "$keyinfo[Control]w" backward-kill-word
# Undo/Redo # Undo/Redo
[[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Control]" ]] && \
bindkey "$keyinfo[Control]_" undo bindkey -M emacs "$keyinfo[Control]_" undo
[[ -n "$keyinfo[Escape]" ]] && \ [[ -n "$keyinfo[Escape]" ]] && \
bindkey "$keyinfo[Escape]_" redo bindkey -M emacs "$keyinfo[Escape]_" redo
# Search character. # Search character.
[[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Control]" ]] && \
bindkey "$keyinfo[Control]]" vi-find-next-char bindkey -M emacs "$keyinfo[Control]]" vi-find-next-char
[[ -n "$keyinfo[Escape]" ]] && [[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Escape]" ]] && [[ -n "$keyinfo[Control]" ]] && \
bindkey "$keyinfo[Escape]$keyinfo[Control]]" vi-find-prev-char bindkey -M emacs "$keyinfo[Escape]$keyinfo[Control]]" vi-find-prev-char
# Edit command in an external editor. # Edit command in an external editor.
[[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Control]" ]] && \
bindkey "$keyinfo[Control]x$keyinfo[Control]e" edit-command-line bindkey -M emacs "$keyinfo[Control]x$keyinfo[Control]e" edit-command-line
# Expand .... to ../.. # Expand .... to ../..
if zstyle -t ':omz:editor' dot-expansion; then if zstyle -t ':omz:editor' dot-expansion; then
bindkey "." expand-dot-to-parent-directory-path bindkey -M emacs "." expand-dot-to-parent-directory-path
fi 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
[[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Control]" ]] && \
bindkey "$keyinfo[Control]r" history-incremental-pattern-search-backward bindkey -M emacs "$keyinfo[Control]r" history-incremental-pattern-search-backward
[[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Control]" ]] && \
bindkey "$keyinfo[Control]s" history-incremental-pattern-search-forward bindkey -M emacs "$keyinfo[Control]s" history-incremental-pattern-search-forward
else else
[[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Control]" ]] && \
bindkey "$keyinfo[Control]r" history-incremental-search-backward bindkey -M emacs "$keyinfo[Control]r" history-incremental-search-backward
[[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Control]" ]] && \
bindkey "$keyinfo[Control]s" history-incremental-search-forward bindkey -M emacs "$keyinfo[Control]s" history-incremental-search-forward
fi fi
fi fi

Loading…
Cancel
Save