Remove the empty line in "has" and "hasl" if you just tab out
Shawn M Moore [Tue, 5 May 2009 17:13:38 +0000 (13:13 -0400)]
vim/moose_snippets.vim

index a8c2f69..4f9a8c1 100644 (file)
@@ -10,6 +10,11 @@ function RemoveEmptySuperClass()
     return @z
 endfun
 
+function RemoveEmptyLine()
+    s/^\s*<{}>\s*\n//e
+    return @z
+endfun
+
 function Snippet(abbr, str)
     if type(a:str) == type([])
         return Snippet(a:abbr, join(a:str, "\n"))
@@ -45,14 +50,14 @@ call Snippet('has', [
             \"has <{attr}> => (",
             \    "is  => '<{rw}>',",
             \    "isa => '<{Str}>',",
-            \    "<{}>",
+            \    "<{options:RemoveEmptyLine()}>",
             \");"])
 call Snippet('hasl', [
             \"has <{attr}> => (",
             \    "is         => '<{rw}>',",
             \    "isa        => '<{Str}>',",
             \    "lazy_build => 1,",
-            \    "<{}>",
+            \    "<{options:RemoveEmptyLine()}>",
             \");",
             \"",
             \"sub _build_<{attr}> {",