From 9eb9a2dc9fac1d58ac3c19f11d83cdd46dda1afe Mon Sep 17 00:00:00 2001 From: katherine Date: Fri, 20 Dec 2019 23:00:25 -0700 Subject: add ultisnips --- .vim/UltiSnips/c.snippets | 37 ++++++++ .vim/UltiSnips/elixir.snippets | 7 ++ .vim/UltiSnips/html.snippets | 189 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 233 insertions(+) create mode 100644 .vim/UltiSnips/c.snippets create mode 100644 .vim/UltiSnips/elixir.snippets create mode 100644 .vim/UltiSnips/html.snippets 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 + + +endsnippet + +snippet a "Link" w +${4:Anchor Text} +endsnippet + +snippet abbr "" w +$1 +endsnippet + +snippet address "
" w +
$1
+endsnippet + +snippet article "
" +
+ ${1:article content} +
+endsnippet + +snippet aside "