-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
196 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,25 @@ | ||
{ ... }: | ||
{ pkgs, config, lib, ... }: | ||
|
||
with lib; | ||
|
||
let | ||
cfg = config.vim.snippets.vsnip; | ||
in | ||
{ | ||
imports = [ | ||
./vsnip.nix | ||
]; | ||
options.vim.snippets.vsnip = { | ||
enable = mkEnableOption "Enable vim-vsnip"; | ||
dataDir = mkOption { | ||
default = builtins.toPath ../../snippets; | ||
description = "Directory for the snippet files"; | ||
type = types.str; | ||
}; | ||
}; | ||
|
||
config = mkIf cfg.enable { | ||
vim.startPlugins = with pkgs.neovimPlugins; [ vim-vsnip ]; | ||
|
||
vim.configRC = '' | ||
let g:vsnip_snippet_dir = "${cfg.dataDir}" | ||
''; | ||
}; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"copyright": { | ||
"prefix": "c)", | ||
"body": [ | ||
"Copyright (c) ${CURRENT_YEAR} ${0:Author}. All Rights Reserved." | ||
], | ||
"description": "Snippet to put copyright" | ||
}, | ||
"diso": { | ||
"prefix": "diso", | ||
"body": [ | ||
"${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE}T${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND}" | ||
], | ||
"description": "ISO date time stamp" | ||
}, | ||
"date": { | ||
"prefix": "date", | ||
"body": ["${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE}"], | ||
"description": "Put the date in (Y-m-D) format" | ||
}, | ||
"dateDMY": { | ||
"prefix": "dateDMY", | ||
"body": ["${CURRENT_DATE}/${CURRENT_MONTH}/${CURRENT_YEAR}"], | ||
"description": "Put date in (DD/MM/YY) format" | ||
}, | ||
"dateMDY": { | ||
"prefix": "dateMDY", | ||
"body": ["${CURRENT_MONTH}/${CURRENT_DATE}/${CURRENT_YEAR}"], | ||
"description": "Put the date in (m/D/Y) format" | ||
}, | ||
"time": { | ||
"prefix": "time", | ||
"body": ["${CURRENT_HOUR}:${CURRENT_MINUTE}"], | ||
"description": "I give you back the time (H:M)" | ||
}, | ||
"timeHMS": { | ||
"prefix": "timeHMS", | ||
"body": ["${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND}"], | ||
"description": "I give you back the time (H:M:S)" | ||
}, | ||
"datetime": { | ||
"prefix": "datetime", | ||
"body": [ | ||
"${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE} ${CURRENT_HOUR}:${CURRENT_MINUTE}" | ||
], | ||
"description": "I give you back the time and date (Y-m-d H:M)" | ||
}, | ||
"uuid": { | ||
"prefix": "uuid", | ||
"body": "${VIM:system('uuidgen')}", | ||
"description": "A Version 4 UUID" | ||
}, | ||
"Lorem Ipsum": { | ||
"prefix": "lorem", | ||
"body": "Lorem ipsum dolor sit amet, officia excepteur ex fugiat reprehenderit enim labore culpa sint ad nisi Lorem pariatur mollit ex esse exercitation amet. Nisi anim cupidatat excepteur officia. Reprehenderit nostrud nostrud ipsum Lorem est aliquip amet voluptate voluptate dolor minim nulla est proident. Nostrud officia pariatur ut officia. Sit irure elit esse ea nulla sunt ex occaecat reprehenderit commodo officia dolor Lorem duis laboris cupidatat officia voluptate. Culpa proident adipisicing id nulla nisi laboris ex in Lorem sunt duis officia eiusmod. Aliqua reprehenderit commodo ex non excepteur duis sunt velit enim. Voluptate laboris sint cupidatat ullamco ut ea consectetur et est culpa et culpa duis.", | ||
"description": "Lorem Ipsum Paragraph" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
{ | ||
"case_class": { | ||
"prefix": "case_class", | ||
"body": "case class ${1:CaseClassName}(${2:argName}: ${3:ArgType})", | ||
"description": "Case class with single argument" | ||
}, | ||
"case_class_2": { | ||
"prefix": "case_class_2", | ||
"body": [ | ||
"case class ${1:CaseClassName}(", | ||
"\t${2:arg1Name}: ${3:Arg1Type},", | ||
"\t${4:arg2Name}: ${5:Arg2Type},", | ||
")" | ||
], | ||
"description": "Case class with two arguments" | ||
}, | ||
"enum": { | ||
"prefix": "enum", | ||
"body": [ | ||
"enum ${1:Name}:", | ||
"\tcase ${2:Foo}, ${3:Bar}" | ||
], | ||
"description": "Enumeration" | ||
}, | ||
"algebra": { | ||
"prefix": "algebra", | ||
"body": [ | ||
"trait ${1:Algebra}[F[_]]:", | ||
"\tdef ${2:methodName}: F[${3:returnType}]" | ||
], | ||
"description": "Abstract algebra encoding" | ||
}, | ||
"typeclass": { | ||
"prefix": "typeclass", | ||
"body": [ | ||
"import cats.effect.Async", | ||
"import cats.syntax.all.*", | ||
"", | ||
"trait ${1:TypeClass}[F[_]]:", | ||
"\tdef ${2:methodName}: F[${3:returnType}]", | ||
"", | ||
"object ${1:TypeClass}:", | ||
"\tdef apply[F[_]: ${1:TypeClass}]: ${1:TypeClass}[F] = summon", | ||
"", | ||
"\tgiven [F[_]: Async]: ${1:TypeClass}[F] with", | ||
"\t\tdef ${2:methodName}: F[${3:returnType}] = ???" | ||
], | ||
"description": "Typeclass encoding" | ||
}, | ||
"ioapp": { | ||
"prefix": "app", | ||
"body": [ | ||
"import cats.effect.*", | ||
"", | ||
"object ${1:Main} extends IOApp.Simple:", | ||
"\t${2:def run: IO[Unit] =}", | ||
"\t\t${3:IO.println(\"Hello, world!\")}" | ||
], | ||
"description": "Main object extending IOApp.Simple" | ||
}, | ||
"def": { | ||
"prefix": "def", | ||
"body": [ | ||
"def ${1:methodName}(${2:argName}: ${3:ArgType}): ${4:ReturnType} =", | ||
"\t${5:???}" | ||
], | ||
"description": "Method" | ||
}, | ||
"def_short": { | ||
"prefix": "def_short", | ||
"body": "def ${1:methodName}(${2:argName}: ${3:ArgType}): ${4:ReturnType} = ${5:???}", | ||
"description": "Method as one-liner" | ||
}, | ||
"for-comprehension": { | ||
"prefix": "forc", | ||
"body": [ | ||
"for", | ||
"\t${1:x} <- ${2:IO.pure(1)}", | ||
"yield ${3:()}" | ||
], | ||
"description": "For-comprehension" | ||
}, | ||
"ifelse": { | ||
"prefix": "ifelse", | ||
"body": [ | ||
"if ${1:condition} then", | ||
"\t${2:\"Foo\"}", | ||
"else", | ||
"\t${3:\"Bar\"}" | ||
], | ||
"description": "Branch based on conditions using if/else" | ||
}, | ||
"ifelse_short": { | ||
"prefix": "ifelse_short", | ||
"body": "if ${1:true} then ${2:123} else ${3:\"foo\"}", | ||
"description": "Branch based on conditions using if/else" | ||
}, | ||
"test_weaver": { | ||
"prefix": "test_weaver", | ||
"body": [ | ||
"import cats.effect.*", | ||
"import weaver.SimpleIOSuite", | ||
"", | ||
"object ${1:SomeTest} extends SimpleIOSuite:", | ||
"\toverride def sharedResource: Resource[IO, String] =", | ||
"\t\tResource.pure(\"test\")", | ||
"", | ||
"\ttest(${2:\"test name\"}) { fixture =>", | ||
"\t\tIO.pure(success)", | ||
"\t}" | ||
], | ||
"description": "Weaver IO test" | ||
} | ||
} |