自动评论换行符,SublimeText

时间:2014-05-26 03:33:05

标签: comments sublimetext

当我在评论区内输入新行时,有人能指出如何让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
}

2 个答案:

答案 0 :(得分:8)

DocBlockr包添加了此功能。如果你从'ignored_pa​​ckages'中删除它,那应该修复它!

(nb。我从上面的评论中看到这确实解决了这个问题,但我把它放在这里作为答案,因为很容易错过评论并且花了一些时间来弄清楚这个功能来了来自DocBlockr而不是Sublime Text本身)

答案 1 :(得分:0)

只需输入以下命令:

CTRL + /

单行评论为single line,如果您想使用其他专栏,请使用multi-line评论。

/* */

还原您的偏好

删除用户首选项上的所有代码并将其替换为{},然后按CTRL + S保存。它应该做回复。