wiki:PadrePluginSnippet

Version 18 (modified by azawawi, 2 years ago) (diff)

--

Padre::Plugin::Snippet

Notes

  • Snippet mode can be entered through <trigger><TAB>
  • <trigger> should be matched on a word boundary that ends with the current position
  • Shift-TAB traverses all variables (circular is a useful snipMate feature). Does not break snippet mode.
  • Movement keys and deletion: Up/down/right/left/page up/page down/home/end/delete automatically exit snippet mode
  • Cancel current selection when exiting snippet mode

Sample snippet file

---
#
# Moose snippets bundle for Padre::Plugin::Moose
# Written by Ahmad M. Zawawi (azawawi)
#
# Adapted from 'TextMate Bundle for Moose' by Chris Prather (perigrin)
# https://github.com/perigrin/perl-moose.tmbundle/Snippets
# 

# after method modifier
after: |
  after '${1:method_name}' => sub {
      ${2:# body...}
  }; 

# before method modifier
before: |
  before '${1:method_name}' => sub {
      ${2:# body...}
  }; 

# Property
has: has '${1:property}' => ( is => '${2:rw}', isa  => '${3:Str}', );

TODO

  • Support extended syntax ${index:default_value:list_of_values}
  • Support predefined special variables inside default_value
  • Import snipMate snippets facility
  • Import TextMate snippets facility
  • Add mojo HTML snippet to the mix Template
  • Support a way to change the current subscope
  • Detect whether we're __DATA__ or not (to do some interesting mimetype things to Mojo HTML stuff

Resources


__END__

Attachments