mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-26 02:12:33 +01:00
try to configure strange functions
This commit is contained in:
parent
d264b764c0
commit
485e5ca03c
1 changed files with 39 additions and 0 deletions
39
lib/strange-terminals.zsh
Normal file
39
lib/strange-terminals.zsh
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
#-*- sh -*-
|
||||||
|
|
||||||
|
# From http://zshwiki.org/home/zle/bindkeys
|
||||||
|
|
||||||
|
if [ "$STRANGE_TERMINAL" = "true" ]; then
|
||||||
|
|
||||||
|
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)
|
||||||
|
ret=$?
|
||||||
|
if [[ ${ret} -ne 0 ]]; then
|
||||||
|
zkbd
|
||||||
|
keyfile=$(zkbd_file)
|
||||||
|
ret=$?
|
||||||
|
fi
|
||||||
|
if [[ ${ret} -eq 0 ]] ; then
|
||||||
|
source "${keyfile}"
|
||||||
|
else
|
||||||
|
printf 'Failed to setup keys using zkbd.\n'
|
||||||
|
fi
|
||||||
|
unfunction zkbd_file; unset keyfile ret
|
||||||
|
|
||||||
|
# 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
|
||||||
|
[[ -n "${key[Delete]}" ]] && bindkey "${key[Delete]}" delete-char
|
||||||
|
[[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" up-line-or-history
|
||||||
|
[[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" down-line-or-history
|
||||||
|
[[ -n "${key[Left]}" ]] && bindkey "${key[Left]}" backward-char
|
||||||
|
[[ -n "${key[Right]}" ]] && bindkey "${key[Right]}" forward-char
|
||||||
|
|
||||||
|
fi
|
||||||
Loading…
Add table
Add a link
Reference in a new issue