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.

108 lines
2.0 KiB

  1. "
  2. "
  3. XPTemplate priority=personal+
  4. XPT def abbr " def .. end
  5. def `cursor^
  6. end
  7. XPT if " if .. end
  8. if `cursor^
  9. end
  10. XPT attr " attr_**
  11. XSET what=Choose(["accessible","protected","accessor","reader","writer"])
  12. XSET attr*|post=ExpandIfNotEmpty(', :', 'attr*')
  13. attr`_`what^ :`attr*^
  14. XPT validates " validates :attr ...
  15. validates :`attr^, `^
  16. XPT :presence synonym=:uniqueness|:acceptance|:confirmation|:numericality " $_xSnipName => true
  17. XSET bool=true`^
  18. `:key({ 'val' : 'bool' }):^
  19. " eRuby attribute snippets
  20. XPT : " :key => val
  21. XSET val=Echo('')
  22. :`key^ => `val^
  23. XPT key hidden " $_xSnipName => val
  24. XSET val=Echo('')
  25. `$_xSnipName^ => `val^
  26. XPT :cols synonym=:rows|:size|:maxsize|:null|:url " $_xSnipName => val
  27. `:key:^
  28. XPT :object synonym=:collection|:locals|:layout|:method " $_xSnipName => val
  29. `:key:^
  30. XPT :id synonym=:class|:alt|:title|:action|:controller|:to " $_xSnipName => 'val'
  31. XSET str='`val^'
  32. `:key({ 'val' : 'str' }):^
  33. XPT :selected synonym=:multipart " $_xSnipName => true
  34. XSET bool=true`^
  35. `:key({ 'val' : 'bool' }):^
  36. XPT :html alias=key
  37. XSET val={ `html^ }
  38. XPT :media alias=key
  39. XSET val='`screen^'
  40. XPT image_tag synonym=imt " image_tag...
  41. image_tag('`filename^'`, `opt?^)
  42. XPT loop synonym=lambda " $_xSnipName args? do .. end
  43. XSET content=Echo('')
  44. `$_xSnipName^` `args^ do
  45. ` `cursor^
  46. end
  47. XPT doe abbr " do .. end
  48. do
  49. `cursor^
  50. end
  51. XPT pid " params[:id]
  52. params[:id]
  53. " Rails 3 Stuff
  54. XPT match " match '/path', :to => ...
  55. XSET path=Echo('')
  56. match '`path^', :to => '`controller#method^'
  57. XPT flash " flash[:class]...
  58. flash[:`error^] = "`message^"
  59. XPT fln abbr " flash.now[:class]...
  60. flash.now[:`error^] = "`message^"
  61. " RSpec snippets
  62. XPT describe synonym=it|test alias=loop
  63. XSET args="`^"
  64. XPT resp abbr
  65. response.
  66. XPT :content synonym=:cnt " :content => "val"
  67. :content => `^
  68. XPT shd abbr " should ...
  69. should `^
  70. XPT shn abbr " should_not ...
  71. should_not `^
  72. XPT shb abbr " should be_
  73. should be_
  74. XPT shnb abbr " should_not be_
  75. should_not be_
  76. XPT hvs abbr " have_selector
  77. have_selector