1
0
Fork 0
mirror of synced 2024-11-25 10:15:35 -05:00
ultimate-vim/sources_non_forked/vim-snippets/snippets/d.snippets
2017-02-11 14:01:38 +01:00

338 lines
4.7 KiB
Text

### Import
snippet imp
import
snippet pimp
public import
### My favorite modules
snippet io
std.stdio
snippet traits
std.traits
snippet conv
std.conv
snippet arr
std.array
snippet algo
std.algorithm
snippet theusual
import std.stdio, std.string, std.array;
import std.traits, std.conv, std.algorithm;
import std.math, std.regex;
### Control Structures
snippet for
for(int ${1:i} = 0; $1 < ${2:count}; $1++) {
${0}
}
snippet fe
foreach(${1:elem}; ${2:range}) {
${0}
}
snippet fei
foreach(${1:i}, ${2:elem}; ${3:range}) {
${0}
}
snippet fer
foreach_reverse(${1:elem}; ${2:range}) {
${0}
}
snippet feri
foreach_reverse(${1:i}, ${2:elem}; ${3:range}) {
${0}
}
snippet sce
scope(exit) ${1:f.close();}
snippet scs
scope(success) ${1}
snippet scf
scope(failure) ${1}
snippet el
else {
${1}
}
snippet eif
else if(${1}) {
${0}
}
snippet if
if(${1}) {
${0}
}
snippet ife
if(${1}) {
${2}
} else {
${3}
}
snippet ifee
if(${1}) {
${2}
} else if(${3}) {
${4}
} else {
${5}
}
snippet sw
switch(${1}) {
${0}
}
snippet cs
case ${1:0}:
${2}
break;
snippet def
default:
${0}
snippet fsw
final switch(${1}) {
${0}
}
snippet try
try {
${1:${VISUAL}}
} catch(${2:Exception} ${3:e}) {
${4}
}
snippet tcf
try {
${0:${VISUAL}}
} catch(${1:Exception} ${2:e}) {
${3}
} finally {
${4}
}
snippet wh
while(${1:cond}) {
${0:${VISUAL}}
}
snippet dowh
do {
${1}
} while(${2});
snippet sif
static if(${1:cond}) {
${2}
}
snippet sife
static if(${1}) {
${2}
} else {
${3}
}
snippet sifee
static if(${1}) {
${2}
} else static if(${3}) {
${4}
} else {
${5}
}
snippet seif
else static if(${1}) {
${2}
}
snippet ?
(${1: a > b}) ? ${2:a} : ${3:b};
snippet with
with(${1:exp}) {
${2}
} ${0}
### Functions
snippet fun
${1:auto} ${2:func}(${3:params}) {
${0}
}
snippet contr
in {
${1}
} out {
${2}
} body {
${0}
}
snippet l
(${1:x}) => ${2:x}${0:;}
snippet funl
function (${1:int x}) => ${2}${3:;}
snippet del
delegate (${1:int x}) => ${2}${3:;}
### Templates
snippet temp
template ${1:`vim_snippets#Filename("$2", "untitled")`}(${2:T}) {
${0}
}
snippet tempif
template ${1:`vim_snippets#Filename("$2", "untitled")`}(${2:T}) if(${3:isSomeString!}$2) {
${0}
}
snippet opApply
int opApply(Dg)(Dg dg) if(ParameterTypeTuble!Dg.length == 2) {
${0}
}
snippet psn
pure @safe nothrow
snippet safe
@safe
snippet trusted
@trusted
snippet system
@system
### OOPs
snippet cl
class${1:(T)} ${2:`vim_snippets#Filename("$3", "untitled")`} {
${0}
}
snippet str
struct${1:(T)} ${2:`vim_snippets#Filename("$3", "untitled")`} {
${0}
}
snippet uni
union${1:(T)} ${2:`vim_snippets#Filename("$3", "untitled")`} {
${0}
}
snippet inter
interface I${1:`vim_snippets#Filename("$2", "untitled")`} {
${0}
}
snippet enum
enum ${1} {
${0}
}
snippet pu
public
snippet pr
private
snippet po
protected
snippet ctor
this(${1}) {
${0}
}
snippet dtor
~this(${1}) {
${0}
}
### Type Witchery
snippet al
alias ${1:b} = ${2:a};
${0}
snippet alth
alias ${1:value} this;
${0}
### The Commonplace
snippet main
void main() {
${0}
}
snippet maina
void main(string[] args) {
${0}
}
snippet mod
module ${1:main};${0}
snippet var
${1:auto} ${2:var} = ${0:1};
snippet new
${1:auto} ${2:var} = new ${3:Object}(${4});
${0}
snippet file
auto ${1:f} = File(${2:"useful_info.xml"}, ${3:"rw"});
${0}
snippet map
map!(${1:f})(${2:xs});
${0}
snippet filter
filter!(${1:p})(${2:xs});
${0}
snippet reduce
reduce!(${1:f})(${2:xs});
${0}
snippet find
find!(${1:p})($2:xs);
${0}
snippet aa
${1:int}[${2:string}] ${3:dict} = ${0};
### Misc
snippet #!
#!/usr/bin/env rdmd
snippet bang
#!/usr/bin/env rdmd
snippet rdmd
#!/usr/bin/env rdmd
snippet isstr
isSomeString!${1:S}
snippet isnum
isNumeric!${1:N}
snippet tos
to!string(${1:x});
${0}
snippet toi
to!int(${1:str});
${0}
snippet tod
to!double(${1:str});
${0}
snippet un
unittest {
${0}
}
snippet ver
version(${1:Posix}) {
${0}
}
snippet de
debug {
${0}
}
snippet sst
shared static this(${1}) {
${0}
}
snippet td
// Typedef is deprecated. Use alias instead.
typedef
snippet ino
inout
snippet imm
immutable
snippet fin
final
snippet con
const
snippet psi
private static immutable ${1:int} ${2:Constant} = ${3:1};
${0}
snippet prag
pragma(${1})
snippet pms
pragma(msg, ${1:Warning});
snippet asm
asm {
${1}
}
snippet mixin
mixin(${1:`writeln("Hello, World!");`});
snippet over
override
snippet ret
return ${1};
snippet FILE
__FILE__
snippet MOD
__MODULE__
snippet LINE
__LINE__
snippet FUN
__FUNCTION__
snippet PF
__PRETTY_FUNCTION__
snippet cast
cast(${1:T})(${2:val});
snippet /*
/*
* ${1}
*/
### Fun stuff
snippet idk
// I don't know how this works. Don't touch it.
snippet idfk
// Don't FUCKING touch this.