繁体   English   中英

在Mac上使用XQuartz打开远程服务器上安装的emacs时,将Meta更改为选项键

[英]Change Meta to option key when using XQuartz on mac to open emacs installed on remote server

我的问题是这样的:首先,我使用Mac上的Terminal.app通过ssh -Y登录远程服务器。 然后键入以打开该远程服务器上安装的emacs

emacs

因为我在使用ssh时添加选项-Y,所以emacs在Mac上安装的XQuartz中打开。

此时,问题出现了:选项键不被视为Meta,只有ESC键被视为Meta。 但我想使用选项键作为Meta。

我该如何解决?

请查看http://www.emacswiki.org/emacs/MetaKeyProblems

特别是这一部分。

然后,您可以使用选项/ alt键作为元键从X11窗口(Applications / Utilities / X11.app)运行emacs。 此外,您可以使用xmodmap命令将命令键重新映射到仅在X11下的Control。 这样做的好处是允许命令键与其他Mac应用程序一起预期运行。 xmodmap还可以确保将Alt / Option键设置为emacs中的Meta键。 您可以使用以下〜/ .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

在启动emacs之前(例如,如果您使用xterm的登录shell选项,则来自/ etc / bashrc,即X11中的xterm -ls /终端的Application / Customize)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM