nvim/UltiSnips/javascript.snippets

115 lines
1.5 KiB
Plaintext
Raw Normal View History

2020-03-19 15:47:31 +00:00
snippet todo "// TODO"
// TODO $0
endsnippet
snippet if "if ( ... ) { ... }"
if ($1) {
2020-04-25 20:55:30 +00:00
$0
2020-03-19 15:47:31 +00:00
}
endsnippet
snippet cl "console.log( ... )"
2020-04-26 11:47:16 +00:00
console.log($0);
2020-03-19 15:47:31 +00:00
endsnippet
snippet if "if ( ... ) { ... }"
if ($1) {
2020-04-25 20:55:30 +00:00
$0
2020-03-19 15:47:31 +00:00
}
endsnippet
snippet ifelse "if ( ... ) { ... } else { ... }"
if ($1) {
2020-04-25 20:55:30 +00:00
$2
2020-03-19 15:47:31 +00:00
} else {
2020-04-25 20:55:30 +00:00
$0
2020-03-19 15:47:31 +00:00
}
endsnippet
snippet for "for ( ... ) { ... }"
for (let ${1:index} = ${2:0}; $1 $3; $1${4:++}) {
2020-04-25 20:55:30 +00:00
$0
2020-03-19 15:47:31 +00:00
}
endsnippet
snippet st "setTimeout( ... )"
setTimeout(() => {$0
}, ${1:1000});
endsnippet
snippet jsx "import React ..."
2020-04-25 20:55:30 +00:00
import React from "react";
class $1 extends React.Component {
constructor(props) {
super(props);
this.state = {
}
}
render() {
return (
<${2:div} className={this.props.className}>
$0
</$2>
);
}
}
2020-03-19 15:47:31 +00:00
export default () => (
2020-04-25 20:55:30 +00:00
<S.$1}></S.$1>
);
2020-03-19 15:47:31 +00:00
endsnippet
2020-04-25 20:55:30 +00:00
snippet jsxs "import React ... styled"
import React from "react";
import styled from "styled-components";
2020-03-19 15:47:31 +00:00
2020-04-25 20:55:30 +00:00
const S = {};
class $1 extends React.Component {
constructor(props) {
super(props);
this.state = {
}
}
render() {
return (
<${2:div} className={this.props.className}>
$0
</$2>
);
}
}
S.$1 = styled($1)\`
\`;
2020-03-19 15:47:31 +00:00
export default () => (
2020-04-25 20:55:30 +00:00
<S.$1}></S.$1>
);
2020-03-19 15:47:31 +00:00
endsnippet
2020-04-25 20:55:30 +00:00
snippet jsc "class ... extends React.Component"
class $1 extends React.Component \{
${2: constructor(props) \{
super(props);
this.state = \{
\}
\}}
render() \{
return (
<${3:div}${4: className=\{this.props.className\}}>
$0
</$3>
);
}
2020-03-19 15:47:31 +00:00
}
endsnippet
2020-04-25 20:55:30 +00:00
2020-04-27 10:54:42 +00:00
snippet th "this.handle..."
this.handle${1:Click} = this.handle$1.bind(this);
endsnippet