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.

102 lines
1.9 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. XPT loop wrap=content synonym=lambda " $_xSnipName args? do .. end
  39. XSET content=Echo('')
  40. `$_xSnipName^` `args^ do
  41. ` `content^
  42. end
  43. XPT doe abbr " do .. end
  44. do
  45. `cursor^
  46. end
  47. XPT pid " params[:id]
  48. params[:id]
  49. " Rails 3 Stuff
  50. XPT match " match '/path', :to => ...
  51. XSET path=Echo('')
  52. match '`path^', :to => '`controller#method^'
  53. XPT flash " flash[:class]...
  54. flash[:`error^] = "`message^"
  55. XPT fln abbr " flash.now[:class]...
  56. flash.now[:`error^] = "`message^"
  57. " RSpec snippets
  58. XPT describe synonym=it alias=loop
  59. XSET args="`^"
  60. XPT resp abbr
  61. response.
  62. XPT :content synonym=:cnt " :content => "val"
  63. :content => `^
  64. XPT shd abbr " should ...
  65. should `^
  66. XPT shn abbr " should_not ...
  67. should_not `^
  68. XPT shb abbr " should be_
  69. should be_
  70. XPT shnb abbr " should_not be_
  71. should_not be_
  72. XPT hvs abbr
  73. have_selector(`^)