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.

106 lines
2.0 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|:numericality " $_xSnipName => true
  16. XSET bool=true`^
  17. `:key({ 'val' : 'bool' }):^
  18. " eRuby attribute snippets
  19. XPT : " :key => val
  20. XSET val=Echo('')
  21. :`key^ => `val^
  22. XPT key hidden " $_xSnipName => val
  23. XSET val=Echo('')
  24. `$_xSnipName^ => `val^
  25. XPT :cols synonym=:rows|:size|:maxsize|:null|:url " $_xSnipName => val
  26. `:key:^
  27. XPT :object synonym=:collection|:locals|:layout|:method " $_xSnipName => val
  28. `:key:^
  29. XPT :id synonym=:class|:alt|:title|:action|:controller|:to " $_xSnipName => 'val'
  30. XSET str='`val^'
  31. `:key({ 'val' : 'str' }):^
  32. XPT :selected synonym=:multipart " $_xSnipName => true
  33. XSET bool=true`^
  34. `:key({ 'val' : 'bool' }):^
  35. XPT :html alias=key
  36. XSET val={ `html^ }
  37. XPT :media alias=key
  38. XSET val='`screen^'
  39. XPT image_tag synonym=imt " image_tag...
  40. image_tag('`filename^'`, `opt?^)
  41. XPT loop wrap=content synonym=lambda " $_xSnipName args? do .. end
  42. XSET content=Echo('')
  43. `$_xSnipName^` `args^ do
  44. ` `content^
  45. end
  46. XPT doe abbr " do .. end
  47. do
  48. `cursor^
  49. end
  50. XPT pid " params[:id]
  51. params[:id]
  52. " Rails 3 Stuff
  53. XPT match " match '/path', :to => ...
  54. XSET path=Echo('')
  55. match '`path^', :to => '`controller#method^'
  56. XPT flash " flash[:class]...
  57. flash[:`error^] = "`message^"
  58. XPT fln abbr " flash.now[:class]...
  59. flash.now[:`error^] = "`message^"
  60. " RSpec snippets
  61. XPT describe synonym=it|test alias=loop
  62. XSET args="`^"
  63. XPT resp abbr
  64. response.
  65. XPT :content synonym=:cnt " :content => "val"
  66. :content => `^
  67. XPT shd abbr " should ...
  68. should `^
  69. XPT shn abbr " should_not ...
  70. should_not `^
  71. XPT shb abbr " should be_
  72. should be_
  73. XPT shnb abbr " should_not be_
  74. should_not be_
  75. XPT hvs abbr
  76. have_selector(`^)