作者:融水公子 rsgz.top 有些动作太重复,需要在sublime上定制快捷键 1 按住快捷键?Ctrl+~? 打开窗口 输入命令
sublime.log_commands(True)
 2 能显示你每步的操作
command: move_to {"extend": false, "to": "bol"}
command: move_to {"extend": true, "to": "eol"}
command: copy
command: move {"by": "lines", "forward": true}
command: move_to {"extend": false, "to": "eol"}
command: insert {"characters": "\n"}
command: paste
command: insert {"characters": "\n"}
command: insert {"characters": "\n"}
3 进入这个路径新建py文件
C:\Users\Administrator\AppData\Roaming\Sublime Text\Packages\User

我就新建了一个duobuzhou.py文件 4 点击这个设置快捷键

{"keys":["ctrl+d"], "command": "myrun"}
这里的myrun就是类名的小写
嗯嗯 如果你上面没有奏效的话 别着急 上面实验的内容我也失败了? 我少了一个save命令?
没事换个形式 你也可以直接这么编辑Python文件
import sublime
import sublime_plugin
class MyrunCommand(sublime_plugin.WindowCommand): # 这里的类名必须以Command结尾,前面的可以随意改
def run(self, reverse=False):
# true="true"
# false="false"
window = self.window
window.run_command('move_to', {"extend": False, "to": "bol"})
window.run_command('move_to', {"extend": True, "to": "eol"})
window.run_command('copy')
window.run_command('move', {"by": "lines", "forward": True})
window.run_command('move_to', {"extend": False, "to": "eol"})
window.run_command('move', {"by": "lines", "forward": False})
window.run_command('insert', {"characters": "\n"})
window.run_command('paste')
window.run_command('move', {"by": "lines", "forward": False})
window.run_command('insert', {"characters": "\n"})
#window.run_command('insert', {"characters": "\n"})
这段代码运行起来是成功的哈哈哈哈 ===
|