Sublime Text:如何制作插入文本的快捷方式? [英] Sublime Text: how to make shortcut for inserting text?

查看:133
本文介绍了Sublime Text:如何制作插入文本的快捷方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个快捷方式,将在光标处添加某些文本,例如{sometext},该怎么做?

I need make a shortcut that will be adding certain text at the cursor, eg {sometext}, how can this be done?

推荐答案

在Sublime的首选项下选择键绑定-用户项目,然后添加以下示例行: /p>

Select the Key Bindings - User item under Sublime's Preferences, then add the following example line:

{"keys": ["ctrl+shift+c"], "command": "insert_snippet", "args": {"contents": "hello!"}}

这将添加 CTRL + SHIFT + C 快捷方式以插入 hello!代码段.

This will add a CTRL+SHIFT+C shortcut to insert the hello! snippet.

顺便说一句,不要忘了在前一个键绑定哈希中添加逗号,以便除最后一行以外的所有行都以逗号结尾.即:

By the way, don't forget to add a comma to the previous key binding hash so that all but the last line end with a comma. i.e.:

[
    {"keys": ["..."], "command": "..." },
    {"keys": ["..."], "command": "..." },
    {"keys": ["..."], "command": "..." },
    {"keys": ["ctrl+shift+c"], "command": "insert_snippet", "args": {"contents": "hi!"}}
]

这篇关于Sublime Text:如何制作插入文本的快捷方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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