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 10K
  • Win 7K
  • OS X 2K
  • Linux 2K
May 24 May 23 May 22 May 21 May 20 May 19 May 18 May 17 May 16 May 15 May 14 May 13 May 12 May 11 May 10 May 9 May 8 May 7 May 6 May 5 May 4 May 3 May 2 May 1 Apr 30 Apr 29 Apr 28 Apr 27 Apr 26 Apr 25 Apr 24 Apr 23 Apr 22 Apr 21 Apr 20 Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9
Windows 3 18 17 12 24 27 30 26 17 8 14 14 19 27 21 25 24 14 17 10 18 21 18 6 12 19 23 16 21 30 27 14 9 20 10 21 24 20 15 15 22 10 17 19 16 18
OS X 0 2 3 2 6 3 2 1 2 6 1 3 4 6 2 5 5 1 4 3 2 2 5 1 4 3 1 3 3 3 4 0 3 4 4 2 3 3 0 1 3 3 8 4 4 4
Linux 0 4 6 4 1 2 5 4 8 6 0 0 4 3 4 3 6 4 3 2 4 6 3 2 4 2 2 2 2 4 1 3 1 8 3 6 5 4 4 6 6 4 3 4 4 1

Readme

Source
raw.​githubusercontent.​com

GitHub tag Package Control license

HTML Nest Comments for Sublime Text

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: