Giter Site home page Giter Site logo

eiskrenkov / magiccomment Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 0.0 14 KB

Fully customizable Sublime Text plugin that automatically inserts configured pragma comments for you

Home Page: https://packagecontrol.io/packages/MagicComment

License: MIT License

Python 100.00%
sublime-text sublime-package sublime-text-plugin sublime-plugin python

magiccomment's Introduction

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

Screen Recording 2022-03-14 at 01 17 57

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 type MagicComment (or just comment) and select MagicComment: 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

Comments

  • text - Text of the comment to insert

    • Type: String
    • Default: true
  • line - Number of the line you wish to insert the comment

    • Type: Integer
    • Default: 1
  • blank_lines - Amount of blank lines to insert after the comment

    • Type: Integer
    • Default: 0
  • files - Object, containing files specific settings

    • Type: Object
  • files -> include - List of file names and extensions to insert comment for

    • Type: Array of String
    • Default: []
  • files -> exclude - List of file names and extensions that you want to ignore

    • Type: Array of String
    • Default: []

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!

magiccomment's People

Contributors

eiskrenkov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

magiccomment's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.