From b3bf0f394f2530c2325bdf9c5595ed7b21dc3236 Mon Sep 17 00:00:00 2001
From: David Mohl <me@dave.cx>
Date: Fri, 4 Sep 2015 15:29:04 +0900
Subject: [PATCH] added option to remap escape key

---
 modules/editor/init.zsh | 7 +++++++
 runcoms/zpreztorc       | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/modules/editor/init.zsh b/modules/editor/init.zsh
index 9aa64d64..2e11c368 100644
--- a/modules/editor/init.zsh
+++ b/modules/editor/init.zsh
@@ -247,6 +247,13 @@ bindkey -M vicmd "v" edit-command-line
 bindkey -M vicmd "u" undo
 bindkey -M vicmd "$key_info[Control]R" redo
 
+
+# Allow remapping of command-mode key
+zstyle -s ':prezto:module:editor' escape-remap 'escape_remap'
+if [[ ! -z "$escape_remap" ]]; then
+  bindkey -M viins "$escape_remap" vi-cmd-mode
+fi
+
 if (( $+widgets[history-incremental-pattern-search-backward] )); then
   bindkey -M vicmd "?" history-incremental-pattern-search-backward
   bindkey -M vicmd "/" history-incremental-pattern-search-forward
diff --git a/runcoms/zpreztorc b/runcoms/zpreztorc
index 4778944c..72bba396 100644
--- a/runcoms/zpreztorc
+++ b/runcoms/zpreztorc
@@ -41,6 +41,9 @@ zstyle ':prezto:load' pmodule \
 # Set the key mapping style to 'emacs' or 'vi'.
 zstyle ':prezto:module:editor' key-bindings 'emacs'
 
+# If you prefer to have a different Escape key in 'vi' mode
+# zstyle ':prezto:module:editor' escape-remap 'jk'
+
 # Auto convert .... to ../..
 # zstyle ':prezto:module:editor' dot-expansion 'yes'