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 75
  • Win 60
  • Mac 10
  • Linux 5
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 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28
Windows 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
Mac 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 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 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.