From: Daniel Liu Date: Thu, 18 Mar 2021 04:14:57 +0000 (-0400) Subject: more snippets X-Git-Url: https://git.danieliu.xyz/?a=commitdiff_plain;h=339415291a788dafe60c6e2503220e0482c44bf1;p=dotfiles.git more snippets --- diff --git a/.vim/mysnippets/all.snippets b/.vim/mysnippets/all.snippets index 6a9059a..f33f5bd 100644 --- a/.vim/mysnippets/all.snippets +++ b/.vim/mysnippets/all.snippets @@ -2,11 +2,22 @@ snippet today "Today" w `date +"%A, %B %d"` endsnippet -snippet '([0-9]+)->([0-9]+)' "enumerate list" rw +snippet '([0-9]+)(,[0-9]+)?..([0-9]+)' "enumerate nums" rw `!p +# doesn't quite work with counting down yet start = int(match.group(1)) -end = int(match.group(2)) -for i in range(start, end+1): +end = int(match.group(3)) +rng = range(start, end+1) if match.group(2) == None else range(start, end+1, int(match.group(2)[1:])-start) +for i in rng: snip.rv += str(i)+"\n" ` endsnippet + +snippet '([a-z])\)..([a-z])\)' "enumerate list" rw +`!p +start = ord(match.group(1)) +end = ord(match.group(2)) +for i in range(start, end+1): + snip.rv += chr(i)+")\n" +` +endsnippet diff --git a/.vim/mysnippets/html.snippets b/.vim/mysnippets/html.snippets index 0a508e5..52c6e0a 100644 --- a/.vim/mysnippets/html.snippets +++ b/.vim/mysnippets/html.snippets @@ -1,6 +1,6 @@ -snippet `<[a-z]+[0-9]*` "HTML tag expand" r -<`!p snip.rv = match.group()[1:]`>$0 -endsnippet +# snippet `<[a-z]+[0-9]*` "HTML tag expand" r +# <`!p snip.rv = match.group()[1:]`>$0 +# endsnippet snippet html "html template" w @@ -15,3 +15,40 @@ snippet html "html template" w endsnippet + +snippet p "p tag" w +

$0

+endsnippet + +snippet div "div tag" w +
$0
+endsnippet + +snippet a "a tag" w +$0 +endsnippet + +snippet code "code tag" w +$0 +endsnippet + +snippet img "img tag" w + +endsnippet + +snippet '(h[0-9])' "h tag" rw +`!p +snip.rv = "<{0}>".format(match.group(1)) +` +endsnippet + +snippet bigcode "bigcode block" w +

+$0
+
+endsnippet + +snippet tag "html safe tag" w +<$1>$0</$1> +endsnippet + diff --git a/.vimrc b/.vimrc index df16a5d..e68fc91 100644 --- a/.vimrc +++ b/.vimrc @@ -15,6 +15,7 @@ set encoding=utf-8 set tabstop=4 set shiftwidth=4 set expandtab +set nrformats+=alpha "inc/dec alpha set hidden " spell check