Skip to content

Commit

Permalink
Update snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
aalvarado committed Mar 10, 2021
1 parent c072ca8 commit 23dfae6
Show file tree
Hide file tree
Showing 9 changed files with 197 additions and 90 deletions.
23 changes: 0 additions & 23 deletions all.snippets
Original file line number Diff line number Diff line change
@@ -1,23 +0,0 @@
snippet ( "parens" i
(${1}${VISUAL})
endsnippet

snippet { "parens" i
{ ${1}${VISUAL} }
endsnippet

snippet [ "square brackets" i
[${1}${VISUAL}]
endsnippet

snippet " "double quotes" i
"${1}${VISUAL}"${2}
endsnippet

snippet ' "quotes" i
'${1}${VISUAL}'${2}
endsnippet

snippet ` "backquotes" i
\`${1}${VISUAL}\`${2}
endsnippet
54 changes: 21 additions & 33 deletions eruby.snippets
Original file line number Diff line number Diff line change
@@ -1,22 +1,4 @@
snippet d "div"
<div${1}>
${2}${VISUAL}
</div>$0
endsnippet

snippet dc "div"
<div class="${1}">
${2}${VISUAL}
</div>$0
endsnippet

snippet c= "css class"
class="${1}"
endsnippet

snippet i= "css class"
id="${1}"
endsnippet
extends html

snippet = "ruby output"
<%= ${VISUAL}${1} %>
Expand All @@ -30,30 +12,23 @@ snippet end "<% end %>"
<% end %>
endsnippet

snippet li "<li> tag"
<li>
${1}
</li>${2}
endsnippet

snippet if "if"
<% if ${1} %>
${VISUAL}${2}
<% end %>${3}
endsnippet

snippet else "else"
<% else %>
$0
endsnippet

snippet unless "unless"
<% unless ${1} %>
${VISUAL}${2}
<% end %>${3}
endsnippet

snippet script "script tag"
<script>
${VISUAL}${1}
</script>
endsnippet

snippet each "each"
<% ${1}.each do |${2}| %>
${VISUAL}$0
Expand All @@ -70,6 +45,19 @@ snippet render "render"
<%= render ${1} %>
endsnippet

snippet <% "eruby tag" A
<%${1} %>
snippet <%= "eruby tag" Ai
<%= ${VISUAL}${1} %>
endsnippet

snippet # "surround hash #" i
#{${VISUAL}}
endsnippet

snippet at "amp-trunc"
<amp-truncate-text layout="fixed-height" height="8em">
${VISUAL}$0
<button slot="collapsed">
See more ∨
</button>
</amp-truncate-text>
endsnippet
74 changes: 71 additions & 3 deletions html.snippets
Original file line number Diff line number Diff line change
@@ -1,5 +1,73 @@
snippet c= "css class"
class="${1}"
endsnippet

snippet i= "css class"
id="${1}"
endsnippet

snippet p "paragraph"
<p>
${VISUAL}$0
</p>
endsnippet

snippet d "div"
<div>
${VISUAL}
</div>
<div>
${VISUAL}${1}
</div>
endsnippet

snippet di "div"
<div id="${1}">
${VISUAL}${2}
</div>
endsnippet

snippet dc "div"
<div class="${1}">
${VISUAL}${2}
</div>
endsnippet

snippet li "<li> tag"
<li>
${1}
</li>${2}
endsnippet

snippet html5 "html5 template"
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>${1}</title>
<meta name="description" content="${2}">
<meta name="author" content="${3}">
<link rel="stylesheet" href="css/main.css" />
</head>
<body>
$0
</body>
</html>
endsnippet

snippet script "script"
<script src="${1:js/main.js}"></script>$0
endsnippet

snippet link "link stylsheet"
<link rel="stylesheet" href="${1}" />
endsnippet

snippet iscript "inline script"
<script>
${VISUAL}${0}
</script>
endsnippet

snippet "<([\w\.]+)" "html tag" br
<`!p snip.rv = match.group(1)`${1}>
${VISUAL}${2}
</`!p snip.rv = match.group(1)`>${3}
endsnippet
82 changes: 58 additions & 24 deletions javascript.snippets
Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
snippet fun "function" i
function${1}(${2}) {
${3}${VISUAL}
}${4}
endsnippet

snippet fn "function" i
function${1}(${2}) {
${3}${VISUAL}
}${4}
endsnippet

snippet cl "console log" b
console.log(${1}${VISUAL})${2}
console.log(${1}${VISUAL});$0
endsnippet

snippet if "if" w
if (${1}) {
${2}${VISUAL}
}${3}
${VISUAL}${2}
}$0
endsnippet

snippet iif "inline if"
Expand All @@ -29,25 +17,71 @@ var ${1} = ${2};${3}
endsnippet

snippet for "for loop"
for(${1}; ${2}; $1++) {
${4}
}${5}
for (let ${1} = 0; $1 <= ${2}; $1++) {
${VISUAL}${3}
}$0
endsnippet

snippet desc "describe block"
describe('${1}', () => {
${2}${VISUAL}
})${3}
${VISUAL}${2}
});$0
endsnippet

snippet it "it block"
it('${1}', () => {
${2}${VISUAL}
})${3}
${VISUAL}${2}
});$0
endsnippet

snippet before "before block"
before(() => {
${1}${VISUAL}
})${2}
${VISUAL}${1}
});$0
endsnippet

snippet switch "switch case"
switch(${1}) {
default:
return ${2}
}
endsnippet

snippet case "case"
case ${1}:
$0
endsnippet

snippet fun "function"
function $0
endsnippet

snippet af "arrow-function"
(${1}) => $0
endsnippet

snippet "<((\w+).*)>" "Generic Tag" r
<`!p snip.rv = match.group(1)`>
${VISUAL}${1}
</`!p snip.rv = match.group(2)`>
endsnippet

snippet let "let"
let ${1} = ${2};$0
endsnippet

snippet const "const"
const ${1} = $2;$0
endsnippet

snippet try "try"
try {
${VISUAL}${2}
}$0
endsnippet

snippet catch ""
catch {
${VISUAL}${2}
}$0
endsnippet
1 change: 1 addition & 0 deletions javascriptreact.snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extends jsx, javascript
5 changes: 5 additions & 0 deletions jsx.snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
snippet "<([\w\.]+)" "jsx tag" br
<`!p snip.rv = match.group(1)`${1}>
${VISUAL}${2}
</`!p snip.rv = match.group(1)`>${3}
endsnippet
2 changes: 2 additions & 0 deletions rails.snippets
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
extends ruby

snippet b.p "binding.pry"
binding.pry
endsnippet
Expand Down
31 changes: 24 additions & 7 deletions ruby.snippets
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
snippet def "def" b
def ${1}
${2}${VISUAL}
end${3}
endsnippet

snippet desc "describe block"
describe '${1}' do
${2}${VISUAL}
Expand Down Expand Up @@ -33,7 +27,13 @@ endsnippet
snippet do "do block"
do${1}
${2}${VISUAL}
end${3}
end$0
endsnippet

snippet def "def"
def ${1}
${VISUAL}${2}
end$0
endsnippet

snippet ilet "inline let block"
Expand Down Expand Up @@ -73,3 +73,20 @@ def initialize${1}
${VISUAL}$0
end
endsnippet

snippet begin "begin block"
begin
${VISUAL}$0
end
endsnippet

snippet rescue "rescue statement"
rescue ${1:StandardError}
${VISUAL}$0
endsnippet

snippet if "if"
if ${1}
${VISUAL}$2
end$0
endsnippet
15 changes: 15 additions & 0 deletions scss.snippets
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
snippet lh "line-height"
line-height: ${1};$0
endsnippet

snippet @m "@media()"
@media (${1}) {
${VISUAL}
$0
}
endsnippet

snippet bc "background-color"
background-color: ${1};$0
endsnippet

snippet tac "text-align: center;"
text-align: center;
endsnippet

0 comments on commit 23dfae6

Please sign in to comment.