In Sublime Text 3, how can I change the comment character?

吃可爱长大的小学妹 提交于 2019-12-19 03:59:07

问题


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.

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.

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?


回答1:


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.

To edit the comment markers for 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 #


来源:https://stackoverflow.com/questions/44555213/in-sublime-text-3-how-can-i-change-the-comment-character

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!