ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Elm Snippets

by rudolfb ST2/ST3

Elm snippets for Sublime Text 2 and 3

Labels snippets, elm

Details

Installs

  • Total 1K
  • Win 435
  • OS X 640
  • Linux 236
Oct 18 Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8 Oct 7 Oct 6 Oct 5 Oct 4 Oct 3 Oct 2 Oct 1 Sep 30 Sep 29 Sep 28 Sep 27 Sep 26 Sep 25 Sep 24 Sep 23 Sep 22 Sep 21 Sep 20 Sep 19 Sep 18 Sep 17 Sep 16 Sep 15 Sep 14 Sep 13 Sep 12 Sep 11 Sep 10 Sep 9 Sep 8 Sep 7 Sep 6 Sep 5 Sep 4 Sep 3
Windows 0 4 0 0 1 2 0 3 1 1 1 1 0 1 1 1 0 0 0 0 0 0 0 2 0 0 1 3 0 2 2 1 0 1 0 2 0 1 0 0 2 0 1 2 0 0
OS X 0 1 2 1 0 1 0 1 1 0 1 0 1 1 1 1 1 1 2 2 0 2 0 0 0 1 2 2 3 1 2 0 0 3 1 2 0 3 0 0 1 0 2 0 0 1
Linux 0 1 1 1 1 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

Elm snippets for Sublime Text 2 and 3

Sublime Text 3

About

This is a Sublime Text 2 and 3 plugin allowing you to use Elm specific snippets in Elm source files.

Installation

First of all, be sure you have Elm installed. Other useful Elm related packages are “Elm Language Support” and “SublimeLinter-contrib-elm-make”. After you've installed Elm and the Elm related packages, you will need to setup this plugin. Each OS has a different Packages folder required by Sublime Text. Open it via Preferences -> Browse Packages, and copy this repository contents to the elm_snippets folder there.

The shorter way of doing this is:

Through Sublime Package Manager

  • Ctrl+Shift+P or Cmd+Shift+P in Linux/Windows/OS X
  • type install, select Package Control: Install Package
  • type elm_snippets, select elm_snippets

Manually

Make sure you use the right Sublime Text folder. For example, on OS X, packages for version 2 are in ~/Library/Application\ Support/Sublime\ Text\ 2, while version 3 is labeled ~/Library/Application\ Support/Sublime\ Text\ 3.

These are for Sublime Text 3:

Mac

git clone https://github.com/rudolfb/elm_snippets ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/elm_snippets

Linux

git clone https://github.com/victorporof/elm_snippets ~/.config/sublime-text-3/Packages/elm_snippets

Windows

git clone https://github.com/victorporof/elm_snippets %APPDATA%/Sublime\ Text\ 3/Packages/elm_snippets

Usage

Type the snippet shortcode and then press Tab to complete the snippet.

Some snippets have more than one place holder. When the snippet is first displayed, the cursor is placed at the first place holder. After entering the text here, press tab to go to the next place holder. If there are no further place holders the cursor will jump to the end of the snippet.

Snippets

cof

Error: language “elm” is not supported
case $1 of
    $2 ->
        $3
Error: language “elm” is not supported
case action of
    Increase ->
      { model | count = model.count + 1 }

imp

Error: language “elm” is not supported
import $1
Error: language “elm” is not supported
import Mouse

impas

Error: language “elm” is not supported
import $1 as $2
Error: language “elm” is not supported
import Html.Events as Events

impea

Error: language “elm” is not supported
import $1 exposing (..)
Error: language “elm” is not supported
import Html exposing (..)

impes

Error: language “elm” is not supported
import $1 exposing ($2)
Error: language “elm” is not supported
import Html exposing (Html)

mod

Error: language “elm” is not supported
module $1 (..) where
$0

Pressing Tab after entering the module name will automatically position the cursor on the start of the next line.

Error: language “elm” is not supported
module Main (..) where

sig

Error: language “elm” is not supported
Signal

siga

Error: language “elm” is not supported
Signal.Address

A space is automatically appended to the string and the cursor placed after the trailing space.

sigma

Error: language “elm” is not supported
Signal.map ($1) $2
Error: language “elm” is not supported
Signal.map (view mb.address) modelSignal

sigmb

Error: language “elm” is not supported
Signal.mailbox ""

sigs

Error: language “elm” is not supported
Signal.Signal

str

Error: language “elm” is not supported
String

ta

Error: language “elm” is not supported
type alias $1 =
    $2
$0

type

Error: language “elm” is not supported
type $1
    = $2
$0

let

Error: language “elm” is not supported
let
    $1 =
        $2
in
    $3

Pressing Tab after entering the alias name will automatically position the cursor indented on the next line, and you can enter the alias definition. Pressing Tab after entering the alias definition will automatically position the cursor on the start of the next line.

Error: language “elm” is not supported
type alias Model =
  { count : Int }

Contributing

Use these snippets as you please. I only ask that if you come up with an incredibly handy snippet, or simply one that I have missed, that you let me know via GitHub so that I can improve these for everybody. Thanks!

Thanks

These snippets are based on a similar Atom project atom-elm-snippets

The Sublime HTML-Snippets package served as the template for this package.

Thank you!