Code Monkey home page Code Monkey logo

ttscoff / sublime-bunch Goto Github PK

View Code? Open in Web Editor NEW
10.0 4.0 1.0 38 KB

Bunch is a Mac automation app that runs on plain text files with the extension `.bunch`. It has its own "language", and this package provides syntax highlighting for Bunch files, as well as light/dark color schemes, snippets for common commands, and completion for app names.

Home Page: https://bunchapp.co

License: MIT License

Python 100.00%
bunch snippets macos automation

sublime-bunch's Introduction

A Sublime Text package for Bunch.app on macOS.

Bunch is a Mac automation app that runs on plain text files with the extension .bunch. It has its own "language", and this package provides syntax highlighting for Bunch files, as well as light/dark schemes, snippets for common commands, and completion for app names.

  • Syntax highlighting for Bunch files and Snippets
  • Light and Dark schemes
  • Completions for Bunch commands
  • Completions for any app name on your system
  • Completions for frontmatter keys
  • Navigate snippet fragments with โŒ˜R

Built-in Color Schemes

This package comes with a light and dark scheme for Bunch files built in. Syntax highlighting will work with any theme, but the built-in themes highlight some Bunch-specific syntax nicely. If you want to enable one, go to Preferences->Package Settings->Bunch->Settings and add:

{
    "color_scheme": "Packages/Bunch/Bunch-Dark.sublime-color-scheme"
}

(Or Bunch-Light.sublime-color-scheme for the light version.)

Completing App Names

To ensure you get the spelling and capitalization right when adding an app to a Bunch, just start typing the app name on a new line and then trigger autocomplete (varies based on your settings). Matching apps on your system will be listed.

Because searching your system for matching apps can take a second, autocomplete is disabled while typing, except when inside of parentheses (i.e. a command). You must manually trigger it to complete app names.

Key Bindings

Choose Sublime Text->Preferences->Package Settings->Bunch->Key Bindings to open the example bindings along with your user key bindings file. Copy any bindings you want into your user file, uncomment them, and enjoy them when editing Bunches.

File Items

Example Key Bindings are included which allow Bunch to automatically insert a - filename line when you hit return at the end of an app line, and continue inserting file lines until you enter a blank line (the same way Markdown editors continue unordered lists). Just hit return twice to start typing another app name instead.

Here's what's in the commented-out example file:

// Start file lists
{ "keys": ["enter"], "command": "insert_snippet", "args": {"contents": "\n- "}, "context":
    [
        { "key": "selector", "operator": "equal", "operand": "entity.name.function.app.bunch", "match_all": true },
        { "key": "preceding_text", "operator": "regex_contains", "operand": "^(\\s*(!!)?[@%]?)\\S.*", "match_all": true },
        { "key": "auto_complete_visible", "operator": "equal", "operand": false }
    ]
},
// Extend file lists
{ "keys": ["enter"], "command": "insert_snippet", "args": {"contents": "\n- "}, "context":
    [
        { "key": "selector", "operator": "equal", "operand": "source.bunch", "match_all": true },
        { "key": "preceding_text", "operator": "regex_contains", "operand": "^(\\s*(-)\\s+)\\S.*", "match_all": true },
        { "key": "auto_complete_visible", "operator": "equal", "operand": false }
    ]
},
// Remove empty file item
{ "keys": ["enter"], "command": "run_macro_file", "args": {"file": "Packages/Bunch/macros/Remove Empty File Item.sublime-macro"}, "context":
    [
        { "key": "selector", "operator": "equal", "operand": "source.bunch", "match_all": true },
        { "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*-\\s*$", "match_all": true },
        { "key": "following_text", "operator": "regex_contains", "operand": "^\\s*$", "match_all": true },
        { "key": "auto_complete_visible", "operator": "equal", "operand": false }
    ]
},

Autocomplete

You can have all available commands pop up as autocomplete options whenever you type a left paren, or fragment IDs within the document when you type # in a snippet line. Use the following keybindings (the chained_actions command is included in the package).

[
    {
        "keys": ["("],
        "command": "chained_actions",
        "args": {
            "actions":["insert_snippet","auto_complete"],
            "args":[{"contents": "(${0:$SELECTION})"},{}]
        },
        "context": [
            {"key": "selector", "operator": "equal", "operand": "text.bunch"},
            {"key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*$", "match_all": true }
        ]
    },
    {
        "keys": ["#"],
        "command": "chained_actions",
        "args": {
            "actions":["insert_snippet","auto_complete"],
            "args":[{"contents": "#${0:$SELECTION}"},{}]
        },
        "context": [
            {"key": "selector", "operator": "equal", "operand": "entity.name.file.bunch"},
            {"key": "preceding_text", "operator": "regex_contains", "operand": "<\\S+", "match_all": true }
        ]
    }
]

sublime-bunch's People

Contributors

ttscoff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

jeffreyguntzel

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.