首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在mac上使用XQuartz打开安装在远程服务器上的emacs时,将Meta更改为option键

问在mac上使用XQuartz打开安装在远程服务器上的emacs时,将Meta更改为option键
EN

Stack Overflow用户
提问于 2013-01-17 20:52:07
回答 1查看 5K关注 0票数 9

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

代码语言:javascript
复制
emacs

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

此时,问题来了: option键不被视为Meta,只有ESC键被视为Meta。但我想使用option键作为Meta。

我该怎么解决它呢?

EN

回答 1

Stack Overflow用户

发布于 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文件执行此操作(以惊叹号开头的行是注释,可以省略):

代码语言:javascript
复制
! 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

将上述文件与以下命令一起使用

代码语言:javascript
复制
xmodmap ~/.xmodmap

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

票数 7
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14379566

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档