From 87a0450300d894fd37a83b392e80aacda120ad15 Mon Sep 17 00:00:00 2001 From: ujihisa Date: Tue, 25 Jun 2013 20:43:18 -0700 Subject: [PATCH] Improved sh, python, and clojure snip. --- autoload/neosnippet/snippets/clojure.snip | 4 +++ autoload/neosnippet/snippets/python.snip | 4 +++ autoload/neosnippet/snippets/sh.snip | 38 ++++++++++++++++++----- doc/neosnippet.txt | 3 ++ 4 files changed, 42 insertions(+), 7 deletions(-) diff --git a/autoload/neosnippet/snippets/clojure.snip b/autoload/neosnippet/snippets/clojure.snip index bf50deb..11882f7 100644 --- a/autoload/neosnippet/snippets/clojure.snip +++ b/autoload/neosnippet/snippets/clojure.snip @@ -26,3 +26,7 @@ options head ] +snippet warn +options head + (binding [*out* *err*] + (println ${0:TARGET})) diff --git a/autoload/neosnippet/snippets/python.snip b/autoload/neosnippet/snippets/python.snip index dc192fd..0811f61 100644 --- a/autoload/neosnippet/snippets/python.snip +++ b/autoload/neosnippet/snippets/python.snip @@ -77,6 +77,7 @@ options head snippet ifmain abbr if __name__ == '__main__': ... +alias main options head if __name__ == '__main__': ${0:TARGET} @@ -113,3 +114,6 @@ snippet filter abbr [x for x in {list} if {condition}] [$1 for ${1:x} in ${2:#:list} if ${3:#:condition}] +snippet print +options word + print(${0:TARGET}) diff --git a/autoload/neosnippet/snippets/sh.snip b/autoload/neosnippet/snippets/sh.snip index a221c59..18fb0c6 100644 --- a/autoload/neosnippet/snippets/sh.snip +++ b/autoload/neosnippet/snippets/sh.snip @@ -32,13 +32,6 @@ snippet until done -snippet case - case ${1:#:word} in - ${2:#:pattern} ) - ${0} - ;; - esac - snippet here alias h <<${1} @@ -62,4 +55,35 @@ alias func ${0:TARGET} } +snippet match-regexp +abbr =~ +options head + if [[ $${1:string} =~ ${2:^regexp.*} ]]; then + ${0} + fi +snippet assign +abbr var-assign +options head + ${1:name}="${2:something}" + +snippet case +options head + case "$${1:{name}}" in + ${2:pattern*}) + ${0} + ;; + *) + ${3:echo "$$1\} Didn't match anything"} + esac + +snippet warn +options head + echo "${0:TARGET}" 1>&2 + +snippet abort +options head + echo "${0:TARGET}" 1>&2 + exit 1 + +# vim: set noexpandtab : diff --git a/doc/neosnippet.txt b/doc/neosnippet.txt index af19bd5..7655187 100755 --- a/doc/neosnippet.txt +++ b/doc/neosnippet.txt @@ -722,6 +722,9 @@ A: You can use |:NeoSnippetSource| for it. ============================================================================== CHANGELOG *neosnippet-changelog* +2013-06-25 +- Improved sh, python, and clojure snip. + 2013-06-18 - Improved ruby snip.