mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-25 05:10:28 +02:00
unposted (users/16697): use a better output file name when the DISPLAY
variable refers to a socket file (MacOS); fix problem with writing the output file when the user overrides the default value of TERM.
This commit is contained in:
parent
f2bf8fa365
commit
915766c624
1 changed files with 8 additions and 7 deletions
|
|
@ -14,8 +14,7 @@ local zkbd term key seq
|
||||||
zkbd=${ZDOTDIR:-$HOME}/.zkbd
|
zkbd=${ZDOTDIR:-$HOME}/.zkbd
|
||||||
[[ -d $zkbd ]] || mkdir $zkbd || return 1
|
[[ -d $zkbd ]] || mkdir $zkbd || return 1
|
||||||
|
|
||||||
print 'typeset -g -A key\n' > $zkbd/$TERM.tmp || return 1
|
trap 'unfunction getmbkey getseq; command rm -f $zkbd/$TERM.tmp' 0
|
||||||
trap "unfunction getmbkey getseq; command rm -f $zkbd/$TERM.tmp" 0
|
|
||||||
trap "return 1" 1 2 15
|
trap "return 1" 1 2 15
|
||||||
|
|
||||||
getmbkey () {
|
getmbkey () {
|
||||||
|
|
@ -57,6 +56,7 @@ getseq () {
|
||||||
|
|
||||||
read term"?Enter current terminal type: [$TERM] "
|
read term"?Enter current terminal type: [$TERM] "
|
||||||
[[ -n $term ]] && TERM=$term
|
[[ -n $term ]] && TERM=$term
|
||||||
|
print 'typeset -g -A key\n' > $zkbd/$TERM.tmp || return 1
|
||||||
|
|
||||||
cat <<\EOF
|
cat <<\EOF
|
||||||
|
|
||||||
|
|
@ -251,21 +251,22 @@ else
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local termID=${DISPLAY:-$VENDOR-$OSTYPE}
|
local termID=${${DISPLAY:t}:-$VENDOR-$OSTYPE} termFile=$zkbd/$TERM.tmp
|
||||||
command mv $zkbd/$TERM.tmp $zkbd/$TERM-$termID
|
command mv $termFile $zkbd/$TERM-$termID && termFile=$zkbd/$TERM-$termID
|
||||||
|
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
|
|
||||||
Parameter assignments for the keys you typed have been written to the file:
|
Parameter assignments for the keys you typed have been written to the file:
|
||||||
$zkbd/$TERM-$termID
|
$termFile
|
||||||
|
|
||||||
You may read this file into ${ZDOTDIR:-$HOME}/.zshrc or another startup
|
You may read this file into ${ZDOTDIR:-$HOME}/.zshrc or another startup
|
||||||
file with the "source" or "." commands, then reference the \$key parameter
|
file with the "source" or "." commands, then reference the \$key parameter
|
||||||
in bindkey commands, like this:
|
in bindkey commands, for example like this:
|
||||||
|
|
||||||
source ${zkbd/$HOME/~}/\$TERM-\${DISPLAY:-\$VENDOR-\$OSTYPE}
|
source ${(D)zkbd}/\$TERM-\${\${DISPLAY:t}:-\$VENDOR-\$OSTYPE}
|
||||||
[[ -n \${key[Left]} ]] && bindkey "\${key[Left]}" backward-char
|
[[ -n \${key[Left]} ]] && bindkey "\${key[Left]}" backward-char
|
||||||
[[ -n \${key[Right]} ]] && bindkey "\${key[Right]}" forward-char
|
[[ -n \${key[Right]} ]] && bindkey "\${key[Right]}" forward-char
|
||||||
# etc.
|
# etc.
|
||||||
|
|
||||||
|
Adjust the name of the file being sourced, as necessary.
|
||||||
EOF
|
EOF
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue