Sublime Text 2 的大评论
我想在 Sublime Text 2 中做出这样的评论:
/********************
* This is a comment *
********************/
是否有一种简单的方法可以自动进行这些评论?
另外,我在哪里可以找到有关此类内容的良好文档。我喜欢 Sublime,但我觉得它的文档很少!
I would like to make comments like this in Sublime Text 2:
/********************
* This is a comment *
********************/
Is there an easy way to make those automatically?
Also, where can I find good documentation about such stuff. I love Sublime, but I feel it's poorly documented!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以创建一个片段来执行此操作。
转到
工具
->New Snippet
并打开一个新文件。将其粘贴到其中:将其保存在您的
Packages\User
文件夹中(保存时应自动设置)。现在,您只需输入
bigcom
(如
- 元素中所定义)并点击tab
。注释将出现,并且光标将设置在代码段中设置$0
的位置。另外,您可以在
块内添加一个scope
- 元素,因此此代码片段仅在特定语法范围内工作,例如:Unfurtonately, I不知道当您跳到新行时如何在您正在写入的行的两侧自动添加
*
字符,所以我不知道这是否符合您的需求。您必须手动添加这些。我仍然希望这能在某种程度上有所帮助。编辑:
在 stackoverflow 上的另一个问题中找到了一些相关内容。看看这个答案。执行此操作时,至少会添加新行开头的
*
字符。我会看看是否可以让它在行尾添加字符。当谈到文档时,我同意,实际上并没有太多。当然有官方文档: Sublime Doc 当然论坛: Sublime Forum (从某种程度上来说,这是一个很好的资源,但不是喜欢填写得很差的医生)。另一方面,我总是建议阅读 net.tutsplus,这是一个很好的起点。
在浏览
全局设置
和按键绑定
文件时,我几乎偶然发现了标准安装中最有趣的部分,您可以通过打开它们首选项
- 菜单You could create a snippet for doing this.
Go to
Tools
->New Snippet
and a new file is opened. Paste this in it:Save this in your
Packages\User
-Folder (which should be set automatically when saving).Now you can just type
bigcom
(as defined in the<tabTrigger>
- element) and hittab
. The comment will appear and the cursor is set at the position, where$0
is set in the snippet.Additionaly, you could add a
scope
- element inside the<snippet>
-block, so this snippet will only work in a specific syntax scope, for example:Unfurtonately, I don't know how you could add the
*
-character on both sides of the line you are writing in automatically, when you jump into a new line, so I don't know if this fits your needs. You would have to add those manually. Still I hope this helps in some way.Edit:
Found something for this in another question on stackoverflow. Have a look at this answer. When doing this, at least the
*
character on the beginning of the new line is added. I'll have a look if I can get it to add the character at the end of the line too.When it comes to the documentation, I agree, there's not really a lot out there. Of course there is the official documentation: Sublime Doc and of course the forum: Sublime Forum (which is a good resource to some point, not like the poorly filled Doc). On the other hand I always recommend reading the post on net.tutsplus, which is a nice starting point.
I pretty much stumbled over the most interesting parts that come with the standard installation while browsing trough the
Global Settings
andKey Bindings
-Files, which you can open over thePreferences
- Menu警告,自插。
DocBlockr 插件可以自动“装饰”一个为你评论。目前它仅适用于内联注释,但它可以完成工作。快捷键是 Ctrl+Enter
成为
并且它也适用于连续注释:
成为
Warning, self plug.
The DocBlockr plugin can automatically 'decorate' a comment for you. Right now it only works on inline comments, but it gets the job done. The shortcut key is Ctrl+Enter
Becomes
And it works on consecutive comments too:
Becomes
您也可以尝试使用 DocBlockr 插件
You could also try using the DocBlockr plugin
使用这个方便的 sublime 插件 https://packagecontrol.io/packages/Comment-Snippets
Use this handy sublime plugin https://packagecontrol.io/packages/Comment-Snippets