1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2024-11-16 02:41:13 +00:00

Use the same casing as bindkey -L, close #47

This commit is contained in:
Sorin Ionescu 2012-03-17 21:26:48 -04:00
parent f96a3b4d6e
commit 75176573c5

View File

@ -67,9 +67,9 @@ if [[ "$keymap" == (emacs|) ]]; then
bindkey -e bindkey -e
[[ -n "$keyinfo[Escape]" ]] && \ [[ -n "$keyinfo[Escape]" ]] && \
bindkey -M emacs "$keyinfo[Escape]b" emacs-backward-word bindkey -M emacs "$keyinfo[Escape]B" emacs-backward-word
[[ -n "$keyinfo[Escape]" ]] && \ [[ -n "$keyinfo[Escape]" ]] && \
bindkey -M emacs "$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 -M emacs "$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]" ]] && \
@ -77,11 +77,11 @@ if [[ "$keymap" == (emacs|) ]]; then
# Kill to the beginning of the line. # Kill to the beginning of the line.
[[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Control]" ]] && \
bindkey -M emacs "$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 -M emacs "$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]" ]] && \
@ -97,7 +97,7 @@ if [[ "$keymap" == (emacs|) ]]; then
# Edit command in an external editor. # Edit command in an external editor.
[[ -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 ../.. # Expand .... to ../..
if zstyle -t ':omz:editor' dot-expansion; then if zstyle -t ':omz:editor' dot-expansion; then
@ -108,14 +108,14 @@ if [[ "$keymap" == (emacs|) ]]; then
# 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 -M emacs "$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 -M emacs "$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 -M emacs "$keyinfo[Control]r" history-incremental-search-backward bindkey -M emacs "$keyinfo[Control]R" history-incremental-search-backward
[[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Control]" ]] && \
bindkey -M emacs "$keyinfo[Control]s" history-incremental-search-forward bindkey -M emacs "$keyinfo[Control]S" history-incremental-search-forward
fi fi
elif [[ "$keymap" == vi ]]; then elif [[ "$keymap" == vi ]]; then
# Use vi key bindings. # Use vi key bindings.
@ -164,7 +164,7 @@ elif [[ "$keymap" == vi ]]; then
# Undo/Redo # Undo/Redo
bindkey -M vicmd "u" undo 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 ../.. # Expand .... to ../..
if zstyle -t ':omz:editor' dot-expansion; then if zstyle -t ':omz:editor' dot-expansion; then
@ -177,31 +177,31 @@ elif [[ "$keymap" == vi ]]; then
# Emacs key bindings in insert mode. # Emacs key bindings in insert mode.
[[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Control]" ]] && \
bindkey -M viins "$keyinfo[Control]a" beginning-of-line bindkey -M viins "$keyinfo[Control]A" beginning-of-line
[[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Control]" ]] && \
bindkey -M viins "$keyinfo[Control]b" backward-char bindkey -M viins "$keyinfo[Control]B" backward-char
[[ -n "$keyinfo[Escape]" ]] && \ [[ -n "$keyinfo[Escape]" ]] && \
bindkey -M viins "$keyinfo[Escape]b" emacs-backward-word bindkey -M viins "$keyinfo[Escape]B" emacs-backward-word
[[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Control]" ]] && \
bindkey -M viins "$keyinfo[Control]d" delete-char-or-list bindkey -M viins "$keyinfo[Control]D" delete-char-or-list
[[ -n "$keyinfo[Escape]" ]] && \ [[ -n "$keyinfo[Escape]" ]] && \
bindkey -M viins "$keyinfo[Escape]d" kill-word bindkey -M viins "$keyinfo[Escape]D" kill-word
[[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Control]" ]] && \
bindkey -M viins "$keyinfo[Control]e" end-of-line bindkey -M viins "$keyinfo[Control]E" end-of-line
[[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Control]" ]] && \
bindkey -M viins "$keyinfo[Control]f" forward-char bindkey -M viins "$keyinfo[Control]F" forward-char
[[ -n "$keyinfo[Escape]" ]] && \ [[ -n "$keyinfo[Escape]" ]] && \
bindkey -M viins "$keyinfo[Escape]f" emacs-forward-word bindkey -M viins "$keyinfo[Escape]F" emacs-forward-word
[[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Control]" ]] && \
bindkey -M viins "$keyinfo[Control]k" kill-line bindkey -M viins "$keyinfo[Control]K" kill-line
[[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Control]" ]] && \
bindkey -M viins "$keyinfo[Control]u" backward-kill-line bindkey -M viins "$keyinfo[Control]U" backward-kill-line
[[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Control]" ]] && \
bindkey -M viins "$keyinfo[Control]w" backward-kill-word bindkey -M viins "$keyinfo[Control]W" backward-kill-word
[[ -n "$keyinfo[Escape]" ]] && \ [[ -n "$keyinfo[Escape]" ]] && \
bindkey -M viins "$keyinfo[Escape]w" copy-region-as-kill bindkey -M viins "$keyinfo[Escape]W" copy-region-as-kill
[[ -n "$keyinfo[Escape]" ]] && \ [[ -n "$keyinfo[Escape]" ]] && \
bindkey -M viins "$keyinfo[Escape]h" run-help bindkey -M viins "$keyinfo[Escape]H" run-help
[[ -n "$keyinfo[Escape]" && -n "$keyinfo[Left]" ]] && \ [[ -n "$keyinfo[Escape]" && -n "$keyinfo[Left]" ]] && \
bindkey -M viins "$keyinfo[Escape]$keyinfo[Left]" emacs-backward-word bindkey -M viins "$keyinfo[Escape]$keyinfo[Left]" emacs-backward-word
[[ -n "$keyinfo[Escape]" && -n "$keyinfo[Right]" ]] && \ [[ -n "$keyinfo[Escape]" && -n "$keyinfo[Right]" ]] && \
@ -227,18 +227,18 @@ elif [[ "$keymap" == vi ]]; then
# Emacs key bindings in insert mode. # Emacs key bindings in insert mode.
[[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Control]" ]] && \
bindkey -M viins "$keyinfo[Control]r" history-incremental-pattern-search-backward bindkey -M viins "$keyinfo[Control]R" history-incremental-pattern-search-backward
[[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Control]" ]] && \
bindkey -M viins "$keyinfo[Control]s" history-incremental-pattern-search-forward bindkey -M viins "$keyinfo[Control]S" history-incremental-pattern-search-forward
else else
bindkey -M vicmd "?" history-incremental-search-backward bindkey -M vicmd "?" history-incremental-search-backward
bindkey -M vicmd "/" history-incremental-search-forward bindkey -M vicmd "/" history-incremental-search-forward
# Emacs key bindings in insert mode. # Emacs key bindings in insert mode.
[[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Control]" ]] && \
bindkey -M viins "$keyinfo[Control]r" history-incremental-search-backward bindkey -M viins "$keyinfo[Control]R" history-incremental-search-backward
[[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Control]" ]] && \
bindkey -M viins "$keyinfo[Control]s" history-incremental-search-forward bindkey -M viins "$keyinfo[Control]S" history-incremental-search-forward
fi fi
else else
print "omz: invalid keymap: $keymap" >&2 print "omz: invalid keymap: $keymap" >&2
@ -274,31 +274,31 @@ if (( $+plugins[(er)history-substring-search] )); then
[[ -n "$keyinfo[Down]" ]] && \ [[ -n "$keyinfo[Down]" ]] && \
bindkey "$keyinfo[Down]" history-substring-search-down bindkey "$keyinfo[Down]" history-substring-search-down
[[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Control]" ]] && \
bindkey "$keyinfo[Control]p" history-substring-search-up bindkey "$keyinfo[Control]P" history-substring-search-up
[[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Control]" ]] && \
bindkey "$keyinfo[Control]n" history-substring-search-down bindkey "$keyinfo[Control]N" history-substring-search-down
else else
[[ -n "$keyinfo[Up]" ]] && \ [[ -n "$keyinfo[Up]" ]] && \
bindkey "$keyinfo[Up]" up-line-or-history bindkey "$keyinfo[Up]" up-line-or-history
[[ -n "$keyinfo[Down]" ]] && \ [[ -n "$keyinfo[Down]" ]] && \
bindkey "$keyinfo[Down]" down-line-or-history bindkey "$keyinfo[Down]" down-line-or-history
[[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Control]" ]] && \
bindkey "$keyinfo[Control]p" up-line-or-history bindkey "$keyinfo[Control]P" up-line-or-history
[[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Control]" ]] && \
bindkey "$keyinfo[Control]n" down-line-or-history bindkey "$keyinfo[Control]N" down-line-or-history
fi fi
# Clear screen. # Clear screen.
[[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Control]" ]] && \
bindkey "$keyinfo[Control]l" clear-screen bindkey "$keyinfo[Control]L" clear-screen
# Expand command name to full path. # Expand command name to full path.
[[ -n "$keyinfo[Escape]" ]] && \ [[ -n "$keyinfo[Escape]" ]] && \
bindkey "$keyinfo[Escape]e" expand-cmd-path bindkey "$keyinfo[Escape]E" expand-cmd-path
# Duplicate the previous word. # Duplicate the previous word.
[[ -n "$keyinfo[Escape]" ]] && \ [[ -n "$keyinfo[Escape]" ]] && \
bindkey "$keyinfo[Escape]m" copy-prev-shell-word bindkey "$keyinfo[Escape]M" copy-prev-shell-word
# Bind Shift + Tab to go to the previous menu item. # Bind Shift + Tab to go to the previous menu item.
[[ -n "$keyinfo[BackTab]" ]] && \ [[ -n "$keyinfo[BackTab]" ]] && \
@ -306,7 +306,7 @@ fi
# Complete in the middle of word. # Complete in the middle of word.
[[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Control]" ]] && \
bindkey "$keyinfo[Control]i" expand-or-complete-prefix bindkey "$keyinfo[Control]I" expand-or-complete-prefix
# Convert .... to ../.. automatically. # Convert .... to ../.. automatically.
if zstyle -t ':omz:editor' dot-expansion; then if zstyle -t ':omz:editor' dot-expansion; then
@ -332,5 +332,5 @@ function expand-or-complete-prefix-with-indicator() {
} }
zle -N expand-or-complete-prefix-with-indicator zle -N expand-or-complete-prefix-with-indicator
[[ -n "$keyinfo[Control]" ]] && \ [[ -n "$keyinfo[Control]" ]] && \
bindkey "$keyinfo[Control]i" expand-or-complete-prefix-with-indicator bindkey "$keyinfo[Control]I" expand-or-complete-prefix-with-indicator