ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

HTML Nest Comments

by philsinatra ST2/ST3

This is a Sublime Text 2 and 3 plugin allowing you to quickly comment out blocks of HTML code that already contain HTML comments.

Details

Installs

  • Total 8K
  • Win 5K
  • OS X 2K
  • Linux 1K
Feb 26 Feb 25 Feb 24 Feb 23 Feb 22 Feb 21 Feb 20 Feb 19 Feb 18 Feb 17 Feb 16 Feb 15 Feb 14 Feb 13 Feb 12 Feb 11 Feb 10 Feb 9 Feb 8 Feb 7 Feb 6 Feb 5 Feb 4 Feb 3 Feb 2 Feb 1 Jan 31 Jan 30 Jan 29 Jan 28 Jan 27 Jan 26 Jan 25 Jan 24 Jan 23 Jan 22 Jan 21 Jan 20 Jan 19 Jan 18 Jan 17 Jan 16 Jan 15 Jan 14 Jan 13 Jan 12
Windows 5 11 11 25 11 15 14 10 9 12 13 20 18 12 8 9 14 19 18 16 24 8 9 19 12 16 16 14 9 11 13 15 28 15 18 15 9 9 18 12 12 12 8 15 14 21
OS X 0 2 5 6 5 7 4 4 1 1 3 4 5 6 3 2 4 5 2 0 3 0 0 2 4 2 4 6 2 1 3 7 2 6 5 6 4 4 4 0 2 1 2 0 5 1
Linux 1 4 3 7 4 2 3 6 5 9 3 3 4 6 4 3 4 1 3 1 3 3 5 0 1 3 2 5 6 3 3 8 1 4 9 6 0 5 2 2 1 2 3 5 3 3

Readme

Source
raw.​githubusercontent.​com

HTML Nest Comments for Sublime Text

Sublime Text 3

About

This is a Sublime Text 2 and 3 plugin allowing you to quickly comment out blocks of HTML code that already contain HTML comments.

example image

Installation

The easy way is:

Through Sublime Package Manager

  • Ctrl+Shift+P or Cmd+Shift+P in Linux/Windows/OS X
  • type install, select Package Control: Install Package
  • type htmlnest, select HTML-Nest-Comments

Manually

Make sure you use the right Sublime Text folder. For example, on OS X, packages for version 2 are in ~/Library/Application\ Support/Sublime\ Text\ 2, while version 3 is labeled ~/Library/Application\ Support/Sublime\ Text\ 3.

These are for Sublime Text 3:

Mac

git clone https://github.com/philsinatra/HTML-Nested-Comments.git ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/HTML-Nest-Comments

Linux

git clone https://github.com/philsinatra/HTML-Nested-Comments.git ~/.config/sublime-text-3/Packages/HTML-Nest-Comments

Windows

git clone https://github.com/philsinatra/HTML-Nested-Comments.git %APPDATA%/Sublime\ Text\ 3/Packages/HTML-Nest-Comments

Usage

Tools -> Command Palette (Ctrl+Shift+P or Cmd+Shift+P) and type nested.

– or –

Ctrl+Shift+/ (or Cmd+Shift+/ if you're on a Mac).

– or –

Right click in the current buffer and select HTML Nest Comments -> Comment/Uncomment Selection.

– or –

Open an HTML file, pop out the console in Sublime Text from View -> Show Console, and type view.run_command("nest").

Writing commands in the console is ugly. Set up your own key combo for this, by going to Preferences -> Key Bindings - User, and adding a command in that array: { "keys": ["super+shift+/"], "command": "nest" }. You can use any other command you want, thought most of them are already taken.

What Happens

The built in comment function in Sublime Text runs into an issue if your HTML code contains comments that you want to maintain while block commenting larger areas of code. This plugin will temporarily disable the nested comments so that you can bulk comment out blocks of HTML that already contain comments.

<div class="container">
  <div class="main">
    <div class="content"></div>

    <aside></aside>
  </div>

</div>

Each of the existing comment tags will be replaced with <!~~ or ~~> respectively when commenting, and then the effect will be reversed when uncommenting.

Run the nest command and the code is transformed into: