Solaris Home/End 键不像 Debian/Ubuntu 那样工作

twe*_*sat 4 solaris

我正在使用腻子连接到solaris 系统。

我只是一个用户(没有 root 访问权限)。我所知道的关于系统的所有信息是

Oracle Corporation SunOS 5.11 11.1 2014 年 1 月

我的问题来自键盘设置。按键insert/home/pageup/pagedown/end/delete全部显示,~而不是像在 Ubuntu 中那样移动光标。

我已经尝试了很多在互联网上找到的技巧,但没有任何效果。

echo $TERMgivexterm和 putty 用 xterm 配置得很好。

我不知道该怎么办。

gee*_*eya 7

要支持替代键映射,您可以使用 GNU readline 库的inputrcinit 文件。

每个用户都可以.inputrc在其主目录中拥有自己的文件。或者使用 global/etc/inputrc为所有用户设置它。


要检查当前键映射,请输入逐字模式 ( Ctrl-v),然后输入要映射的键。这将阻止shell解析和执行密钥并提供密钥序列。

例如

Ctrl-v Home
^[[1~
Run Code Online (Sandbox Code Playgroud)

^[序列相当于[Esc]关键,所以需要被映射为e\

要测试新地图,请使用以下bind命令:

bind '"\e[1~": beginning-of-line'
Run Code Online (Sandbox Code Playgroud)

一旦成功,您可以将bind命令添加到您的 shell 配置文件或将所有映射添加到您的.inputrc文件。


对于基于Debian / Ubunutu的键映射,请将以下内容添加到您的个人~/.inputrc文件中:

# for linux console and RH/Debian xterm
set meta-flag on
set input-meta on
set convert-meta off
set output-meta on
"\e[1~": beginning-of-line
"\e[4~": end-of-line
# commented out keymappings for pgup/pgdown to reach begin/end of history
#"\e[5~": beginning-of-history
#"\e[6~": end-of-history
"\e[5~": history-search-backward
"\e[6~": history-search-forward
"\e[3~": delete-char
"\e[2~": quoted-insert
"\e[5C": forward-word
"\e[5D": backward-word
"\e[1;5C": forward-word
"\e[1;5D": backward-word
Run Code Online (Sandbox Code Playgroud)

然后再次登录或启动一个新的shell。