Keyboard shortcut to comment lines in Sublime Text 3

后端 未结 26 2540
深忆病人
深忆病人 2020-12-02 04:42

In Sublime Text 2 it was possible to comment out a line or a block of lines with Ctrl+/ and Ctrl+Shift+/. According t

相关标签:
26条回答
  • 2020-12-02 05:05

    i am ubuntu 18 with sublime text 3.2

    CTR + /

    0 讨论(0)
  • 2020-12-02 05:06

    This is a keyboard internationalisation issue.

    On a standard US QWERTY keyboard, as used in Australia where Sublime Text is made, / is readily available: US QWERTY keyboard

    This is not the case with many other keyboards. Take for example the German QWERTZ keyboard. One needs to hit SHIFT+7 to get a /. This is why commenting does not work properly on these keyboards. German QWERTZ keyboard

    Changing the user keybindings to those listed below, will work for the German QWERTZ keyboard.

    { "keys": ["ctrl+7"], "command": "toggle_comment", "args": { "block": false } },
    { "keys": ["ctrl+shift+7"], "command": "toggle_comment", "args": { "block": true } }
    

    If the problems are occurring with still a different keyboard layout, change the keybindings accordingly.

    0 讨论(0)
  • 2020-12-02 05:06

    U can fix this bug by:

    [
       { "keys": ["ctrl+keypad_divide"], "command": "toggle_comment", "args": { "block": false } },
       { "keys": ["ctrl+shift+keypad_divide"], "command": "toggle_comment", "args": { "block": true } },
    ]
    

    it allow to comment with CTRL+/ and CTRL+SHIFT+/ and u can use / on keypad =)

    0 讨论(0)
  • 2020-12-02 05:07

    Had the same issue. Check with sublime.log_input(True) command on the console to see what keys are being detected with the CTRL+/ and SHIFT+CTRL+/ shorcuts. Then replace the shortcuts with those. (Changing / for keypad_divide worked for me)

    0 讨论(0)
  • 2020-12-02 05:07

    On windows, use Ctrl + Shift + ?. You will be able to comment the HTML.

    0 讨论(0)
  • 2020-12-02 05:08

    I prefer pressing Ctrl + / to (un)comment the current line. Plus, I want the cursor to move down one line, thus this way I can (un)comment several lines easily. If you install the "Chain of Command" plugin, you can combine these two operations:

    [
        { 
            "keys": ["ctrl+keypad_divide"], 
            "command": "chain",
            "args": {
                "commands": [
                    ["toggle_comment", { "block": false }],
                    ["move", {"by": "lines", "forward": true}]
                ]
            }
        }
    ]
    
    0 讨论(0)
提交回复
热议问题