summaryrefslogtreecommitdiff
path: root/lib/key-bindings.zsh
diff options
context:
space:
mode:
authorFelix Dreissig <f30@f30.me>2012-10-14 00:07:47 +0200
committerFelix Dreissig <f30@f30.me>2012-10-14 00:10:40 +0200
commitff0cafa14db5b728f823ee486ec1bf5a9d2725eb (patch)
tree938e54926f1a48219a8b6fb0e9ef791bf7515531 /lib/key-bindings.zsh
parent3839c6e9e62a2671b1d3f5662e4d2bc3984c3f9e (diff)
downloadzsh-ff0cafa14db5b728f823ee486ec1bf5a9d2725eb.tar.gz
zsh-ff0cafa14db5b728f823ee486ec1bf5a9d2725eb.tar.bz2
zsh-ff0cafa14db5b728f823ee486ec1bf5a9d2725eb.zip
Make sure the terminal is always in application mode when zle is active.
Diffstat (limited to 'lib/key-bindings.zsh')
-rw-r--r--lib/key-bindings.zsh13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh
index 8168c8d90..a57b04122 100644
--- a/lib/key-bindings.zsh
+++ b/lib/key-bindings.zsh
@@ -2,6 +2,19 @@
# http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Zle-Builtins
# http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Standard-Widgets
+# Make sure that the terminal is in application mode when zle is active, since
+# only then values from $terminfo are valid
+if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
+ function zle-line-init() {
+ echoti smkx
+ }
+ function zle-line-finish() {
+ echoti rmkx
+ }
+ zle -N zle-line-init
+ zle -N zle-line-finish
+fi
+
bindkey -e # Use emacs key bindings
bindkey '\ew' kill-region # [Esc-w] - Kill from the cursor to the mark