Michael Hauser-Raspe <michael.hauser-raspe@cantab.net>
Committer
Michael Hauser-Raspe <michael.hauser-raspe@cantab.net>
Date
Message
Added v as a keybinding to edit-command-line
taken from [here](http://www.zsh.org/mla/users/2008/msg01013.html)
We want pressing v in command mode to take us to an editor (defined by the $VISUAL or $EDITOR variable or vi) to edit the current contents of the command line which (I believe) is a standard feature of bash vi-mode or other readline prompts (see [here](http://www.catonmat.net/download/bash-vi-editing-mode-cheat-sheet.pdf) and [here](http://www.catonmat.net/blog/bash-vi-editing-mode-cheat-sheet/) for source).
Diff
1diff --git a/plugins/vi-mode/vi-mode.plugin.zsh b/plugins/vi-mode/vi-mode.plugin.zsh
2index a06100472a9710b1bc112121239a2b169f898f88..3ed32b3fb29decd731c6780a73f757f8945c6bd6 100644
3--- a/plugins/vi-mode/vi-mode.plugin.zsh
4+++ b/plugins/vi-mode/vi-mode.plugin.zsh
5@@ -17,9 +17,15 @@ function zle-keymap-select zle-line-init zle-line-finish {
6 zle -N zle-line-init
7 zle -N zle-line-finish
8 zle -N zle-keymap-select
9+zle -N edit-command-line
10+
1112 bindkey -v
1314+# allow v to edit the command line (standard behaviour)
15+autoload -Uz edit-command-line
16+bindkey -M vicmd 'v' edit-command-line
17+
18 # if mode indicator wasn't setup by theme, define default
19 if [[ "$MODE_INDICATOR" == "" ]]; then
20 MODE_INDICATOR="%{$fg_bold[red]%}<%{$fg[red]%}<<%{$reset_color%}"