MagicComment
Fully customizable Sublime Text plugin that automatically inserts configured pragma comments for you
Details
Installs
- Total 217
- Win 128
- Mac 46
- Linux 43
Feb 22 | Feb 21 | Feb 20 | Feb 19 | Feb 18 | Feb 17 | Feb 16 | Feb 15 | Feb 14 | Feb 13 | Feb 12 | Feb 11 | Feb 10 | Feb 9 | Feb 8 | Feb 7 | Feb 6 | Feb 5 | Feb 4 | Feb 3 | Feb 2 | Feb 1 | Jan 31 | Jan 30 | Jan 29 | Jan 28 | 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 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
Mac | 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 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Linux | 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 | 1 | 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!