aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--zsh/.zshrc30
1 files changed, 29 insertions, 1 deletions
diff --git a/zsh/.zshrc b/zsh/.zshrc
index 9e1e677..01f2285 100644
--- a/zsh/.zshrc
+++ b/zsh/.zshrc
@@ -102,7 +102,22 @@ man() {
man "$@"
}
-source ~/.config/zsh/.zkbd/$TERM-${${DISPLAY:t}:-$VENDOR-$OSTYPE}
+# create a zkbd compatible hash;
+# # to add other keys to this hash, see: man 5 terminfo
+typeset -A key
+
+key[Home]=${terminfo[khome]}
+key[End]=${terminfo[kend]}
+key[Insert]=${terminfo[kich1]}
+key[Delete]=${terminfo[kdch1]}
+key[Up]=${terminfo[kcuu1]}
+key[Down]=${terminfo[kcud1]}
+key[Left]=${terminfo[kcub1]}
+key[Right]=${terminfo[kcuf1]}
+key[PageUp]=${terminfo[kpp]}
+key[PageDown]=${terminfo[knp]}
+
+# setup key accordingly
[[ -n "${key[Home]}" ]] && bindkey "${key[Home]}" beginning-of-line
[[ -n "${key[End]}" ]] && bindkey "${key[End]}" end-of-line
[[ -n "${key[Insert]}" ]] && bindkey "${key[Insert]}" overwrite-mode
@@ -114,6 +129,19 @@ source ~/.config/zsh/.zkbd/$TERM-${${DISPLAY:t}:-$VENDOR-$OSTYPE}
[[ -n "${key[PageUp]}" ]] && bindkey "${key[PageUp]}" beginning-of-buffer-or-history
[[ -n "${key[PageDown]}" ]] && bindkey "${key[PageDown]}" end-of-buffer-or-history
+# Finally, make sure the terminal is in application mode, when zle is
+# active. Only then are the values from $terminfo valid.
+if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
+ function zle-line-init () {
+ printf '%s' "${terminfo[smkx]}"
+ }
+ function zle-line-finish () {
+ printf '%s' "${terminfo[rmkx]}"
+ }
+ zle -N zle-line-init
+ zle -N zle-line-finish
+fi
+
alias sprin='curl -F "sprunge=<-" http://sprunge.us'
sprfile() {
curl -F "sprunge=<$1" http://sprunge.us