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
cd <Packages directory>(macOS:~/Library/Application\ Support/Sublime\ Text/Packages)git clone https://github.com/eiskrenkov/MagicComment.git
- On file save (enabled by default, can be disabled in settings)
- Key Bindings - Default binging is
CMD+CTRL+C(can be reconfigured) - Command Palette -
CMD+Pand typeMagicComment(or justcomment) and selectMagicComment: Insert Comments
Remember, that you can always reconfigure it, just open Sublime Text menu -> Preferences -> Package Settings -> MagicComment -> Settings
run_on_save- Type:
Boolean - Default:
true
- Type:
-
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:
ArrayofString - Default:
[]
- Type:
-
files->exclude- List of file names and extensions that you want to ignore- Type:
ArrayofString - 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
{
"text": "# frozen_string_literal: true",
"line": 1,
"blank_lines": 1,
"files": {
"include": ["*.rb", "Gemfile", "Rakefile", "config.ru"],
"exclude": ["schema.rb"]
}
}Issues and pull requests are highly welcome!
