@Niklas 我解决了这个问题,但没有使用stty。相反,我一直在使用Karabiner-Elements来对终端键进行自定义配置(而不影响其他绑定)。
基本上,你需要安装Karabiner-Elements应用程序,然后在karabiner.json文件中编写一个“复杂修改”规则来交换你想要的内容。这里有一个关于如何配置json配置的指南。
我的karabiner.json大致如下:
{
"name" : "com.apple.Terminal",
"simple_modifications" : {
"left_option" : "left_control",
"left_command" : "left_option",
"right_control" : "right_command",
"right_option" : "right_control",
"right_command" : "right_option",
"left_control" : "left_command"
},
"complex_modifications" : {
"rules" : [
{
"manipulators" : [
{
"to" : [
{
"key_code" : "c",
"modifiers" : [
"left_command"
]
}
],
"type" : "basic",
"from" : {
"key_code" : "c",
"modifiers" : {
"mandatory" : [
"left_control"
],
"optional" : [
"any"
]
}
}
]
},
... more rules for all the stty characters, etc
]
}
}