|
|
@ -1,8 +1,8 @@ |
|
|
|
# ------------------------------------------------------------------------------ |
|
|
|
# ------------------------------------------------------------------------------ |
|
|
|
# FILE: vi-mode.plugin.zsh |
|
|
|
# FILE: vi-mode.plugin.zsh |
|
|
|
# DESCRIPTION: oh-my-zsh plugin file. |
|
|
|
# DESCRIPTION: oh-my-zsh plugin file. |
|
|
|
# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com) |
|
|
|
# AUTHOR: Sorin Ionescu <sorin.ionescu@gmail.com> |
|
|
|
# VERSION: 1.0.2 |
|
|
|
# VERSION: 1.0.3 |
|
|
|
# ------------------------------------------------------------------------------ |
|
|
|
# ------------------------------------------------------------------------------ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -11,13 +11,9 @@ autoload -Uz edit-command-line |
|
|
|
|
|
|
|
|
|
|
|
# If mode indicator wasn't setup by theme, define a default. |
|
|
|
# If mode indicator wasn't setup by theme, define a default. |
|
|
|
if [[ "$MODE_INDICATOR" == "" ]]; then |
|
|
|
if [[ "$MODE_INDICATOR" == "" ]]; then |
|
|
|
MODE_INDICATOR="%{$fg_bold[red]%}<%{$reset_color%}%{$fg[red]%}<<%{$reset_color%}" |
|
|
|
MODE_INDICATOR="%B%F{red}<%f%b%F{red}<<%f" |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
function zle-line-init zle-keymap-select { |
|
|
|
|
|
|
|
zle reset-prompt |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# If I am using vi keys, I want to know what mode I'm currently using. |
|
|
|
# If I am using vi keys, I want to know what mode I'm currently using. |
|
|
|
# zle-keymap-select is executed every time KEYMAP changes. |
|
|
|
# zle-keymap-select is executed every time KEYMAP changes. |
|
|
|
# From http://zshwiki.org/home/examples/zlewidgets |
|
|
|
# From http://zshwiki.org/home/examples/zlewidgets |
|
|
@ -55,13 +51,54 @@ bindkey -M vicmd v edit-command-line # ESC-v to edit in an external editor. |
|
|
|
bindkey ' ' magic-space |
|
|
|
bindkey ' ' magic-space |
|
|
|
bindkey -M vicmd "gg" beginning-of-history |
|
|
|
bindkey -M vicmd "gg" beginning-of-history |
|
|
|
bindkey -M vicmd "G" end-of-history |
|
|
|
bindkey -M vicmd "G" end-of-history |
|
|
|
bindkey -M vicmd "k" history-search-backward |
|
|
|
|
|
|
|
bindkey -M vicmd "j" history-search-forward |
|
|
|
# Bind to history substring search plugin if enabled; |
|
|
|
bindkey -M vicmd "?" history-incremental-search-backward |
|
|
|
# otherwise, bind to built-in ZSH history search. |
|
|
|
bindkey -M vicmd "/" history-incremental-search-forward |
|
|
|
if (( $+plugins[(er)history-substring-search] )); then |
|
|
|
|
|
|
|
bindkey -M vicmd "k" history-substring-search-up |
|
|
|
bindkey -M viins "^L" clear-screen |
|
|
|
bindkey -M vicmd "j" history-substring-search-down |
|
|
|
bindkey -M viins "^W" backward-kill-word |
|
|
|
else |
|
|
|
bindkey -M viins "^A" beginning-of-line |
|
|
|
bindkey -M vicmd "k" history-search-backward |
|
|
|
bindkey -M viins "^E" end-of-line |
|
|
|
bindkey -M vicmd "j" history-search-forward |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bindkey "^P" up-line-or-search |
|
|
|
|
|
|
|
bindkey -M vicmd "k" up-line-or-search |
|
|
|
|
|
|
|
bindkey -M vicmd "^k" up-line-or-search |
|
|
|
|
|
|
|
bindkey -M viins "^k" up-line-or-search |
|
|
|
|
|
|
|
bindkey "^N" down-line-or-search |
|
|
|
|
|
|
|
bindkey -M vicmd "j" down-line-or-search |
|
|
|
|
|
|
|
bindkey -M vicmd "^j" down-line-or-search |
|
|
|
|
|
|
|
bindkey -M viins "^j" down-line-or-search |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bindkey -M viins '^r' history-incremental-pattern-search-backward |
|
|
|
|
|
|
|
bindkey -M viins '^f' history-incremental-pattern-search-forward |
|
|
|
|
|
|
|
bindkey -M vicmd "?" history-incremental-pattern-search-backward |
|
|
|
|
|
|
|
bindkey -M vicmd "/" history-incremental-pattern-search-forward |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bindkey -M vicmd "^l" clear-screen |
|
|
|
|
|
|
|
bindkey -M viins "^l" clear-screen |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bindkey -M vicmd "^w" backward-kill-word |
|
|
|
|
|
|
|
bindkey -M viins "^w" backward-kill-word |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bindkey -M vicmd "^a" beginning-of-line |
|
|
|
|
|
|
|
bindkey -M viins "^a" beginning-of-line |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bindkey -M vicmd "^e" end-of-line |
|
|
|
|
|
|
|
bindkey -M viins "^e" end-of-line |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bindkey -M vicmd '^d' delete |
|
|
|
|
|
|
|
bindkey -M viins '^d' delete |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bindkey -M vicmd '^?' backward-delete-char |
|
|
|
|
|
|
|
bindkey -M viins '^?' backward-delete-char |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 'jj' = ESC |
|
|
|
|
|
|
|
bindkey -M viins 'jj' vi-cmd-mode |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (( ${+functions[rationalize-dot]} )); then |
|
|
|
|
|
|
|
bindkey -M viins '.' rationalize-dot |
|
|
|
|
|
|
|
bindkey -M isearch . self-insert 2>/dev/null |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|