在 Sublime Text 3 中,如何更改注释字符? [英] In Sublime Text 3, how can I change the comment character?

查看:76
本文介绍了在 Sublime Text 3 中,如何更改注释字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢自动评论功能 Ctrl +/,但我希望能够任意更改它使用的字符.我读过很多类似的问题,比如这个,但这并不是一个通用的解决方案.

I like the auto-comment feature Ctrl + /, but I'd like to be able the change the character it uses arbitrarily. I have read many similar questions like this one, but it's not exactly a generic solution.

如何让评论字符使用不同的东西?具体用例是我正在编写 R 代码并使用 Roxygen2 作为文档.这使用 #' 作为注释字符,而不仅仅是 #.所以我想将 sublime 设置为使用 #' 因为按原样,我不能将它用于 Roxygen2 注释.

How can I make the comment character use something different? The specific use case is that I'm writing R code and using Roxygen2 for documentation. This uses #' as the comment character, instead of just #. So I I'd like to set sublime to use #' because as is, I can't use it for Roxygen2 comments.

关于 Sublime2 的问题,例如这个,请参阅.tmPreferences"文件,但我在我的 Sublime 3 安装中找不到任何此类文件.如果答案仍然是这些文件,那么它们在 Sublime 3 中存储在哪里?

Questions regarding Sublime2, like this one, refer to '.tmPreferences' files, but I have not been able to find any such files in my Sublime 3 installation. If the answer is still these files, where are they stored in Sublime 3?

推荐答案

在 Sublime Text 中为自定义语法启用自动注释.tmPreferences 文件用于指定语法的注释标记.

As mentioned in Enable automatic commenting in Sublime Text for a custom syntax, .tmPreferences files are used to specify what the comment markers are for a syntax.

要编辑 R 的注释标记:

To edit the comment markers for R:

  1. 安装PackageResourceViewer
  2. 打开命令面板
  3. 输入PRV:O
  4. 选择PackageResourceViewer:打开资源
  5. 选择R
  6. 选择Comments.tmPreferences
  7. 编辑 TM_COMMENT_START 值/a> 到 #' 根据需要
  8. 保存文件
  9. 在 R 文件上使用切换注释功能,并看到它现在使用 #' 而不是 #
  1. Install PackageResourceViewer
  2. Open the command palette
  3. Type PRV: O
  4. Select PackageResourceViewer: Open Resource
  5. Select R
  6. Select Comments.tmPreferences
  7. Edit the TM_COMMENT_START value to #' as desired
  8. Save the file
  9. Use the toggle comment functionality on an R file and see that it now uses #' instead of #

这篇关于在 Sublime Text 3 中,如何更改注释字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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