Giter Site home page Giter Site logo

sublimetemplater's Introduction

SublimeTemplater

A fork of SublimeERB, generalized to multiple templating systems

Getting Started

SublimeTemplater helps you insert template tags - Underscore's <% %>, PHP's <? ?>, or Angular's {{ }}, and more - into your documents with one shortcut key. Inspired and forked from SublimeERB, repeated keypresses also allows you to cycle through a list of different template tags (<% %> to <%= %>). Template tags will also automatically surround selected text.

Installation

Package Control Installation

When SublimeTemplater is officially released it will be available on Sublime Package Control. It is not yet available there. Press ctrl+shift+p on Windows/Linux and cmd+shift+p on a Mac to bring up Sublime's Command Pallete, then type install package to bring up Package Control's package selector. It should be the first selection. Type "SublimeERB," which, again, should be the first selection, and then hit enter.

Quick Manual Installation: Mac OS X

Run the following commands:

git clone https://github.com/garetht/SublimeTemplater.git ~/.sublime_templater
ln -fs ~/.sublime_templater/ ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/SublimeTemplater

Quick Manual Installation: Linux

Run the following commands:

git clone https://github.com/garetht/SublimeTemplater.git ~/.sublime_templater
ln -fs ~/.sublime_templater/ ~/.config/sublime-text-2/Packages/SublimeTemplater

Manual Installation: Windows

Download the repository from GitHub, and place it in a folder named SublimeTemplater.

From Sublime Text 2, go to the Preferences menu, and from there select Browse Packages. Copy the SublimeTemplater folder into that directory.

By default, that directory, the Sublime Text packages directory, is located at C:\Users\USERNAME\AppData\Roaming\Sublime Text 2\Packages, where USERNAME is the user name on your Windows machine.

Manual Installation: Mac OS X and Linux

  1. Clone the repository with git clone https://github.com/garetht/SublimeTemplater.git
  2. Move the repository to the Packages directory of Sublime Text, or make a symbolic link to it.

By default, the shortcut to toggle templates is bound to ctrl+shift+., but you can change this in your user settings.

Sublime Text 3 Support

Sublime Text 3 support is not available at this time.

Usage

Setting Template Syntax

While SublimeTemplater makes some crude attempts to determine which tags it should apply given the syntax of the file you are working on, you can also set the template syntax manually by pressing cmd+shift+p to bring up the command palette, and then typing in sublimetemplater (or something shorter that brings the SublimeTemplater options up), and choosing the syntax you wish.

Keybindings

By default, SublimeTemplater binds the tag insert and cycle command to ctrl+shift+.. You can also place this in your user keybinding preferences (Sublime Text 2 > Preferences > Key Bindings - User on Mac, Preferences > Key Bindings - User on Windows)

  [
    { "keys": ["ctrl+shift+."], "command": "templater" }
  ]

You can also modify your user keybindings file to enable the shortcut in the most common templating contexts:

  [
    { "keys": ["ctrl+shift+."], "command": "templater", "context":
      [
        { "key": "selector", "operator": "equal", "operand": "text.html.ruby, text.haml, source.yaml, source.css, source.scss, source.js, source.coffee" }
      ]
    }
  ]

Now you can use ctrl+shift+. to create and toggle between templates of a certain syntax.

Update To Latest Version

If you followed the quick manual install instructions, you can use these commands to update your installation of SublimeTemplater.

  cd ~/.sublime_templater
  git pull --rebase

Copyright

SublimeTemplater is copyrighted 2013 by Gareth Tan, and is released under the MIT License.

SublimeERB is Copyright (c) 2011 Carlos Rodriguez, released under the MIT License.

sublimetemplater's People

Contributors

eddorre avatar garetht avatar antstorm avatar briankung avatar orbanbotond avatar paulca avatar sathishmanohar avatar tpitale avatar oker1 avatar

Watchers

James Cloos avatar  avatar

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.