Add vim/moose_snippets.vim
Shawn M Moore [Mon, 4 May 2009 16:57:24 +0000 (12:57 -0400)]
vim/moose_snippets.vim [new file with mode: 0644]

diff --git a/vim/moose_snippets.vim b/vim/moose_snippets.vim
new file mode 100644 (file)
index 0000000..ceefb90
--- /dev/null
@@ -0,0 +1,16 @@
+" See http://www.vim.org/scripts/script.php?script_id=1318
+" Written by Sartak, feel free to add your own!
+
+if !exists('loaded_snippet') || &cp
+    finish
+endif
+
+let st = g:snip_start_tag
+let et = g:snip_end_tag
+let cd = g:snip_elem_delim
+
+exec "Snippet class package ".st."ClassName".et.";<CR>use Moose;<CR><CR>".st.et."<CR><CR>__PACKAGE__->meta->make_immutable;<CR>no Moose;<CR><CR>1;<CR>"
+exec "Snippet has has ".st."attr".et." => (<CR>is => 'rw',<CR>isa => 'Str',<CR>".st.et."<CR>);"
+exec "Snippet hasl has ".st."attr".et." => (<CR>is => 'rw',<CR>isa => 'Str',<CR>lazy_build => 1,<CR>);<CR><CR>sub _build_".st."attr".et." {<CR>my $self = shift;<CR>".st.et."<CR>}<CR><CR>"
+exec "Snippet sub sub ".st."name".et." {<CR>my $self = shift;<CR>".st.et."<CR>}<CR>"
+