[英]Change Meta to option key when using XQuartz on mac to open emacs installed on remote server
My problem is like this: Firstly, I login into a remote server through ssh -Y using the Terminal.app on Mac. 我的问题是这样的:首先,我使用Mac上的Terminal.app通过ssh -Y登录远程服务器。 Then open the emacs installed on that remote server by typing 然后键入以打开该远程服务器上安装的emacs
emacs
Because of I add the option -Y when using ssh, the emacs is opened in the XQuartz installed on Mac. 因为我在使用ssh时添加选项-Y,所以emacs在Mac上安装的XQuartz中打开。
At this time, the problem comes: the option key is not treated as Meta and only the ESC key is treated as Meta. 此时,问题出现了:选项键不被视为Meta,只有ESC键被视为Meta。 But I want to use the option key as Meta. 但我想使用选项键作为Meta。
How can I solve it? 我该如何解决?
Take a look at http://www.emacswiki.org/emacs/MetaKeyProblems 请查看http://www.emacswiki.org/emacs/MetaKeyProblems
specifically this part. 特别是这一部分。
You can then run emacs from X11 windows (Applications/Utilities/X11.app) with the option/alt key as the meta key. 然后,您可以使用选项/ alt键作为元键从X11窗口(Applications / Utilities / X11.app)运行emacs。 Furthermore, you may use the xmodmap command to remap the command key to Control only under X11. 此外,您可以使用xmodmap命令将命令键重新映射到仅在X11下的Control。 This has the advantage of allowing the command key to behave expectedly with other Mac applications. 这样做的好处是允许命令键与其他Mac应用程序一起预期运行。 xmodmap can also ensure that the Alt/Option key is set to be the Meta key in emacs. xmodmap还可以确保将Alt / Option键设置为emacs中的Meta键。 You can do this with the following ~/.xmodmap file (the lines starting with exclamation points are comments and can be omitted): 您可以使用以下〜/ .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
Use the above file with the command 将以上文件与命令一起使用
xmodmap ~/.xmodmap
before starting emacs (for instance, from /etc/bashrc if you use the login shell option to xterm, ie xterm -ls in X11/Application/Customize for terminal). 在启动emacs之前(例如,如果您使用xterm的登录shell选项,则来自/ etc / bashrc,即X11中的xterm -ls /终端的Application / Customize)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.