重复行并注释掉旧行 [英] Duplicate line and comment out old one
问题描述
我经常需要编辑一行,但将旧的注释掉.
是否可以在 Sublime Text 2 中为这些命令创建键绑定?
- 复制当前行
- 注释掉第一行
- 将光标移动到底线
假设为文件类型定义了注释语法,您可以使用一个简单的宏(尽管即使它不是您可以做到的,宏也只是多一点参与).无论如何,将以下内容保存在 Packages/User
中作为您喜欢的任何内容.确保扩展名是 .sublime-macro
.
然后,创建如下所示的键绑定.
{ "keys": ["f12"], "command": "run_macro_file", "args": {"file": "res://Packages/User/<文件名>.崇高宏"} },
当然,根据需要更改 keys
和 <文件名>
.
I often need to edit a line but comment out the old one.
Is it possible to create a key binding for these commands in Sublime Text 2?
- duplicate current line
- comment out the top line
- move the cursor to the bottom line
Assuming the comment syntax is defined for the file type, you can use a simple macro (though even if it's not you could do it, the macro would just be a little more involved). Anyways, save the following in Packages/User
as whatever you like. Be sure the extension is .sublime-macro
though.
[
{
"args":
{
"block": false
},
"command": "toggle_comment"
},
{
"command": "duplicate_line"
},
{
"args":
{
"block": false
},
"command": "toggle_comment"
}
]
Then, create a key binding like the following.
{ "keys": ["f12"], "command": "run_macro_file", "args": {"file": "res://Packages/User/<the file name>.sublime-macro"} },
Of course, change the keys
and <the file name>
as appropriate.
这篇关于重复行并注释掉旧行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!