有人可以指出我如何在注释块内输入新行时让 SublimeText 插入注释延续双斜杠吗?

// I have comments like this, and when I enter a '\n'
// it break's out of comment-entering mode
like this (drops slashes, cursor stays at leftmost column)

// and I want to have them automatically inserted after hiting '\n'
// like this

我可能在调整首选项文件时意外更改了它,但我不知道如何将其设置回来。

这是我的用户 prefs :
{
"animation_enabled": false,
"auto_complete_commit_on_tab": true,
"auto_complete_delay": 200,
"auto_complete_size_limit": 2097152,
"auto_complete_triggers":
[
    {
        "characters": "<",
        "selector": "text.html"
    },
    {
        "characters": ".",
        "selector": "source.python"
    },
    {
        "characters": ".",
        "selector": "source.javascript"
    }
],
"bold_folder_labels": true,
"caret_extra_bottom": 1,
"caret_extra_top": 1,
"caret_extra_width": 0,
"caret_style": "solid",
"color_scheme": "Packages/User/base16-compact.dark (SL).tmTheme",
"copy_with_empty_selection": false,
"default_line_ending": "unix",
"drag_text": false,
"draw_white_space": "none",
"fade_fold_buttons": false,
"font_face": "Inconsolata",
"font_size": 10,
"highlight_modified_tabs": true,
"ignored_packages":
[
    "Vintage",
    "Diff",
    "DocBlockr",
    "Markdown",
    "Shell Command"
],
"indent_guide_options":
[
    "draw_normal"
],
"line_padding_bottom": 1,
"line_padding_top": 1,
"logging_level": "error",
"margin": 0,
"match_brackets_content": false,
"remember_open_files": false,
"scroll_past_end": true,
"scroll_speed": 0,
"shift_tab_unindent": true,
"show_encoding": true,
"show_line_endings": true,
"soda_classic_tabs": true,
"spell_check": false,
"tab_size": 2,
"theme": "Soda Dark.sublime-theme",
"translate_tabs_to_spaces": true,
"tree_animation_enabled": false,
"trim_automatic_white_space": false,
"use_tab_stops": true
}

最佳答案

只需键入以下命令:

CTRL + /

单行注释是 single line ,如果您想使用另一行,请使用 multi-line 注释。
/* */

恢复 您的 偏好 :

删除用户首选项中的所有代码并将其替换为 {},然后按 CTRL+S 进行保存。它应该进行还原。

关于comments - 自动评论换行符,SublimeText,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23862318/

10-13 09:05