改变linux下的键映射

时间:2013-11-04 09:31:46

标签: linux keymapping

目标

让我的系统键映射以类似于vim的方式工作;

I want the cursor move down  when pressing  windowsKey + j

I want the cursor move up    when pressing  windowsKey + k

I want the cursor move right when pressing  windowsKey + l

I want the cursor move left  when pressing  windowsKey + h

解决方案

Using xmodmap tool

结果

Failed.

我将在此向您提供一些信息:

我尝试在shell

下使用此命令更改键映射

xmodmap -e "keycode 44 = 1 2 3 4 5 6 7 8"

此命令成功,j和J映射到1和2

但这还不够,windowsKey + j根本没有改变。

当按下WindowsKey + j时,它给了我一个7的内容

这不是我想要的

具体细节:

操作系统:带有gnome 2.28.2的Centos 6.4(64位)

xmodmap -pm

的输出
shift       Shift_L (0x32),  Shift_R (0x3e)

lock        Caps_Lock (0x42)

control     Control_L (0x25),  Control_R (0x69)

mod1        Alt_L (0x40),  Alt_R (0x6c),  Meta_L (0xcd)

mod2        Num_Lock (0x4d)

mod3      

mod4        Super_L (0x85),  Super_R (0x86),  Super_L (0xce),  Hyper_L (0xcf)

mod5        ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)

问题

如果有其他方法可以更改键映射,或者您可以告诉我我错在哪里

请告诉我

1 个答案:

答案 0 :(得分:1)

键盘事件的反应特定于任何程序解释它们。

如果您正在寻找一种方法来使命令行编辑像vi一样工作,那么您可能会使用set -o vi至少使用Bourne Again Shell,然后将Windows键映射到使用xmodmap -e 'keycode 133 = Escape' -e 'keycode 134 = Escape'转义(为了进入vi编辑模式)。

对于其他程序,还有其他方法可以使这项工作,但光标在v

中移动