创建“重复最后一个宏".崇高文本老式模式下的键盘绑定 [英] Creating a "Repeat last macro" keybinding in sublime text vintage mode

查看:89
本文介绍了创建“重复最后一个宏".崇高文本老式模式下的键盘绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此刻,我正在尝试升华文字.大部分都很好,但是有一个很大的功能我无法弄清楚如何在崇高的文本中实现.在vim中,必须有空间来重复我执行的最后一个宏.但是,我找不到在崇高的文字中实现它的好方法.

At the moment, I am trying out sublime text. Most of it is fine, but there is one big feature that I can't figure out how to implement in sublime text. In vim, have have space bound to repeat the last macro that I performed. However, I can't find a good way to implement it in sublime text.

为了了解更多信息,我研究了老式包装中的宏键绑定:

In an effort to learn more, I looked at the macro key bindings in the vintage package:

{ "keys": ["q"], "command": "vi_end_record_macro",
    "context": [{"key": "setting.command_mode"}, {"key": "is_recording_macro"}]
},

{ "keys": ["@", "<character>"], "command": "vi_replay_macro",
    "context": [{"key": "setting.command_mode"}]
},

(我认为)是实际插件中的相关类:

And (what I think) is the relevant class in the actual plugin:

class ViReplayMacro(sublime_plugin.TextCommand):
    def run(self, edit, character):

我无法弄清楚的是如何记住上一个命令是什么,否则,只有空格调用记录在'q'上的vi宏了.这意味着我需要将vi_replay_macro(q)绑定到空格,但是我不了解键绑定如何将要重播的字符传递给命令.

What I am unable to figure out is how to remember what the last command was, and failing that just have space call the vi macro recorded on 'q'. This means I need to bind vi_replay_macro(q) to space, but I don't understand how the key binding passes which character to replay to the command.

我创建了一个插件.

推荐答案

您可能必须编写自己的插件才能运行上一个宏.您可以尝试使用command_history方法,然后向后搜索,直到找到vi_replay_macrorun_macro命令.我只是根据我对ST的了解进行猜测,因此可能还有其他方法可以解决这个问题.

You would probably have to write your own plugin to run the last macro run. You can try using the command_history method, then search backwards till you find a vi_replay_macro or run_macro command. I'm just making a guess though based on what I know about ST, so there could be other ways to go about it.

这篇关于创建“重复最后一个宏".崇高文本老式模式下的键盘绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆