Sunday, October 13, 2013

在Sublime Text 3 中使用emacs键位

我的目标很简单: 就是把sublime text的操作折腾的和emacs 一样

第一步, 安装sublemacspro.


参见这里: https://github.com/grundprinzip/sublemacspro
基本上最基本的emacs操作比如ctrl-w, alt-w, ctrl-k, ctrl-y 等就有了.

第二步, 增加一些我自己管用的keybinding

我是通过定制PreferencesKey->Binding->User来增加以下我自己习惯的键位:
[
 { "keys": ["ctrl+f"], "command": "move", "args": {"by": "pages", "forward": true} },
 { "keys": ["ctrl+b"], "command": "move", "args": {"by": "pages", "forward": false} },
 { "keys": ["shift+ctrl+f"], "command": "move", "args": {"by": "pages", "forward": true, "extend": true} },
 { "keys": ["shift+ctrl+b"], "command": "move", "args": {"by": "pages", "forward": false, "extend": true} },

 { "keys": ["alt+down"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": true} },
 { "keys": ["alt+up"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": false} },
 { "keys": ["shift+alt+down"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": true, "extend": true} },
 { "keys": ["shift+alt+up"], "command": "move", "args": {"by": "stops", "empty_line": true, "forward": false, "extend": true} },

 { "keys": ["ctrl+c", "ctrl+c"], "command": "build"},
]

参考:

关于key binding 的commands
http://www.sublimetext.com/docs/commands
如何写一个plugin
http://sublimetext.info/docs/en/extensibility/plugins.html
st3的api
http://www.sublimetext.com/docs/3/api_reference.html

No comments: