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

Expand​Selection​To​Comments

by timfjord ST3

Sublime Text package that expands the current selection to fully enclose the intersecting comment block

Details

Installs

  • Total 73
  • Win 58
  • Mac 10
  • Linux 5
Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12 Mar 11 Mar 10 Mar 9 Mar 8 Mar 7 Mar 6
Windows 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0
Mac 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

Stand With Ukraine

Expand Selection to Comments

Demo

Expands the current selection to fully enclose the intersecting comment block

  • works with multiple cursors
  • supports soft undo
  • supports comments divided with empty lines
  • works with any language that has syntax highlighting

Installation

  1. Install the Sublime Text Package Control package if it is not yet installed.
  2. Open the command palette and start typing Package Control: Install Package.
  3. Enter ExpandSelectionToComments.

Usage

The package exposes a single command: expand_selection_to_comments.
It can be bound to a key combination or invoked from the command palette.

{ "keys": ["ctrl+shift+/"], "command": "expand_selection_to_comments" }

The command also accepts an optional direction argument that can be used to change the direction of the selection:

  • up from the current position to the beginning of the comment block
  • down from the current position to the end of the comment block.
{ "keys": ["ctrl+shift+alt+/"], "command": "expand_selection_to_comments", "args": { "direction": "down" } },
{ "keys": ["ctrl+shift+super+/"], "command": "expand_selection_to_comments", "args": { "direction": "up" } },

Implementation details

The command relies on the syntax highlighting information provided by Sublime Text which means that it can be used with any language that has syntax highlighting.