1
0
mirror of https://github.com/bertptrs/vimconfig.git synced 2025-12-25 20:40:32 +01:00

Add key configuration.

As terminfo seems to be off for xterm, I use zkbd instead. The files are
nice and small so they can be in the repo to prevent myself from running
it over and over.
This commit is contained in:
Bert Peters
2016-11-27 23:32:13 +01:00
parent d4838fd56b
commit 4bfd34838a
2 changed files with 48 additions and 2 deletions

View File

@@ -0,0 +1,26 @@
typeset -g -A key
key[F1]='^[OP'
key[F2]='^[OQ'
key[F3]='^[OR'
key[F4]='^[OS'
key[F5]='^[[15~'
key[F6]='^[[17~'
key[F7]='^[[18~'
key[F8]='^[[19~'
key[F9]='^[[20~'
key[F10]=''''
key[F11]=''''
key[F12]='^[[24~'
key[Backspace]='^?'
key[Insert]='^[[2~'
key[Home]='^[[H'
key[PageUp]='^[[5~'
key[Delete]='^[[3~'
key[End]='^[[F'
key[PageDown]='^[[6~'
key[Up]='^[[A'
key[Left]='^[[D'
key[Down]='^[[B'
key[Right]='^[[C'
key[Menu]=''''

View File

@@ -8,6 +8,26 @@ if [[ -o interactive ]] && [[ -n $SSH_TTY ]] && [[ -z $TMUX ]] && hash tmux &> /
exit $?
fi
#######################
# Initialize keyboard #
#######################
autoload zkbd
function zkbd_file() {
[[ -f ~/.zkbd/${TERM}-${VENDOR}-${OSTYPE} ]] && printf '%s' ~/".zkbd/${TERM}-${VENDOR}-${OSTYPE}" && return 0
[[ -f ~/.zkbd/${TERM}-${DISPLAY} ]] && printf '%s' ~/".zkbd/${TERM}-${DISPLAY}" && return 0
return 1
}
[[ ! -d ~/.zkbd ]] && mkdir ~/.zkbd
keyfile=$(zkbd_file)
if [[ $? -eq 0 ]]; then
source "${keyfile}"
elif [[ -o interactive ]]; then
echo "Unable to load key data for special keys. Run zkbd to fix."
fi
unfunction zkbd_file; unset keyfile
bindkey -e
# zshrc aliases
alias ls='ls --color=auto'
@@ -68,8 +88,8 @@ if [[ -f /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.
fi
# Home and end keys working
bindkey "${terminfo[khome]}" beginning-of-line
bindkey "${terminfo[kend]}" end-of-line
bindkey "${key[Home]}" beginning-of-line
bindkey "${key[End]}" end-of-line
# Transfer.sh plugin
transfer() { if [ $# -eq 0 ]; then echo "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi