问题
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:
- Install PackageResourceViewer
- Open the command palette
- Type
PRV: O
- Select
PackageResourceViewer: Open Resource
- Select
R
- Select
Comments.tmPreferences
- Edit the TM_COMMENT_START value to
#'
as desired - Save the file
- 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