mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-23 04:30:24 +02:00
Functions/Misc/zkbd: add -h to local declaration in is-this-a-function test.
Use $DISPLAY when we have one instead of only $VENDOR-$OSTYPE as file name suffix. Add some knowledge of the MULTIBYTE option and its effects.
This commit is contained in:
parent
567a8e1d50
commit
bda53dc6d5
2 changed files with 33 additions and 9 deletions
|
|
@ -1,3 +1,10 @@
|
||||||
|
2008-03-14 Barton E. Schaefer <schaefer@zsh.org>
|
||||||
|
|
||||||
|
* unposted (see 24709): Functions/Misc/zkbd: add -h to local
|
||||||
|
declaration in is-this-a-function test. Use $DISPLAY when we
|
||||||
|
have one instead of only $VENDOR-$OSTYPE as file name suffix.
|
||||||
|
Add some knowledge of the MULTIBYTE option and its effects.
|
||||||
|
|
||||||
2008-03-14 Peter Stephenson <pws@csr.com>
|
2008-03-14 Peter Stephenson <pws@csr.com>
|
||||||
|
|
||||||
* 24712: Src/utils.c: handling of backticks when being requoted
|
* 24712: Src/utils.c: handling of backticks when being requoted
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
#!/bin/zsh -f
|
#!/bin/zsh -f
|
||||||
|
|
||||||
[[ -o interactive ]] && {
|
[[ -o interactive ]] && {
|
||||||
local -i ARGC
|
local -hi ARGC # local is a no-op outside of a function
|
||||||
(ARGC=0) 2>/dev/null || {
|
(ARGC=0) 2>/dev/null || { # so ARGC remains read-only for "source"
|
||||||
print -u2 ${0}: must be run as a function or shell script, not sourced
|
print -u2 ${0}: must be run as a function or shell script, not sourced
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
@ -118,21 +118,33 @@ else
|
||||||
unset alt
|
unset alt
|
||||||
fi
|
fi
|
||||||
|
|
||||||
(( $+alt + $+meta == 0 )) && cat <<EOF
|
if (( $+alt + $+meta == 0 ))
|
||||||
|
then
|
||||||
---------
|
print $'\n---------\n'
|
||||||
|
if [[ -o multibyte ]]
|
||||||
|
then cat <<EOF
|
||||||
|
You are using zsh in MULTIBYTE mode to support modern character sets (for
|
||||||
|
languages other than English). To use the Meta or Alt keys, you probably
|
||||||
|
need to revert to single-byte mode with a command such as
|
||||||
|
|
||||||
|
unsetopt MULTIBYTE
|
||||||
|
EOF
|
||||||
|
else cat <<EOF
|
||||||
Your current terminal and keyboard configuration does not appear to use
|
Your current terminal and keyboard configuration does not appear to use
|
||||||
high-order characters. You may be able to enable the Meta or Alt keys
|
high-order characters. You may be able to enable the Meta or Alt keys
|
||||||
with a command such as
|
with a command such as
|
||||||
|
|
||||||
stty pass8
|
stty pass8
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
cat <<EOF
|
||||||
|
|
||||||
If you want to use these extra keys with zsh, try adding the above command
|
If you want to use these extra keys with zsh, try adding the above command
|
||||||
to your ${ZDOTDIR:-$HOME}/.zshrc file.
|
to your ${ZDOTDIR:-$HOME}/.zshrc file.
|
||||||
|
|
||||||
See also "man stty" or the documentation for your terminal or emulator.
|
See also "man stty" or the documentation for your terminal or emulator.
|
||||||
EOF
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
(( $+alt || $+meta )) && cat <<EOF
|
(( $+alt || $+meta )) && cat <<EOF
|
||||||
|
|
||||||
|
|
@ -145,8 +157,12 @@ by adding
|
||||||
bindkey -m
|
bindkey -m
|
||||||
|
|
||||||
to your ${ZDOTDIR:-$HOME}/.zshrc file.
|
to your ${ZDOTDIR:-$HOME}/.zshrc file.
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
read -k 1 key"?Press a key to proceed: "
|
||||||
|
[[ $key != $'\n' ]] && print
|
||||||
|
|
||||||
cat <<\EOF
|
cat <<\EOF
|
||||||
|
|
||||||
---------
|
---------
|
||||||
|
|
@ -165,7 +181,7 @@ use of that key. Press Space to skip to the next key.
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
read -k 1 key"?Press any key when ready to begin: "
|
read -k 1 key"?Press a key when ready to begin: "
|
||||||
[[ $key != $'\n' ]] && print
|
[[ $key != $'\n' ]] && print
|
||||||
|
|
||||||
cat <<\EOF
|
cat <<\EOF
|
||||||
|
|
@ -235,18 +251,19 @@ else
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
command mv $zkbd/$TERM.tmp $zkbd/$TERM-$VENDOR-$OSTYPE
|
local termID=${DISPLAY:-$VENDOR-$OSTYPE}
|
||||||
|
command mv $zkbd/$TERM.tmp $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-$VENDOR-$OSTYPE
|
$zkbd/$TERM-$termID
|
||||||
|
|
||||||
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, like this:
|
||||||
|
|
||||||
source ${zkbd/$HOME/~}/\$TERM-\$VENDOR-\$OSTYPE
|
source ${zkbd/$HOME/~}/\$TERM-\${DISPLAY:-\$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.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue