Elm Snippets
Elm snippets for Sublime Text 2 and 3
Details
Installs
- Total 3K
- Win 929
- Mac 1K
- Linux 558
May 28 | May 27 | May 26 | May 25 | May 24 | May 23 | May 22 | May 21 | May 20 | May 19 | May 18 | May 17 | May 16 | May 15 | May 14 | May 13 | May 12 | May 11 | May 10 | May 9 | May 8 | May 7 | May 6 | May 5 | May 4 | May 3 | May 2 | May 1 | Apr 30 | Apr 29 | Apr 28 | Apr 27 | Apr 26 | Apr 25 | Apr 24 | Apr 23 | Apr 22 | Apr 21 | Apr 20 | Apr 19 | Apr 18 | Apr 17 | Apr 16 | Apr 15 | Apr 14 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Mac | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Linux | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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
orCmd+Shift+P
in Linux/Windows/OS X- type
install
, selectPackage Control: Install Package
- type
elm_snippets
, selectelm_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
case $1 of
$2 ->
$3
case action of
Increase ->
{ model | count = model.count + 1 }
imp
import $1
import Mouse
impas
import $1 as $2
import Html.Events as Events
impea
import $1 exposing (..)
import Html exposing (..)
impes
import $1 exposing ($2)
import Html exposing (Html)
mod
module $1 (..) where
$0
Pressing Tab after entering the module name will automatically position the cursor on the start of the next line.
module Main (..) where
sig
Signal
siga
Signal.Address
A space is automatically appended to the string and the cursor placed after the trailing space.
sigma
Signal.map ($1) $2
Signal.map (view mb.address) modelSignal
sigmb
Signal.mailbox ""
sigs
Signal.Signal
str
String
ta
type alias $1 =
$2
$0
type
type $1
= $2
$0
let
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.
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!