簡體   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