Completion/templating snippets for XPTemplate vim plugin
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

79 lines
1.5 KiB

  1. "
  2. "
  3. XPTemplate priority=personal+
  4. XPT def " def .. end
  5. XSET action=Echo(' ')
  6. def `method^`
  7. `action^
  8. end
  9. XPT attr " attr_**
  10. XSET what=Choose(["accessible","protected","accessor","reader","writer"])
  11. XSET attr*|post=ExpandIfNotEmpty(', :', 'attr*')
  12. attr`_`what^ :`attr*^
  13. XPT validates " validates :attr ...
  14. validates :`attr^, `^
  15. XPT :presence synonym=:uniqueness|:acceptance|:confirmation|:numericallity " $_xSnipName => true
  16. XSET bool=true`^
  17. `:key({ 'val' : 'bool' }):^
  18. " eRuby attribute snippets
  19. XPT key hidden " $_xSnipName => val
  20. XSET val=Echo('')
  21. `$_xSnipName^ => `val^
  22. XPT :cols synonym=:rows|:size|:maxsize|:null|:url " $_xSnipName => val
  23. `:key:^
  24. XPT :object synonym=:collection|:locals|:layout|:method " $_xSnipName => val
  25. `:key:^
  26. XPT :id synonym=:class|:alt|:title|:action|:controller|:to " $_xSnipName => 'val'
  27. XSET str='`val^'
  28. `:key({ 'val' : 'str' }):^
  29. XPT :selected synonym=:multipart " $_xSnipName => true
  30. XSET bool=true`^
  31. `:key({ 'val' : 'bool' }):^
  32. XPT :html alias=key
  33. XSET val={ `html^ }
  34. XPT :media alias=key
  35. XSET val='`screen^'
  36. XPT image_tag synonym=imt " image_tag...
  37. image_tag('`filename^'`, `opt?^)
  38. " RSpec snippets
  39. XPT loop " $_xSnipName args? do .. end
  40. XSET content=Echo('')
  41. `$_xSnipName^` `args^ do
  42. ` `content^
  43. end
  44. XPT describe synonym=it alias=loop
  45. XSET args="`^"
  46. XPT resp
  47. response.
  48. XPT :content " $_xSnipName => "val"
  49. `:key:^
  50. XPT shd abbr " should ...
  51. should `^
  52. XPT shn abbr " should_not ...
  53. should_not `^
  54. XPT shb abbr " should be_
  55. should be_
  56. XPT shnb abbr " should_not be_
  57. should_not be_