Reputation: 18710
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?
Upvotes: 0
Views: 113
Reputation: 19744
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.
Upvotes: 2