我的问题是这样的:首先,我在Mac上使用Terminal.app通过ssh -Y登录到远程服务器。然后输入以下命令打开安装在该远程服务器上的emacs
emacs因为我在使用ssh时添加了选项-Y,所以emacs是在Mac上安装的XQuartz中打开的。
此时,问题来了: option键不被视为Meta,只有ESC键被视为Meta。但我想使用option键作为Meta。
我该怎么解决它呢?
发布于 2013-01-17 20:58:58
看一看http://www.emacswiki.org/emacs/MetaKeyProblems
特别是这一部分。
然后,您可以从X11窗口(应用程序/实用程序/X11.app)运行emacs,并使用选项/ALT键作为元键。此外,您可以使用xmodmap命令将命令键重映射到X11下的Control only。这具有允许命令键在其他Mac应用程序中正常运行的优点。xmodmap还可以确保Alt/Option键被设置为emacs中的元键。您可以使用以下~/.xmodmap文件执行此操作(以惊叹号开头的行是注释,可以省略):
! undo any meta keys already set
clear Mod1
! keycodes 63 and 71 are the left and right COMMAND buttons adjacent to the spacebar; set them to be control keys
keycode 63=Control_L
keycode 71=Control_R
! keycodes 66 and 69 are the option/alt keys; assign them as Meta keys
keycode 66=Meta_L
keycode 69=Meta_R
! now tell X11 that the Meta keys act as the Mod1 (meta) modier key; that is, when they are pressed with KEY, it is the same as hitting M-KEY
add Mod1 = Meta_L Meta_R
! tell X11 that the Control keys are Control modifiers, so when pressed with u (for example) it is the same as hitting C-u
add Control = Control_L Control_R将上述文件与以下命令一起使用
xmodmap ~/.xmodmap在启动-ls之前(例如,在/etc/bashrc中,如果使用xterm的登录shell选项,即X11/Application/Customize for terminal中的xterm emacs )。
https://stackoverflow.com/questions/14379566
复制相似问题