aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkatherine <ageha@airen-no-jikken.icu>2019-12-20 23:00:25 -0700
committerkatherine <ageha@airen-no-jikken.icu>2019-12-20 23:00:25 -0700
commit9eb9a2dc9fac1d58ac3c19f11d83cdd46dda1afe (patch)
treef0d0587c477c035fb28b3f20d015b0b68a0dc862
parent1dd672f5bbd53b092137adee070fe7eac9f33e0d (diff)
downloaddotfiles-9eb9a2dc9fac1d58ac3c19f11d83cdd46dda1afe.tar.gz
add ultisnips
-rw-r--r--.vim/UltiSnips/c.snippets37
-rw-r--r--.vim/UltiSnips/elixir.snippets7
-rw-r--r--.vim/UltiSnips/html.snippets189
3 files changed, 233 insertions, 0 deletions
diff --git a/.vim/UltiSnips/c.snippets b/.vim/UltiSnips/c.snippets
new file mode 100644
index 0000000..3fcf3a3
--- /dev/null
+++ b/.vim/UltiSnips/c.snippets
@@ -0,0 +1,37 @@
+priority -50
+
+snippet ndf "#ifndef ... #define ... #endif"
+#ifndef ${1/([A-Za-z0-9_]+).*/$1/}
+#define ${1:SYMBOL} val
+#endif
+endsnippet
+
+snippet main "main() (main)"
+int main(int argc, char **argv)
+{
+ ${VISUAL}$0
+ return 0;
+}
+endsnippet
+
+snippet ig "include guard"
+`!p
+if not snip.c:
+ name = re.sub(r'[^A-Za-z0-9]+','_', fn).upper()
+ fpath = os.path.abspath(path)
+ val = ''
+ if (os.path.basename(os.path.dirname(fpath)) == 'src'):
+ dname = os.path.dirname(os.path.dirname(fpath))
+ dname = os.path.basename(dname)
+ dname = re.sub(r'[^A-Za-z0-9]+','_', dname).upper()
+ val = ('%s_%s' % (dname,name))
+ else:
+ val = name
+ snip.rv = '#ifndef ' + val + '\n#define ' + val
+else:
+ snip.rv = snip.c`
+
+${VISUAL}$0
+
+#endif
+endsnippet
diff --git a/.vim/UltiSnips/elixir.snippets b/.vim/UltiSnips/elixir.snippets
new file mode 100644
index 0000000..6c90508
--- /dev/null
+++ b/.vim/UltiSnips/elixir.snippets
@@ -0,0 +1,7 @@
+priority -50
+
+snippet do "do ... end"
+do
+ ${VISUAL}$0
+end
+endsnippet
diff --git a/.vim/UltiSnips/html.snippets b/.vim/UltiSnips/html.snippets
new file mode 100644
index 0000000..73983a7
--- /dev/null
+++ b/.vim/UltiSnips/html.snippets
@@ -0,0 +1,189 @@
+priority -50
+
+global !p
+def x(snip):
+ if snip.ft.startswith("x"):
+ snip.rv = '/'
+ else:
+ snip.rv = ""
+endglobal
+
+snippet doctype "HTML - 5.0 (doctype)" b
+<!DOCTYPE html>
+
+endsnippet
+
+snippet a "Link" w
+<a href="${1:http://www.${2:url.com}}"${3: target="_blank"}>${4:Anchor Text}</a>
+endsnippet
+
+snippet abbr "<abbr>" w
+<abbr title="$2">$1</abbr>
+endsnippet
+
+snippet address "<address>" w
+<address>$1</address>
+endsnippet
+
+snippet article "<article>"
+<article>
+ ${1:article content}
+</article>
+endsnippet
+
+snippet aside "<aside>"
+<aside>
+ ${1:aside content}
+</aside>
+endsnippet
+
+snippet base "HTML <base>" w
+<base href="$1"${2: target="$3"}`!p x(snip)`>
+endsnippet
+
+snippet blockquote "<blockquote>"
+<blockquote>$1</blockquote>
+endsnippet
+
+snippet body "<body>"
+<body>
+ ${0:${VISUAL}}
+</body>
+endsnippet
+
+snippet button "<button>"
+<button>$1</button>
+endsnippet
+
+snippet caption "<caption>"
+<caption>$1</caption>
+endsnippet
+
+snippet cite "<cite>" w
+<cite>$1</cite>
+endsnippet
+
+snippet dfn "<dfn>" w
+<dfn>$1</dfn>
+endsnippet
+
+snippet div "<div>" w
+<div>
+ ${0:${VISUAL}}
+</div>
+endsnippet
+
+snippet fig "<figure>"
+<figure>
+$1
+<figcaption>$2</figcaption>
+</figure>
+endsnippet
+
+snippet figcaption "<figcaption>"
+<figcaption>$1</figcaption>
+endsnippet
+
+snippet footer "<footer>"
+<footer>
+ ${1:footer content}
+</footer>
+endsnippet
+
+snippet h1 "HTML <h1>" w
+<h1>${0:${VISUAL}}</h1>
+endsnippet
+
+snippet h2 "HTML <h2>" w
+<h2>${0:${VISUAL}}</h2>
+endsnippet
+
+snippet h3 "HTML <h3>" w
+<h3>${0:${VISUAL}}</h3>
+endsnippet
+
+snippet h4 "HTML <h4>" w
+<h4>${0:${VISUAL}}</h4>
+endsnippet
+
+snippet h5 "HTML <h5>" w
+<h5>${0:${VISUAL}}</h5>
+endsnippet
+
+snippet h6 "HTML <h6>" w
+<h6>${0:${VISUAL}}</h6>
+endsnippet
+
+snippet head "HTML <head>"
+<head>
+ <meta charset="utf-8">
+ <title>${1:`!p snip.rv = snip.basename or "Page Title"`}</title>
+ ${0:${VISUAL}}
+</head>
+endsnippet
+
+snippet header "<header>"
+<header>
+ ${1:header content}
+</header>
+endsnippet
+
+snippet html "HTML basic structure" b
+<!DOCTYPE html>
+<html lang="en-GB">
+ <head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width" />
+ <title>${1:`!p snip.rv = snip.basename.replace('-', ' ').capitalize()`}</title>
+ </head>
+ <body>
+ ${0:body}
+ </body>
+</html>
+endsnippet
+
+snippet li "list item" w
+<li>${0:${VISUAL}}</li>
+endsnippet
+
+snippet main "<main>"
+<main>
+ ${1:main content}
+</main>
+endsnippet
+
+snippet nav "<nav>"
+<nav>
+ ${1:navigation links}
+</nav>
+endsnippet
+
+snippet p "paragraph" w
+<p>${0:${VISUAL}}</p>
+endsnippet
+
+snippet script "HTML <script>" w
+<script charset="utf-8">
+ ${0:${VISUAL}}
+</script>
+endsnippet
+
+snippet span "<span>" w
+<span>${0:${VISUAL}}</span>
+endsnippet
+
+snippet style "HTML <style>" w
+<style type="text/css" media="screen">
+ ${0:${VISUAL}}
+</style>
+endsnippet
+
+snippet title "HTML <title>" w
+<title>${1:`!p snip.rv = snip.basename or "Page Title"`}</title>
+endsnippet
+
+snippet ul "unordered list" w
+<ul>
+ ${0:${VISUAL}}
+</ul>
+endsnippet