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

Comments Aware Enter

by Suor ALL

Smart Enter in line comments in Sublime Text 2/3

Details

  • 2019.04.17.14.16.46
  • github.​com
  • github.​com
  • 10 months ago
  • 2 hours ago
  • 7 years ago

Installs

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

Readme

Source
raw.​githubusercontent.​com

Comments Aware Enter and Join Lines for Sublime Text 2/3

Hitting Enter in line comments will insert a proper indented comment marker for you. In its turn Ctrl+J (Cmd+J on OS X) joins comment lines removing comment markers and extraneous whitespace.

This plugin is for line comments only, so it doesn't work with block ones.

Thats cool, but can I use smth + Enter instead?

Sure, just add one of the following lines to your User Preferences:

{
    ...
    "linecomments_ctrl_enter": true,
    "linecomments_alt_enter": true,
    "linecomments_shift_enter": true,
    "linecomments_super_enter": true, // Stands for Cmd on Mac OS X
    ...
}

If any one of this options is used then plain Enter won't be captured, modified shortcut will be.

Labels and bullets

CommentAwareEnter will automatically create “-” bullet for you and autoindent after labels:

# TODO: Some thing,
#       other thing indented.
#           - nicely
#           - formatted list

To switch off label indent say this in your settings:

{
    ...
    "linecomments_label_indent": false,
    ...
}