Search code examples
keyboard-shortcutssublimetext

Shortcut to comment out a block of code with sublime text


I want to comment out a block of code in sublime text.

I see it in RailsCasts, but don't think he uses sublime text ... to do the following ...

if (uncommented)
  some uncommented example
  # if (commented) 
  #   some commented example code
  # end
end

Is there a shortcut in sublime text that I can use to insert the block of #'s?


Solution

  • The shortcut to comment out or uncomment the selected text or current line:

    • Windows: Ctrl+/
    • Mac: Command ⌘+/
    • Linux: Ctrl+Shift+/

    Alternatively, use the menu: Edit > Comment

    For the block comment you may want to use:

    • Windows: Ctrl+Shift+/
    • Mac: Command ⌘+Option/Alt+/