博客园  :: 首页  :: 联系 :: 管理

effective emacs中文版[1]

Posted on 2011-07-15 15:39  雪庭  阅读(878)  评论(0)    收藏  举报

Item 1: Swap Caps-Lock and Contro

条款1:把Caps-Lock和Control键互换



On Windows and Mac keyboards, the Ctrl key is awkwardly located in the far lower-left position on the keyboard. The Ctrl key is critical to using Emacs at all times, so you'll never become an Emacs virtuoso unless you move it to an easier position. That position should be on Home Row, so Caps Lock is the best choice. That's the location of the Control key on most Unix workstation
keyboards, for precisely that reason.
在Windows和苹果Mac键盘上,那个Ctrl键居然被远远地放在左下角,而Ctrl对于emacs的使用却是时时刻刻都很重要的,如果你不把Ctrl放到一个更舒服的位置,你就很难成一个emacs艺术大师了。这位置应该与你的基本手位处于同一行,那么,Caps Lock是最佳选择。在很多unix工作站上,这个位置放的就是Ctrl键,原因同上。

 

To do this on Windows 2000 or XP requires some registry hacking. From the Start menu, choose Run and enter "regedit". In the left-side tree view, click down to:

要想在w2000或者XP中实现这个互换,需要修改注册表。从开始菜单中选择“运行”,输入regedit。在左边的树状视图中,找到:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout

 

Click on the KeyboardLayout entry to give it the focus. Make sure it has the focus and not one of its children. Then from the Edit menu, choose New Binary Value, and name it Scancode Map. It should show as type REG_BINARY.

点击 KeyboardLayout 项,使之获得焦点。再从“编辑”菜单中选择新建一个二进制值,命名为 "Scancode Map",它的类型应该显示为 REG_BINARY。

 

Then select the new Scancode Map entry you just created, and from the Edit menu (whose contents should have changed), choose Modify Binary Data. In the dialog box called Edit Binary Value, enter the following data:

然后选择这个新建的"Scancode Map"值项,用“编辑”菜单中选择修改二进制值,在二进制编辑对话框中,输入下列数据:

 000000 00 00 00 00 00 00 00
 
000803 00 00 00 3A 00 1D 00
 
0010: 1D 00 3A 00 00 00 00 00

注:我在使用过程中,发现 Caps Lock与右 Ctrl互换更方便
交换右ctrl与Caps Lock

 000000 00 00 00 00 00 00 00
 
000803 00 00 00 3A 00 1D E0
 
0010: 1D E0 3A 00 00 00 00 00


Select OK to close the dialog, then exit the Registry Editor. The caps and ctrl keys should be swapped as soon as you log out and back in again. It may require a reboot.
选择OK关闭对话框,退出注册表编辑器,注销后重登入,你的caps和ctrl键应该就互换成功了。也可能要重启一次。

 

On Linux in X-Windows, you use the xmodmap utility. Create a file in your home directory called.xmodmap if it doesn't already exist, and put in the following lines:

在linux的X-Window中,可以使用xmodmap工具。在你的主目录新建一个名字为.xmodmap的文件,如果已经存在则
只需修改。向该文件加入下列内容:

 !
 
! Swap Caps_Lock and Control_L
 
!
 remove 
Lock = Caps_Lock
 remove Control 
= Control_L
 keysym Control_L 
= Caps_Lock
 keysym Caps_Lock 
= Control_L
 add 
Lock = Caps_Lock
 add Control 
= Control_L

 Save it, and add the line xmodmap ~/.xmodmap into your ~/.bash_profile.

保存,再向你的 ~/.bash_profile 文件加入一行:xmodmap ~/.xmodmap

 

On Mac OS X (Panther and Jaguar) you need to install a modified keyboard driver, which is a little scary, but it seems to work. Here's a discussion of the driver. Alternately, if you're not using a Mac laptop, there appears to be an XML file you can edit as root; it's described here.This URL has some information on doing it on other systems.
在Mac OS X(Panther或Jaguar)中,你得安装一个修改过的键盘驱动,这说来有些吓人,但是很有效。这儿有个关于驱动的讨论:
http://www.macosxhints.com/article.php?story=20031102032521826

 

如果你用的不是Mac笔记本,好像有一个XML文件可以编辑来实现,可以参考这儿:
http://www.eecs.wsu.edu/%7Eschneidj/mac-os-x-10.3.html#swap
下面的URL有一条关于在其它系统上实现的信息:
http://www.manicai.net/comp/swap-caps-ctrl.html