mirror of
https://github.com/cap153/nvim.git
synced 2026-01-18 12:58:35 +08:00
first commit
This commit is contained in:
commit
6955e90e07
61 changed files with 3641 additions and 0 deletions
1
UltiSnips/README.md
Normal file
1
UltiSnips/README.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
# These are custom snippets that suit my needs
|
||||
7
UltiSnips/all.snippets
Normal file
7
UltiSnips/all.snippets
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
global !p
|
||||
from vimsnippets import get_comment_format
|
||||
endglobal
|
||||
|
||||
snippet todo "TODO comment" bw
|
||||
`!p snip.rv=get_comment_format()[0]` TODO: ${2:Something} $0${3: <${4:`!v strftime('%m/%d, %Y')`}${5:, `!v g:snips_author`}>} `!p snip.rv=get_comment_format()[2]`
|
||||
endsnippet
|
||||
13
UltiSnips/c.snippets
Normal file
13
UltiSnips/c.snippets
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
snippet cm "Comment Section"
|
||||
/* ${0} */
|
||||
endsnippet
|
||||
|
||||
snippet st "printf"
|
||||
printf(${0});
|
||||
endsnippet
|
||||
|
||||
snippet inc "Includes"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
endsnippet
|
||||
11
UltiSnips/cs.snippets
Normal file
11
UltiSnips/cs.snippets
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
snippet main "Public main class"
|
||||
public static void Main()
|
||||
{
|
||||
System.Console.WriteLine("Hello");
|
||||
}
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet st "println"
|
||||
System.Console.WriteLine(${0});
|
||||
endsnippet
|
||||
571
UltiSnips/dart.snippets
Normal file
571
UltiSnips/dart.snippets
Normal file
|
|
@ -0,0 +1,571 @@
|
|||
snippet imat "Import Material"
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet context "BuildContext" i
|
||||
BuildContext context
|
||||
endsnippet
|
||||
|
||||
snippet fn "Async Function"
|
||||
void ${1:func}() {
|
||||
${0}
|
||||
}
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet afn "Async Function"
|
||||
Future<void> ${1:func}() async {
|
||||
${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet wfunc "Widget Function"
|
||||
Widget build${1:Widget}() {
|
||||
return ${0:Container()};
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet el "} else {"
|
||||
} else {
|
||||
endsnippet
|
||||
|
||||
snippet elif "} else if () {"
|
||||
} else if (${0}) {
|
||||
endsnippet
|
||||
|
||||
snippet msa "MaterialStateProperty.all"
|
||||
MaterialStateProperty.all(${0}),
|
||||
endsnippet
|
||||
|
||||
snippet msr "MaterialStateProperty.resolveWith"
|
||||
MaterialStateProperty.resolveWith<${1}>((states) => states.contains(MaterialState.pressed) ? null : null),
|
||||
endsnippet
|
||||
|
||||
snippet wh "Width and height"
|
||||
width: ${1},
|
||||
height: ${0},
|
||||
endsnippet
|
||||
|
||||
snippet iwh "Infinity Width and height"
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
endsnippet
|
||||
|
||||
snippet oprs "onPressed"
|
||||
final void Function() onPressed;
|
||||
endsnippet
|
||||
|
||||
snippet pa "Padding"
|
||||
padding: EdgeInsets.only(${1:left: ${2:0}}${3:, right: ${4:0}}${5:, top: ${6:0}}${7:, bottom: ${8:0}}),
|
||||
endsnippet
|
||||
|
||||
snippet paa "Padding All"
|
||||
padding: EdgeInsets.all(${1:8.0}),
|
||||
endsnippet
|
||||
|
||||
snippet pah "Padding Horizontal"
|
||||
padding: EdgeInsets.symmetric(horizontal: ${0:0}),
|
||||
endsnippet
|
||||
|
||||
snippet pav "Padding Vertical"
|
||||
padding: EdgeInsets.symmetric(vertical: ${0:0}),
|
||||
endsnippet
|
||||
|
||||
snippet pat "Padding Top"
|
||||
padding: EdgeInsets.only(top: ${0:0}),
|
||||
endsnippet
|
||||
|
||||
snippet pab "Padding Bottom"
|
||||
padding: EdgeInsets.only(bottom: ${0:0}),
|
||||
endsnippet
|
||||
|
||||
snippet pal "Padding Left"
|
||||
padding: EdgeInsets.only(left: ${0:0}),
|
||||
endsnippet
|
||||
|
||||
snippet par "Padding Right"
|
||||
padding: EdgeInsets.only(right: ${0:0}),
|
||||
endsnippet
|
||||
|
||||
snippet mar "Margin"
|
||||
margin: EdgeInsets.only(${1:left: ${2:0}}${3:, right: ${4:0}}${5:, top: ${6:0}}${7:, bottom: ${8:0}}),
|
||||
endsnippet
|
||||
|
||||
snippet mara "Margin All"
|
||||
margin: EdgeInsets.all(${1:8.0}),
|
||||
endsnippet
|
||||
|
||||
snippet marh "Margin Horizontal"
|
||||
margin: EdgeInsets.symmetric(horizontal: ${0:0}),
|
||||
endsnippet
|
||||
|
||||
snippet marv "Margin Vertical"
|
||||
margin: EdgeInsets.symmetric(vertical: ${0:0}),
|
||||
endsnippet
|
||||
|
||||
snippet mart "Margin Top"
|
||||
margin: EdgeInsets.only(top: ${0:0}),
|
||||
endsnippet
|
||||
|
||||
snippet marb "Margin Bottom"
|
||||
margin: EdgeInsets.only(bottom: ${0:0}),
|
||||
endsnippet
|
||||
|
||||
snippet marl "Margin Left"
|
||||
margin: EdgeInsets.only(left: ${0:0}),
|
||||
endsnippet
|
||||
|
||||
snippet marr "Margin Right"
|
||||
margin: EdgeInsets.only(right: ${0:0}),
|
||||
endsnippet
|
||||
|
||||
snippet marv "Margin Vertical"
|
||||
margin: EdgeInsets.only(top: ${1:0}, bottom: ${1}),${0}
|
||||
endsnippet
|
||||
|
||||
snippet br "BorderRadius"
|
||||
borderRadius: BorderRadius.all(Radius.circular(${0})),
|
||||
endsnippet
|
||||
|
||||
snippet sbr "Shape with BorderRadius"
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(${0})),
|
||||
),
|
||||
endsnippet
|
||||
|
||||
snippet dur "Duration"
|
||||
duration: const Duration(milliseconds: ${0}),
|
||||
endsnippet
|
||||
|
||||
snippet dec "BoxDecoration"
|
||||
decoration: BoxDecoration(
|
||||
color: ${1},
|
||||
),${0}
|
||||
endsnippet
|
||||
|
||||
snippet ba "BorderRadius"
|
||||
border: Border.all(
|
||||
width: ${1},
|
||||
color: ${2},
|
||||
),
|
||||
endsnippet
|
||||
|
||||
snippet mai "MainAxis"
|
||||
mainAxisAlignment: MainAxisAlignment.${0}
|
||||
endsnippet
|
||||
|
||||
snippet crs "CrossAxis"
|
||||
crossAxisAlignment: CrossAxisAlignment.${0}
|
||||
endsnippet
|
||||
|
||||
snippet mainmin "MainAxisSize.min"
|
||||
mainAxisSize: MainAxisSize.min
|
||||
endsnippet
|
||||
|
||||
snippet row "Row"
|
||||
Row(children: [
|
||||
${0}
|
||||
]),
|
||||
endsnippet
|
||||
|
||||
snippet rowa "Row with alignment"
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.${1:start},
|
||||
crossAxisAlignment: CrossAxisAlignment.${2:start},
|
||||
children: [
|
||||
${0}
|
||||
],
|
||||
),
|
||||
endsnippet
|
||||
|
||||
snippet col "Column"
|
||||
Column(children: [
|
||||
${0}
|
||||
]),
|
||||
endsnippet
|
||||
|
||||
snippet cola "Column with alignment"
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.${1:start},
|
||||
crossAxisAlignment: CrossAxisAlignment.${2:start},
|
||||
children: [
|
||||
${0}
|
||||
],
|
||||
),
|
||||
endsnippet
|
||||
|
||||
snippet sta "Stack"
|
||||
Stack(children: [
|
||||
${0}
|
||||
]),
|
||||
endsnippet
|
||||
|
||||
snippet cs "const SizedBox()"
|
||||
const SizedBox()${0}
|
||||
endsnippet
|
||||
|
||||
snippet co "Container"
|
||||
Container()${0}
|
||||
endsnippet
|
||||
|
||||
snippet con "Container"
|
||||
Container(
|
||||
child: ${0},
|
||||
)
|
||||
endsnippet
|
||||
|
||||
snippet exp "Expanded"
|
||||
Expanded(
|
||||
child: ${0},
|
||||
),
|
||||
endsnippet
|
||||
|
||||
snippet flx "Flexible"
|
||||
Flexible(
|
||||
child: ${0},
|
||||
),
|
||||
endsnippet
|
||||
|
||||
snippet cons "Container Sized"
|
||||
Container(
|
||||
width: ${1},
|
||||
height: ${2},
|
||||
child: ${0},
|
||||
)
|
||||
endsnippet
|
||||
|
||||
snippet cen "Center"
|
||||
Center(child: ${0})
|
||||
endsnippet
|
||||
|
||||
snippet t "Text"
|
||||
Text("${1}"),${0}
|
||||
endsnippet
|
||||
|
||||
snippet ts "Text with text style"
|
||||
Text(${1}, style: ${2}),${0}
|
||||
endsnippet
|
||||
|
||||
snippet rts "Rich Text with text style"
|
||||
RichText(
|
||||
text: TextSpan(children: [
|
||||
TextSpan(text: ${1}, style: ${2}),${0}
|
||||
]),
|
||||
),
|
||||
endsnippet
|
||||
|
||||
snippet ss "TextStyle"
|
||||
TStyle(c: ${1}, s: ${2:14}, w: F.w${3:5})${0}
|
||||
endsnippet
|
||||
|
||||
|
||||
snippet nbuilder "NotifierBuilder"
|
||||
NotifierBuilder(
|
||||
notifier: null,
|
||||
builder: (context) {
|
||||
return Container();
|
||||
},
|
||||
)
|
||||
endsnippet
|
||||
|
||||
snippet sw "SizedBox with width"
|
||||
const SizedBox(width: ${1}),${0}
|
||||
endsnippet
|
||||
|
||||
snippet sh "SizedBox with height"
|
||||
const SizedBox(height: ${1}),${0}
|
||||
endsnippet
|
||||
|
||||
snippet swh "SizedBox with width and height"
|
||||
SizedBox(width: ${1}, height: ${2}),${0}
|
||||
endsnippet
|
||||
|
||||
snippet scaf "Scaffold"
|
||||
Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('${1:Title}'),
|
||||
),
|
||||
body: ${2:Container()}${0},
|
||||
);
|
||||
endsnippet
|
||||
|
||||
# snippet sf "New Stateful Widget" b
|
||||
# class ${1:name} extends StatefulWidget {
|
||||
# ${1:name}({super.key});
|
||||
# @override
|
||||
# _${1/([A-Za-z_]+).*/$1/}State createState() => _${1/([A-Za-z_]+).*/$1/}State();
|
||||
# }
|
||||
# class _${1/([A-Za-z_]+).*/$1/}State extends State<${1/([A-Za-z_]+).*/$1/}> {
|
||||
# @override
|
||||
# Widget build(context) {
|
||||
# return ${2:Container()};
|
||||
# }
|
||||
# }
|
||||
# endsnippet
|
||||
|
||||
snippet sf "New Stateful Widget" b
|
||||
class ${1:MyState} extends StatefulWidget {
|
||||
$1({super.key});
|
||||
@override
|
||||
_$1State createState() => _$1State();
|
||||
}
|
||||
class _$1State extends State<$1> {
|
||||
@override
|
||||
Widget build(context) {
|
||||
return ${2:Container()};
|
||||
}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet sl "New Stateless Widget" b
|
||||
class ${1:name} extends StatelessWidget {
|
||||
${1:name}({super.key});
|
||||
@override
|
||||
Widget build(context) {
|
||||
return ${2:Container()};
|
||||
}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet wt "Colors.white"
|
||||
color: colorWhite,
|
||||
endsnippet
|
||||
|
||||
snippet inits "initState"
|
||||
@override
|
||||
void initState() {
|
||||
${0}
|
||||
super.initState();
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet dispose "dispose"
|
||||
@override
|
||||
void dispose() {
|
||||
${0:}
|
||||
super.dispose();
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet listv "ListView.builder"
|
||||
ListView.builder(
|
||||
itemCount: ${1:1},
|
||||
itemBuilder: (context, index) {
|
||||
return ${2:Container()};
|
||||
},
|
||||
)
|
||||
endsnippet
|
||||
|
||||
snippet future "Future Builder"
|
||||
FutureBuilder(
|
||||
future: ${1:Future},
|
||||
initialData: ${2:InitialData},
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.done)
|
||||
return ${3:Container();}
|
||||
return ${4:Container();}
|
||||
},
|
||||
)
|
||||
endsnippet
|
||||
|
||||
snippet stream "Stream Builder"
|
||||
StreamBuilder<${1:dynamic}>(
|
||||
stream: ${2:yourStream},
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
// TODO: do something with the data
|
||||
return ${3:Container()};
|
||||
} else if (snapshot.hasError) {
|
||||
// TODO: do something with the error
|
||||
return ${4:Text(snapshot.error.toString())};
|
||||
}
|
||||
// TODO: the data is not ready, show a loading indicator
|
||||
return ${5:Center(child: CircularProgressIndicator())};
|
||||
},
|
||||
),
|
||||
endsnippet
|
||||
|
||||
snippet try "try catch"
|
||||
try {
|
||||
${0}
|
||||
} catch (e, stack) {
|
||||
print(e);
|
||||
print(stack);
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet for "standard for loop without brackets"
|
||||
for (var ${1:i} = 0; ${1:i} < ${2:n}; ++${1:i})
|
||||
${3:// TODO}
|
||||
endsnippet
|
||||
|
||||
snippet forr "standard for loop"
|
||||
for (var ${1:i} = 0; ${1:i} < ${2:n}; ++${1:i}) {
|
||||
${3:// TODO}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet fori "For in loop"
|
||||
for (var ${1:item} in ${2:object}) {
|
||||
${3:// TODO}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet ssm "Multi-line Set State"
|
||||
setState(() {
|
||||
${1:// TODO}
|
||||
});
|
||||
endsnippet
|
||||
|
||||
snippet sss "Single-line Set State"
|
||||
setState(() => ${1:/* TODO */} );
|
||||
endsnippet
|
||||
|
||||
snippet sst "Empty Set State"
|
||||
setState(() {})${0}
|
||||
endsnippet
|
||||
|
||||
snippet rf "Request focus"
|
||||
FocusScope.of(context).requestFocus(${1:FocusNode()})${0}
|
||||
endsnippet
|
||||
|
||||
snippet rfn "Request focusnode (new)"
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
endsnippet
|
||||
|
||||
snippet push "Navigator push"
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(builder: (context) => ${1:Page()}),
|
||||
)${0}
|
||||
endsnippet
|
||||
|
||||
snippet pop "Navigator pop"
|
||||
Navigator.of(context).pop(${1})${0}
|
||||
endsnippet
|
||||
|
||||
snippet rmb "RawMaterialButton"
|
||||
RawMaterialButton(
|
||||
elevation: ${1:0},
|
||||
onPressed: () {},
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(${2:5})),
|
||||
),
|
||||
fillColor: ${3:Colors.transparent},
|
||||
child: ${5:Container()},
|
||||
),
|
||||
endsnippet
|
||||
|
||||
snippet mo "Get MediaQuery"
|
||||
MediaQuery.of(context)${0}
|
||||
endsnippet
|
||||
|
||||
snippet st "print();"
|
||||
print(${0});
|
||||
endsnippet
|
||||
|
||||
snippet sbj "Behavior subject"
|
||||
Stream<${1:int}> get ${2:my}Stream => _${2:my}Subject.stream;
|
||||
BehaviorSubject<${1}> _${2:my}Subject;
|
||||
_${2:my}Subject = BehaviorSubject<${1}>();
|
||||
endsnippet
|
||||
|
||||
snippet f "Function"
|
||||
() =>
|
||||
endsnippet
|
||||
|
||||
snippet adelay "await Future.delayed"
|
||||
await Future.delayed(const Duration(milliseconds: ${1:300}));
|
||||
endsnippet
|
||||
|
||||
snippet delay "Future.delayed"
|
||||
Future.delayed(const Duration(milliseconds: ${1:300})).then((_) {
|
||||
${2}
|
||||
});
|
||||
endsnippet
|
||||
|
||||
snippet now "DateTime.now()"
|
||||
DateTime.now()
|
||||
endsnippet
|
||||
|
||||
snippet rt "required this."
|
||||
required this.${1}, ${0}
|
||||
endsnippet
|
||||
|
||||
snippet posr "Positioned right"
|
||||
Positioned(
|
||||
top: ${1:0},
|
||||
right: ${2:0},
|
||||
bottom: ${3:0},
|
||||
child: ${0:Container()},
|
||||
),
|
||||
endsnippet
|
||||
|
||||
snippet posl "Positioned left"
|
||||
Positioned(
|
||||
top: ${1:0},
|
||||
left: ${2:0},
|
||||
bottom: ${3:0},
|
||||
child: ${0:Container()},
|
||||
),
|
||||
endsnippet
|
||||
|
||||
snippet post "Positioned top"
|
||||
Positioned(
|
||||
top: ${1:0},
|
||||
left: ${2:0},
|
||||
right: ${3:0},
|
||||
child: ${0:Container()},
|
||||
),
|
||||
endsnippet
|
||||
|
||||
snippet posb "Positioned bottom"
|
||||
Positioned(
|
||||
bottom: ${1:0},
|
||||
left: ${2:0},
|
||||
right: ${3:0},
|
||||
child: ${0:Container()},
|
||||
),
|
||||
endsnippet
|
||||
|
||||
snippet postr "Positioned top right"
|
||||
Positioned(
|
||||
top: ${1:0},
|
||||
right: ${2:0},
|
||||
child: ${3:Container()},
|
||||
),
|
||||
endsnippet
|
||||
|
||||
snippet posbl "Positioned bottom left"
|
||||
Positioned(
|
||||
bottom: ${1:0},
|
||||
left: ${2:0},
|
||||
child: ${3:Container()},
|
||||
),
|
||||
endsnippet
|
||||
|
||||
snippet posbr "Positioned bottom right"
|
||||
Positioned(
|
||||
bottom: ${1:0},
|
||||
right: ${2:0},
|
||||
child: ${3:Container()},
|
||||
),
|
||||
endsnippet
|
||||
|
||||
snippet postl "Positioned top left"
|
||||
Positioned(
|
||||
top: ${1:0},
|
||||
left: ${2:0},
|
||||
child: ${3:Container()},
|
||||
),
|
||||
endsnippet
|
||||
|
||||
snippet fa "fix add type"
|
||||
// TYPEADD
|
||||
endsnippet
|
||||
|
||||
snippet .f "fix add type" i
|
||||
.forEach((${1:item}) {
|
||||
${0:// TODO}
|
||||
});
|
||||
endsnippet
|
||||
84
UltiSnips/go.snippets
Normal file
84
UltiSnips/go.snippets
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
snippet checke "Check Error"
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
${0}
|
||||
endsnippet
|
||||
|
||||
snippet no "utils.NoError"
|
||||
if utils.NoError(err) {
|
||||
${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet forr "For loop range"
|
||||
for _, ${1:thing} := range ${2:things} {
|
||||
${3://TODO}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet fori "For loop i"
|
||||
for i := 0; i < n; i++ {
|
||||
${1://TODO}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet re "Return Error if any"
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
${0}
|
||||
endsnippet
|
||||
|
||||
snippet ie "Check Error"
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
${0}
|
||||
endsnippet
|
||||
|
||||
snippet st "Println"
|
||||
fmt.Println(${1})${0}
|
||||
endsnippet
|
||||
|
||||
snippet lt "Log Println"
|
||||
log.Println(${1})${0}
|
||||
endsnippet
|
||||
|
||||
snippet sf "Printf"
|
||||
fmt.Printf("${1}\n")${0}
|
||||
endsnippet
|
||||
|
||||
snippet lf "Log Printf"
|
||||
log.Printf("${1}\n")${0}
|
||||
endsnippet
|
||||
|
||||
snippet fn "Function"
|
||||
func ${1:function}() {
|
||||
${0: // todo}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet lt "Log Println"
|
||||
log.Println(${1})${0}
|
||||
endsnippet
|
||||
|
||||
snippet start "Starting code"
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("hello")
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet cq "Current Question"
|
||||
app.result.questions[app.curResultIndex]${0}
|
||||
endsnippet
|
||||
|
||||
snippet fa "fix add type"
|
||||
// TYPEADD
|
||||
endsnippet
|
||||
4
UltiSnips/java.snippets
Normal file
4
UltiSnips/java.snippets
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
snippet st "System.out.Println();"
|
||||
System.out.println(${0});
|
||||
endsnippet
|
||||
|
||||
444
UltiSnips/javascript.snippets
Normal file
444
UltiSnips/javascript.snippets
Normal file
|
|
@ -0,0 +1,444 @@
|
|||
snippet st "console.log"
|
||||
console.log(${0});
|
||||
endsnippet
|
||||
|
||||
snippet fl "Firebase Function Log"
|
||||
/*LOG*/ functions.logger.log(${0});
|
||||
endsnippet
|
||||
|
||||
snippet f "Arrow Function"
|
||||
(${1:arg}) => {
|
||||
${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet fn "Empty Function"
|
||||
function ${1:functionName}() {
|
||||
${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet cf "Constant Function"
|
||||
const ${1:funcName} = () => {
|
||||
${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet ef "Export Function"
|
||||
export function ${1:functionName}() {
|
||||
${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet eaf "Export Async Function"
|
||||
export async function ${1:functionName}() {
|
||||
${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet eafa "Export Async Function With Args"
|
||||
const ${1}DefaultArgs = {
|
||||
${2}
|
||||
};
|
||||
export async function ${1:functionName}(options = ${1}DefaultArgs) {
|
||||
options = { ...${1}DefaultArgs, ...options };
|
||||
${0:// todo}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet ssr "NextJS ServerSide Rendering"
|
||||
export async function getServerSideProps() {
|
||||
return {
|
||||
props: {
|
||||
//
|
||||
},
|
||||
};
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet ssg "NextJS ServerSide Generation"
|
||||
export async function getStaticProps() {
|
||||
return {
|
||||
props: {
|
||||
//
|
||||
},
|
||||
};
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet rs "res.status"
|
||||
res.status(${1:200}).send("${2:text}")${0}
|
||||
endsnippet
|
||||
|
||||
snippet af "Async Arrow Function"
|
||||
async (${1}) => {
|
||||
${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet afn "Async Function"
|
||||
async function ${1:FunctionName}() {
|
||||
${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet try "Try Catch"
|
||||
try {
|
||||
//
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet eh "Error Handler"
|
||||
return await errorHandler(async () => {
|
||||
${0:// Todo}
|
||||
});
|
||||
endsnippet
|
||||
|
||||
snippet c "Comment Block"
|
||||
/*
|
||||
* ${0}
|
||||
*/
|
||||
endsnippet
|
||||
|
||||
snippet pm "@param"
|
||||
@param ${1:parameter}: ${0:description}
|
||||
endsnippet
|
||||
|
||||
# React & JSX
|
||||
|
||||
snippet t "Tag"
|
||||
<${1:div}>
|
||||
${2}
|
||||
</${1}>
|
||||
${0}
|
||||
endsnippet
|
||||
|
||||
snippet ta "Tag with Attributes"
|
||||
<${1:div} ${2:className=""}>
|
||||
${3}
|
||||
</${1}>
|
||||
${0}
|
||||
endsnippet
|
||||
|
||||
snippet ti "Tag Inline"
|
||||
<${1} />
|
||||
${0}
|
||||
endsnippet
|
||||
|
||||
snippet br "<br />"
|
||||
<br />
|
||||
endsnippet
|
||||
|
||||
|
||||
snippet rrcc "React Redux Class Component" b
|
||||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
import styles from './${2:$1}.css';
|
||||
|
||||
class ${1:`!v expand('%:t:r')`} extends Component {
|
||||
static propTypes = {
|
||||
children: PropTypes.node,
|
||||
className: PropTypes.string,
|
||||
dispatch: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div className={styles.base}>
|
||||
$3
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function mapStateToProps(state) {
|
||||
return {};
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps)($1);
|
||||
endsnippet
|
||||
|
||||
snippet rcc "React Class Component" b
|
||||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import styles from './${2:$1}.css';
|
||||
|
||||
class ${1:`!v expand('%:t:r')`} extends Component {
|
||||
static propTypes = {
|
||||
${2:children: PropTypes.node,
|
||||
className: PropTypes.string,}
|
||||
};
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<${3:div} className={styles.base}>
|
||||
$0
|
||||
</$3>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default $1;
|
||||
endsnippet
|
||||
|
||||
snippet rfc "React Functional Component" b
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import styles from './${2:$1}.css';
|
||||
|
||||
function ${1:`!v expand('%:t:r')`}({ $3 }) {
|
||||
return (
|
||||
<${5:div} className={styles.base}>
|
||||
$0
|
||||
</$5>
|
||||
);
|
||||
}
|
||||
|
||||
$1.defaultProps = {$4};
|
||||
|
||||
$1.propTypes = {`!p
|
||||
props = t[3]
|
||||
if props:
|
||||
snip >> 1
|
||||
for prop in props.split(', '):
|
||||
snip += prop + ': PropTypes.any,'
|
||||
`
|
||||
};
|
||||
|
||||
export default $1;
|
||||
endsnippet
|
||||
|
||||
snippet rsc "React Styled Component" b
|
||||
import styled from 'styled-components';
|
||||
|
||||
const ${1:`!v expand('%:t:r')`} = styled.${2:div}\`
|
||||
$3
|
||||
\`;
|
||||
|
||||
export default $1;
|
||||
endsnippet
|
||||
|
||||
snippet rsci "React Styled Component Interpolation" b
|
||||
import styled, { css } from 'styled-components';
|
||||
|
||||
const ${1:`!v expand('%:t:r')`} = styled.${2:div}\`${props => css\`
|
||||
${3:${props.$4 && \`
|
||||
$5
|
||||
\`}}
|
||||
\`}\`;
|
||||
|
||||
export default $1;
|
||||
endsnippet
|
||||
|
||||
snippet pp "Get Props"
|
||||
${props => props.${1}};
|
||||
endsnippet
|
||||
|
||||
snippet cn "className"
|
||||
className="$1"
|
||||
endsnippet
|
||||
|
||||
snippet dp "Default Props" b
|
||||
${1:`!v expand('%:t:r')`.}defaultProps = {
|
||||
$2
|
||||
};
|
||||
endsnippet
|
||||
|
||||
snippet set "Set State"
|
||||
this.setState({
|
||||
${1}: ${2}
|
||||
});
|
||||
endsnippet
|
||||
|
||||
snippet props "Get Property" i
|
||||
this.props.${1}
|
||||
endsnippet
|
||||
|
||||
snippet state "Get State" i
|
||||
this.state.${1}
|
||||
endsnippet
|
||||
|
||||
snippet ref "Ref" i
|
||||
ref={${1:ref} => { this.${2:name} = $1; }}
|
||||
endsnippet
|
||||
|
||||
|
||||
# Component Lifecycle
|
||||
snippet cwm "Component Will Mount" b
|
||||
componentWillMount() {
|
||||
$1
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet cdm "Component Did Mount" b
|
||||
componentDidMount() {
|
||||
$1
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet cwrp "Component Will Receive Props" b
|
||||
componentWillReceiveProps(nextProps) {
|
||||
$1
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet scup "Should Component Update" b
|
||||
shouldComponentUpdate(nextProps, nextState) {
|
||||
$1
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet cwup "Component Will Update" b
|
||||
componentWillUpdate(nextProps, nextState) {
|
||||
$1
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet cdup "Component Did Update" b
|
||||
componentDidUpdate(prevProps, prevState) {
|
||||
$1
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet cwu "Component Will Unmount" b
|
||||
componentWillUnmount() {
|
||||
$1
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet ren "Render"
|
||||
render() {
|
||||
return ${1:(
|
||||
${2:<div>${3}</div>}
|
||||
);}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
|
||||
# PropTypes
|
||||
snippet pt "PropTypes Definition" b
|
||||
${1:`!v expand('%:t:r')`.}propTypes = {
|
||||
${2:className}: ${3:PropTypes.string},
|
||||
};
|
||||
endsnippet
|
||||
|
||||
snippet pt.a "PropTypes Array" w
|
||||
PropTypes.array${1:,}
|
||||
endsnippet
|
||||
|
||||
snippet pt.b "PropTypes Boolean" w
|
||||
PropTypes.bool${1:,}
|
||||
endsnippet
|
||||
|
||||
snippet pt.f "PropTypes Function" w
|
||||
PropTypes.func${1:,}
|
||||
endsnippet
|
||||
|
||||
snippet pt.n "PropTypes Number" w
|
||||
PropTypes.number${1:,}
|
||||
endsnippet
|
||||
|
||||
snippet pt.o "PropTypes Object" w
|
||||
PropTypes.object${1:,}
|
||||
endsnippet
|
||||
|
||||
snippet pt.s "PropType String" w
|
||||
PropTypes.string${1:,}
|
||||
endsnippet
|
||||
|
||||
snippet pt.no "PropTypes Node" w
|
||||
PropTypes.node${1:,}
|
||||
endsnippet
|
||||
|
||||
snippet pt.e "PropTypes Element" w
|
||||
PropTypes.element${1:,}
|
||||
endsnippet
|
||||
|
||||
snippet pt.io "PropTypes instanceOf" w
|
||||
PropTypes.instanceOf(${2:PropTypes.string})${1:,}
|
||||
endsnippet
|
||||
|
||||
snippet pt.one "PropTypes oneOf" w
|
||||
PropTypes.oneOf(['$2'$3])${1:,}
|
||||
endsnippet
|
||||
|
||||
snippet pt.onet "PropTypes oneOfType" w
|
||||
PropTypes.oneOfType([
|
||||
$2
|
||||
])${1:,}
|
||||
endsnippet
|
||||
|
||||
snippet pt.ao "PropTypes arrayOf" w
|
||||
PropTypes.arrayOf(${2:PropTypes.string})${1:,}
|
||||
endsnippet
|
||||
|
||||
snippet pt.oo "PropTypes objectOf" w
|
||||
PropTypes.objectOf(${2:PropTypes.string})${1:,}
|
||||
endsnippet
|
||||
|
||||
snippet pt.sh "PropTyes Shape" w
|
||||
PropTypes.shape({
|
||||
$2
|
||||
})${1:,}
|
||||
endsnippet
|
||||
|
||||
snippet ir "isRequired" w
|
||||
isRequired,
|
||||
endsnippet
|
||||
|
||||
snippet rs "React useState"
|
||||
const [$1, set${1}] = useState(${0:''})
|
||||
endsnippet
|
||||
|
||||
snippet test "Test"
|
||||
test("${1:test}", ${2:async}() => {
|
||||
${3:// ...}
|
||||
});
|
||||
endsnippet
|
||||
|
||||
snippet ex "Expect"
|
||||
expect(${1:1+1}).toBe(${2:2});
|
||||
endsnippet
|
||||
|
||||
|
||||
snippet route "New Route"
|
||||
import express from "express";
|
||||
|
||||
const ${1:some}Routes = express.Router();
|
||||
|
||||
${0:// TODO}
|
||||
|
||||
export default ${1:some}Routes;
|
||||
endsnippet
|
||||
|
||||
snippet l "log"
|
||||
log(${0});
|
||||
endsnippet
|
||||
|
||||
snippet ehs "errorHandlers.silent"
|
||||
await errorHandlers.silent(async () => {
|
||||
${0:// todo}
|
||||
});
|
||||
endsnippet
|
||||
|
||||
snippet eha "errorHandlers.safe"
|
||||
await errorHandlers.safe({
|
||||
action: async () => {
|
||||
${0:// todo}
|
||||
},
|
||||
teardown: async () => {
|
||||
// todo
|
||||
},
|
||||
});
|
||||
endsnippet
|
||||
11
UltiSnips/lua.snippets
Normal file
11
UltiSnips/lua.snippets
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
snippet f "Empty function"
|
||||
function ()
|
||||
${0}
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet conf "Config function"
|
||||
config = function ()
|
||||
${0}
|
||||
end
|
||||
endsnippet
|
||||
10
UltiSnips/markdown.snippets
Normal file
10
UltiSnips/markdown.snippets
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
snippet th "Table Heading"
|
||||
| ${1:Key} | ${2:Value} |
|
||||
|-|-|
|
||||
${0}
|
||||
endsnippet
|
||||
|
||||
snippet tr "Table Row"
|
||||
| ${1:Term} | ${2:Definition} |
|
||||
${0}
|
||||
endsnippet
|
||||
8
UltiSnips/python.snippets
Normal file
8
UltiSnips/python.snippets
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
snippet pri "print"
|
||||
print(${0})
|
||||
endsnippet
|
||||
|
||||
snippet main "__main__"
|
||||
if __name__ == '__main__':
|
||||
${0}
|
||||
endsnippet
|
||||
9
UltiSnips/racket.snippets
Normal file
9
UltiSnips/racket.snippets
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
snippet fn "Function"
|
||||
(define (${1:name} [${2:arg : Real}]) : Real
|
||||
${0:(+ 1 1)})
|
||||
endsnippet
|
||||
|
||||
snippet st "print();"
|
||||
(displayln ${0})
|
||||
endsnippet
|
||||
|
||||
4
UltiSnips/swift.snippets
Normal file
4
UltiSnips/swift.snippets
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
snippet st "print"
|
||||
print(${0})
|
||||
endsnippet
|
||||
|
||||
9
UltiSnips/tex.snippets
Normal file
9
UltiSnips/tex.snippets
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# snip
|
||||
snippet mid "\mid \mid"
|
||||
\\mid ${1} \\mid ${0}
|
||||
endsnippet
|
||||
|
||||
snippet srt "\sqrt{}"
|
||||
\\sqrt{${1}} ${0}
|
||||
endsnippet
|
||||
|
||||
38
UltiSnips/typescriptreact.snippets
Normal file
38
UltiSnips/typescriptreact.snippets
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
snippet ssg "NextJS ServerSide Generation"
|
||||
export async function getStaticProps() {
|
||||
return {
|
||||
props: {
|
||||
//
|
||||
},
|
||||
};
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet t "Tag"
|
||||
<${1:div}>
|
||||
${2}
|
||||
</${1}>
|
||||
${0}
|
||||
endsnippet
|
||||
|
||||
snippet ta "Tag with Attributes"
|
||||
<${1:div} ${2:className=""}>
|
||||
${3}
|
||||
</${1}>
|
||||
${0}
|
||||
endsnippet
|
||||
|
||||
snippet tn "Tag with class Names"
|
||||
<${1:div} className="${2}">
|
||||
${0}
|
||||
</${1}>
|
||||
endsnippet
|
||||
|
||||
snippet ti "Tag Inline"
|
||||
<${1} />
|
||||
${0}
|
||||
endsnippet
|
||||
|
||||
snippet br "<br />"
|
||||
<br />
|
||||
endsnippet
|
||||
7
UltiSnips/vim.snippets
Normal file
7
UltiSnips/vim.snippets
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
snippet sec "Comment Section"
|
||||
" ===
|
||||
" === ${1:New Section}
|
||||
" ===
|
||||
${0}
|
||||
endsnippet
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue