diff options
author | Griffin Smith <root@gws.fyi> | 2018-03-29T22·10-0400 |
---|---|---|
committer | Griffin Smith <root@gws.fyi> | 2018-03-29T22·10-0400 |
commit | d88fb3194f2a50efa6d407e85d47d14da3700ff3 (patch) | |
tree | 3aa434e148f4f767a992c87b144d536c0e10b689 /snippets |
Initial commit
Diffstat (limited to 'snippets')
-rw-r--r-- | snippets/haskell-mode/benchmark-module | 26 | ||||
-rw-r--r-- | snippets/haskell-mode/header | 6 | ||||
-rw-r--r-- | snippets/haskell-mode/hedgehog-generator | 8 | ||||
-rw-r--r-- | snippets/haskell-mode/hedgehog-property | 9 | ||||
-rw-r--r-- | snippets/haskell-mode/lens.field | 7 | ||||
-rw-r--r-- | snippets/haskell-mode/module | 32 | ||||
-rw-r--r-- | snippets/haskell-mode/test-module | 21 | ||||
-rw-r--r-- | snippets/haskell-mode/undefined | 6 | ||||
-rw-r--r-- | snippets/org-mode/date | 5 | ||||
-rw-r--r-- | snippets/org-mode/date-time | 5 | ||||
-rw-r--r-- | snippets/org-mode/nologdone | 5 | ||||
-rw-r--r-- | snippets/org-mode/source-block | 8 | ||||
-rw-r--r-- | snippets/snippet-mode/indent | 5 | ||||
-rw-r--r-- | snippets/text-mode/date | 5 |
14 files changed, 148 insertions, 0 deletions
diff --git a/snippets/haskell-mode/benchmark-module b/snippets/haskell-mode/benchmark-module new file mode 100644 index 000000000000..cbb1646e41d1 --- /dev/null +++ b/snippets/haskell-mode/benchmark-module @@ -0,0 +1,26 @@ +# key: bench +# name: benchmark-module +# expand-env: ((yas-indent-line (quote fixed))) +# -- +-------------------------------------------------------------------------------- +module ${1:`(if (not buffer-file-name) "Module" + (let ((name (file-name-sans-extension (buffer-file-name))) + (case-fold-search nil)) + (if (cl-search "bench/" name) + (replace-regexp-in-string "/" "." + (replace-regexp-in-string "^\/[^A-Z]*" "" + (car (last (split-string name "src"))))) + (file-name-nondirectory name))))`} ( benchmark, main ) where +-------------------------------------------------------------------------------- +import Bench.Prelude +-------------------------------------------------------------------------------- +import ${1:$(s-chop-suffix "Bench" yas-text)} +-------------------------------------------------------------------------------- + +main :: IO () +main = defaultMain [benchmark] + +-------------------------------------------------------------------------------- + +benchmark :: Benchmark +benchmark = bgroup "${1:$(->> yas-text (s-chop-suffix "Bench") (s-split ".") -last-item)}" [bench "something dumb" $ nf (1 +) (1 :: Int)] diff --git a/snippets/haskell-mode/header b/snippets/haskell-mode/header new file mode 100644 index 000000000000..4d665905f6c6 --- /dev/null +++ b/snippets/haskell-mode/header @@ -0,0 +1,6 @@ +# key: hh +# name: header +# expand-env: ((yas-indent-line 'fixed)) +# -- +---------------------------------------------------------------------- +$2 \ No newline at end of file diff --git a/snippets/haskell-mode/hedgehog-generator b/snippets/haskell-mode/hedgehog-generator new file mode 100644 index 000000000000..68863f70542b --- /dev/null +++ b/snippets/haskell-mode/hedgehog-generator @@ -0,0 +1,8 @@ +# key: gen +# name: Hedgehog Generator +# expand-env: ((yas-indent-line (quote fixed))) +# -- +gen${1:Foo} :: Gen $1 +gen$1 = do + $2 + pure $1{..} \ No newline at end of file diff --git a/snippets/haskell-mode/hedgehog-property b/snippets/haskell-mode/hedgehog-property new file mode 100644 index 000000000000..bf39a2a3eecb --- /dev/null +++ b/snippets/haskell-mode/hedgehog-property @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: Hedgehog Property +# key: hprop +# expand-env: ((yas-indent-line 'fixed)) +# -- +hprop_${1:somethingIsAlwaysTrue} :: Property +hprop_$1 = property $ do + ${2:x} <- forAll ${3:Gen.int $ Range.linear 1 100} + ${4:x === x} \ No newline at end of file diff --git a/snippets/haskell-mode/lens.field b/snippets/haskell-mode/lens.field new file mode 100644 index 000000000000..b22ea3d2e888 --- /dev/null +++ b/snippets/haskell-mode/lens.field @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: lens.field +# key: lens +# expand-env: ((yas-indent-line 'fixed)) +# -- +${1:field} :: Lens' ${2:Source} ${3:Target} +$1 = lens _${4:sourceField} $ \\${2:$(-> yas-text s-word-initials s-downcase)} ${4:$(-> yas-text s-word-initials s-downcase)} -> ${2:$(-> yas-text s-word-initials s-downcase)} { _$4 = ${4:$(-> yas-text s-word-initials s-downcase)} } \ No newline at end of file diff --git a/snippets/haskell-mode/module b/snippets/haskell-mode/module new file mode 100644 index 000000000000..ce7ebcb21353 --- /dev/null +++ b/snippets/haskell-mode/module @@ -0,0 +1,32 @@ +# -*- mode: snippet -*- +# key: module +# name: module +# condition: (= (length "module") (current-column)) +# expand-env: ((yas-indent-line 'fixed)) +# contributor: Luke Hoersten <luke@hoersten.org> +# -- +---------------------------------------------------------------------- +-- | +-- Module : $1 +-- Description : $2 +-- Maintainer : Griffin Smith <grfn@urbint.com> +-- Maturity : ${3:Draft, Usable, Maintained, OR MatureAF} +-- +-- $4 +---------------------------------------------------------------------- +module ${1:`(if (not buffer-file-name) "Module" + (let ((name (file-name-sans-extension (buffer-file-name))) + (case-fold-search nil)) + (if (or (cl-search "src/" name) + (cl-search "test/" name)) + (replace-regexp-in-string "/" "." + (replace-regexp-in-string "^\/[^A-Z]*" "" + (car (last (split-string name "src"))))) + (file-name-nondirectory name))))`} + ( + ) where +---------------------------------------------------------------------- +import Prelude +---------------------------------------------------------------------- + +$0 diff --git a/snippets/haskell-mode/test-module b/snippets/haskell-mode/test-module new file mode 100644 index 000000000000..3183fdc72ab5 --- /dev/null +++ b/snippets/haskell-mode/test-module @@ -0,0 +1,21 @@ +# -*- mode: snippet -*- +# name: test-module +# key: test +# -- +{-# LANGUAGE ApplicativeDo #-} +-------------------------------------------------------------------------------- +module ${1:`(if (not buffer-file-name) "Module" + (let ((name (file-name-sans-extension (buffer-file-name))) + (case-fold-search nil)) + (if (cl-search "test/" name) + (replace-regexp-in-string "/" "." + (replace-regexp-in-string "^\/[^A-Z]*" "" + (car (last (split-string name "src"))))) + (file-name-nondirectory name))))`} where +-------------------------------------------------------------------------------- +import Test.Prelude +import qualified Hedgehog.Gen as Gen +import qualified Hedgehog.Range as Range +-------------------------------------------------------------------------------- +import ${1:$(s-chop-suffix "Test" yas-text)} +-------------------------------------------------------------------------------- diff --git a/snippets/haskell-mode/undefined b/snippets/haskell-mode/undefined new file mode 100644 index 000000000000..7bcd99b5716c --- /dev/null +++ b/snippets/haskell-mode/undefined @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: undefined +# key: u +# expand-env: ((yas-indent-line 'fixed) (yas-wrap-around-region 'nil)) +# -- +undefined$1 \ No newline at end of file diff --git a/snippets/org-mode/date b/snippets/org-mode/date new file mode 100644 index 000000000000..297529cdac64 --- /dev/null +++ b/snippets/org-mode/date @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# key: date +# name: date.org +# -- +[`(format-time-string "%Y-%m-%d")`]$0 diff --git a/snippets/org-mode/date-time b/snippets/org-mode/date-time new file mode 100644 index 000000000000..fde469276c3f --- /dev/null +++ b/snippets/org-mode/date-time @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: date-time +# key: dt +# -- +[`(format-time-string "%Y-%m-%d %H:%m:%S")`] \ No newline at end of file diff --git a/snippets/org-mode/nologdone b/snippets/org-mode/nologdone new file mode 100644 index 000000000000..e5be85d6b3c0 --- /dev/null +++ b/snippets/org-mode/nologdone @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: nologdone +# key: nologdone +# -- +#+STARTUP: nologdone$0 \ No newline at end of file diff --git a/snippets/org-mode/source-block b/snippets/org-mode/source-block new file mode 100644 index 000000000000..3b7694557ecd --- /dev/null +++ b/snippets/org-mode/source-block @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: source-block +# key: src +# expand-env: ((yas-indent-line 'fixed)) +# -- +#+BEGIN_SRC ${1:elisp} +$2 +#+END_SRC \ No newline at end of file diff --git a/snippets/snippet-mode/indent b/snippets/snippet-mode/indent new file mode 100644 index 000000000000..d38ffceafbad --- /dev/null +++ b/snippets/snippet-mode/indent @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: indent +# key: indent +# -- +# expand-env: ((yas-indent-line 'fixed)) \ No newline at end of file diff --git a/snippets/text-mode/date b/snippets/text-mode/date new file mode 100644 index 000000000000..7b9431147011 --- /dev/null +++ b/snippets/text-mode/date @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# name: date +# key: date +# -- +`(format-time-string "%Y-%m-%d")`$0 \ No newline at end of file |