diff --git a/UltiSnips/javascript.snippets b/UltiSnips/javascript.snippets index c0fcd10..90f43b1 100644 --- a/UltiSnips/javascript.snippets +++ b/UltiSnips/javascript.snippets @@ -4,35 +4,31 @@ endsnippet snippet if "if ( ... ) { ... }" if ($1) { - $0 + $0 } endsnippet -snippet cl; "console.log( ... );" -console.log($0); -endsnippet - snippet cl "console.log( ... )" -console.log($0) +console.log($0); endsnippet snippet if "if ( ... ) { ... }" if ($1) { - $0 + $0 } endsnippet snippet ifelse "if ( ... ) { ... } else { ... }" if ($1) { - $2 + $2 } else { - $0 + $0 } endsnippet snippet for "for ( ... ) { ... }" for (let ${1:index} = ${2:0}; $1 $3; $1${4:++}) { - $0 + $0 } endsnippet @@ -42,36 +38,74 @@ setTimeout(() => {$0 endsnippet snippet jsx "import React ..." -import React from "react" +import React from "react"; + +class $1 extends React.Component { + constructor(props) { + super(props); + this.state = { + } + } + + render() { + return ( + <${2:div} className={this.props.className}> + $0 + + ); + } +} export default () => ( - <${1:div}>$0 -) + +); endsnippet -snippet jsxs "import React ... (styled)" -import React from "react" -import styled from "styled-components" +snippet jsxs "import React ... styled" +import React from "react"; +import styled from "styled-components"; -const $1 = styled.${2:div}\` - $3 -\` +const S = {}; + +class $1 extends React.Component { + constructor(props) { + super(props); + this.state = { + } + } + + render() { + return ( + <${2:div} className={this.props.className}> + $0 + + ); + } +} + +S.$1 = styled($1)\` +\`; export default () => ( - <$1>$0 -) + +); endsnippet -snippet xc "class ..." -class $1 extends React.component { - constructor(props) { - super(props) - this.setState({$0}) - } +snippet jsc "class ... extends React.Component" +class $1 extends React.Component \{ +${2: constructor(props) \{ + super(props); + this.state = \{ + \} + \}} - render() { - return ( - ) - } + render() \{ + return ( + <${3:div}${4: className=\{this.props.className\}}> + $0 + + ); + } } endsnippet + diff --git a/init.vim b/init.vim index 9876014..943d660 100644 --- a/init.vim +++ b/init.vim @@ -435,17 +435,13 @@ iabbrev ct'' content-type: ''; "----------------------------------------------------------------------------}}} " #autocommands {{{ -" center on insert {{{ - augroup CenterInsert - autocmd! - autocmd InsertEnter * norm zt - augroup END - -" }}} " template files {{{ augroup templates autocmd! autocmd BufNewFile *.sh 0read ~/.config/nvim/templates/template.sh | normal G + autocmd BufNewFile *.html 0read ~/.config/nvim/templates/template.html | normal gg + autocmd BufNewFile *.css 0read ~/.config/nvim/templates/template.css | normal G + autocmd BufNewFile *.scss 0read ~/.config/nvim/templates/template.css | normal G augroup END " }}} diff --git a/templates/template.css b/templates/template.css new file mode 100644 index 0000000..e190019 --- /dev/null +++ b/templates/template.css @@ -0,0 +1,15 @@ +html, +body { + padding: 0; + margin: 0; +} + +body { + font-size: 100%; + box-sizing: border-box; + background-color: pink; +} + +* { + box-sizing: inherit; +} diff --git a/templates/template.html b/templates/template.html new file mode 100644 index 0000000..cc39a5a --- /dev/null +++ b/templates/template.html @@ -0,0 +1,31 @@ + + + + + + + THE TITLE IS THIS! + + + + + + + + + + + + +
+
+ +
+
+ +
+
+ + + +