MagicComment
Fully customizable Sublime Text plugin that automatically inserts configured pragma comments for you
Details
Installs
- Total 227
- Win 133
- Mac 50
- Linux 44
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 | Mar 27 | Mar 26 | Mar 25 | Mar 24 | Mar 23 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 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 | 1 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
MagicComment ✨ for Sublime Text
MagicComment is a fully customizable Sublime Text plugin that automatically inserts required magic comments for you
Development is motivated by frozen_string_literal
comment for Ruby files, but plugin can be used for literally any kind of files and any strings that you want to automatically insert
Manual usage Demo
Installation
Package Control
MagicComment is available at Package Control. Just select Package Control: Install Package
in Sublime command palette and search for MagicComment
Manual Installation
cd <Packages directory>
(macOS:~/Library/Application\ Support/Sublime\ Text/Packages
)git clone https://github.com/eiskrenkov/MagicComment.git
Usage
- On file save - Enabled by default, can be disabled in settings
- Key Bindings - Commented by default, can be configured to anything you want
- Command Palette -
CMD+P
and typeMagicComment
(or justcomment
) and selectMagicComment: Insert Comments
You can always configure key bindings at Sublime Text menu -> Preferences -> Package Settings -> MagicComment -> Key Bindings
Default Configuration
Remember, that you can always reconfigure it, just open Sublime Text menu -> Preferences -> Package Settings -> MagicComment -> Settings
General
run_on_save
- Type:
Boolean
- Default:
true
- Type:
Comments
text
- Text of the comment to insert- Type:
String
- Default:
true
- Type:
line
- Number of the line you wish to insert the comment- Type:
Integer
- Default:
1
- Type:
blank_lines
- Amount of blank lines to insert after the comment- Type:
Integer
- Default:
0
- Type:
files
- Object, containing files specific settings- Type:
Object
- Type:
files
->include
- List of file names and extensions to insert comment for- Type:
Array
ofString
- Default:
[]
- Type:
files
->exclude
- List of file names and extensions that you want to ignore- Type:
Array
ofString
- Default:
[]
- Type:
Note, that Include and Exclude arrays support wildcards for file extensions via '*'. E.g *.rb mathes all Ruby files, *.py - all Python files and so on
Example configuration for #frozen_string_literal: true
for .rb
files
{
"text": "# frozen_string_literal: true",
"line": 1,
"blank_lines": 1,
"files": {
"include": ["*.rb", "Gemfile", "Rakefile", "config.ru"],
"exclude": ["schema.rb"]
}
}
Contribution
Issues and pull requests are highly welcome!