Skip to content

Instantly share code, notes, and snippets.

@zenglian
Last active February 18, 2021 14:10
Show Gist options
  • Save zenglian/7eb68685d953463f746572783044f519 to your computer and use it in GitHub Desktop.
Save zenglian/7eb68685d953463f746572783044f519 to your computer and use it in GitHub Desktop.
程序员的键盘布局优化方案与配置

程序员的键盘布局优化

问题

据粗略统计:

  • 对于绝大部分人,"的使用频率大于'
  • 对于开发人员,Esc键的使用频率大于Caps Lock键。
  • 对于Java系/JavaScript系/C系/C#/Go等程序员,{/}的使用频率要明显大于[/]

解决方案

交换以上键3组按键。

配置方法

Linux

Linux的配置比较简单。注意文件名首字母必须大写,否则重启后失效。参考xmodmap

xmodmap -pke > ~/.Xmodmap
cp ~/.Xmodmap ~/.Xmodmap.bak
vim ~/.Xmodmap      			(内容如后)
xmodmap ~/.Xmodmap 			(立即生效,重启有效)

文件内容如下(仅修改部分)


...
keycode  34 = braceleft bracketleft braceleft bracketleft
keycode  35 = braceright bracketright braceright bracketright
...
keycode  48 = quotedbl apostrophe quotedbl apostrophe
...
keycode 254 =
keycode 255 =

! 交换Caps Lock和Esc
! remove Lock = Caps_Lock
! keysym Escape = Caps_Lock
! keysym Caps_Lock = Escape
! add Lock = Caps_Lock
                                                              

Windows

可以使用KeytweakKeyboard Layout Manager设置。需要两个软件同时使用。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment