diff options
author | Jesse Luehrs <doy@tozt.net> | 2009-05-05 23:20:33 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2009-05-05 23:24:03 -0500 |
commit | 87c44d401104fb61a6f5787a64ac21a4f75f9450 (patch) | |
tree | cac3b8025e4fa5245f17ff977d8a79d2677a4b54 /vim/after | |
parent | 08a22ec4418afebb0b41e438e4c738a3f373a02b (diff) | |
download | conf-87c44d401104fb61a6f5787a64ac21a4f75f9450.tar.gz conf-87c44d401104fb61a6f5787a64ac21a4f75f9450.zip |
update moose_snippets
Diffstat (limited to 'vim/after')
-rw-r--r-- | vim/after/ftplugin/moose_snippets.vim | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/vim/after/ftplugin/moose_snippets.vim b/vim/after/ftplugin/moose_snippets.vim index a8c2f69..7b35cf5 100644 --- a/vim/after/ftplugin/moose_snippets.vim +++ b/vim/after/ftplugin/moose_snippets.vim @@ -1,16 +1,21 @@ " See http://www.vim.org/scripts/script.php?script_id=1318 -" Written by Sartak, feel free to add your own! +" Written by Sartak and doy, feel free to add your own! if !exists('loaded_snippet') || &cp finish endif -function RemoveEmptySuperClass() +function! RemoveEmptySuperClass() s/^extends '<{}>';\n//e return @z endfun -function Snippet(abbr, str) +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")) endif @@ -23,7 +28,7 @@ function Snippet(abbr, str) exec 'Snippet '.a:abbr.' '.str endfunction -function SnippetFile(filename) +function! SnippetFile(filename) let abbr = fnamemodify(a:filename, ':t:r') let str = readfile(a:filename) return Snippet(abbr, str) @@ -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}> {", @@ -66,7 +71,7 @@ call Snippet('sub', [ \"}"]) call Snippet('around', [ \"around <{name}> => sub {", - \ "my $orig = shift;", + \ "my $<{next}> = shift;", \ "my $self = shift;", \ "<{}>", \"};"]) |