diff --git a/extras/imported/html-mode/Smart returnindent for tag pairs.yasnippet b/extras/imported/html-mode/Smart returnindent for tag pairs.yasnippet index a8d44b4..3245079 100644 --- a/extras/imported/html-mode/Smart returnindent for tag pairs.yasnippet +++ b/extras/imported/html-mode/Smart returnindent for tag pairs.yasnippet @@ -3,6 +3,8 @@ # name: Special: Return Inside Empty Open/Close Tags # binding: RET # condition: (yas/html-between-tag-pair-p) +# type: command # -- - - $0 +(save-excursion + (newline-and-indent)) +(indent-according-to-mode) diff --git a/extras/imported/rails-mode/.yas-setup.el b/extras/imported/rails-mode/.yas-setup.el index e249de8..25ce42f 100644 --- a/extras/imported/rails-mode/.yas-setup.el +++ b/extras/imported/rails-mode/.yas-setup.el @@ -134,9 +134,14 @@ (and (yas/rails-root) (string-match "db/migrate/" default-directory))) +(defun yas/rails-activate-maybe + (when (yas/rails-root) + (set (make-local-variable 'yas/mode-symbol) 'rails-mode))) + (defadvice cd (after yas/rails-on-cd-activate activate) "Set `yas/mode-symbol' to `rails-mode' so that rails snippets -are recognized" +are recognized. Stolen from `rinari-mode' more or`' less." (setq yas/rails-root-cache nil) - (when (yas/rails-root) - (set (make-local-variable 'yas/mode-symbol) 'rails-mode))) + (yas/rails-activate-maybe)) + +(add-hook 'find-file-hook 'yas/rails-activate-maybe) diff --git a/extras/imported/rails-mode/Go To/Go To Alternate File.yasnippet b/extras/imported/rails-mode/Go To/Go To Alternate File.yasnippet index ca656b1..318e36b 100644 --- a/extras/imported/rails-mode/Go To/Go To Alternate File.yasnippet +++ b/extras/imported/rails-mode/Go To/Go To Alternate File.yasnippet @@ -2,6 +2,6 @@ # type: command # contributor: Translated from TextMate Snippet # name: Go to Controller -## binding: "~$@" -## condition: "text.html.ruby, source.ruby.rails.embedded.html, meta.rails.helper, meta.rails.functional_test, source.js, source.css, source.yaml, meta.rails.model, meta.rails.unit_test, text.haml" +# binding: C-c g c # -- +(call-interactively (find-file (concat (yas/rails-root) "/app/controllers"))) diff --git a/extras/imported/rails-mode/form_for f. drop-down list/form_for checkbox.yasnippet b/extras/imported/rails-mode/form_for f. drop-down list/form_for checkbox.yasnippet index f7bbb1f..0ff80a4 100644 --- a/extras/imported/rails-mode/form_for f. drop-down list/form_for checkbox.yasnippet +++ b/extras/imported/rails-mode/form_for f. drop-down list/form_for checkbox.yasnippet @@ -2,6 +2,6 @@ # key: f. # contributor: Translated from TextMate Snippet # name: f.check_box (ffcb) -## condition: "text.html.ruby, text.haml" +# condition: (yas/rails-view-p) # -- <%= f.check_box :${1:attribute} %> \ No newline at end of file diff --git a/extras/imported/rails-mode/form_for f. drop-down list/form_for file_field.yasnippet b/extras/imported/rails-mode/form_for f. drop-down list/form_for file_field.yasnippet index 86a334f..3aa050c 100644 --- a/extras/imported/rails-mode/form_for f. drop-down list/form_for file_field.yasnippet +++ b/extras/imported/rails-mode/form_for f. drop-down list/form_for file_field.yasnippet @@ -2,6 +2,6 @@ # key: f. # contributor: Translated from TextMate Snippet # name: f.file_field (ffff) -## condition: "text.html.ruby, text.haml" +# condition: (yas/rails-view-p) # -- <%= f.file_field :${1:attribute} %> \ No newline at end of file diff --git a/extras/imported/rails-mode/form_for f. drop-down list/form_for hidden_field.yasnippet b/extras/imported/rails-mode/form_for f. drop-down list/form_for hidden_field.yasnippet index 827bc26..89c0e0c 100644 --- a/extras/imported/rails-mode/form_for f. drop-down list/form_for hidden_field.yasnippet +++ b/extras/imported/rails-mode/form_for f. drop-down list/form_for hidden_field.yasnippet @@ -2,6 +2,6 @@ # key: f. # contributor: Translated from TextMate Snippet # name: f.hidden_field (ffhf) -## condition: "text.html.ruby, text.haml" +# condition: (yas/rails-view-p) # -- <%= f.hidden_field :${1:attribute} %> \ No newline at end of file diff --git a/extras/imported/rails-mode/form_for f. drop-down list/form_for label.yasnippet b/extras/imported/rails-mode/form_for f. drop-down list/form_for label.yasnippet index b4c468b..74c0868 100644 --- a/extras/imported/rails-mode/form_for f. drop-down list/form_for label.yasnippet +++ b/extras/imported/rails-mode/form_for f. drop-down list/form_for label.yasnippet @@ -2,6 +2,6 @@ # key: f. # contributor: Translated from TextMate Snippet # name: f.label (ffl) -## condition: "text.html.ruby, text.haml" +# condition: (yas/rails-view-p) # -- <%= f.label :${1:attribute}${2:, "${3:${1:$(capitalize (replace-regexp-in-string "_" " " yas/text))}}"} %> \ No newline at end of file diff --git a/extras/imported/rails-mode/form_for f. drop-down list/form_for password_field.yasnippet b/extras/imported/rails-mode/form_for f. drop-down list/form_for password_field.yasnippet index 60275f7..3f98def 100644 --- a/extras/imported/rails-mode/form_for f. drop-down list/form_for password_field.yasnippet +++ b/extras/imported/rails-mode/form_for f. drop-down list/form_for password_field.yasnippet @@ -2,6 +2,6 @@ # key: f. # contributor: Translated from TextMate Snippet # name: f.password_field (ffpf) -## condition: "text.html.ruby, text.haml" +# condition: (yas/rails-view-p) # -- <%= f.password_field :${1:attribute} %> \ No newline at end of file diff --git a/extras/imported/rails-mode/form_for f. drop-down list/form_for radio_box.yasnippet b/extras/imported/rails-mode/form_for f. drop-down list/form_for radio_box.yasnippet index 4b430c1..f26d775 100644 --- a/extras/imported/rails-mode/form_for f. drop-down list/form_for radio_box.yasnippet +++ b/extras/imported/rails-mode/form_for f. drop-down list/form_for radio_box.yasnippet @@ -2,6 +2,6 @@ # key: f. # contributor: Translated from TextMate Snippet # name: f.radio_box (ffrb) -## condition: "text.html.ruby, text.haml" +# condition: (yas/rails-view-p) # -- <%= f.radio_box :${1:attribute}, :${2:tag_value} %> \ No newline at end of file diff --git a/extras/imported/rails-mode/form_for f. drop-down list/form_for submit.yasnippet b/extras/imported/rails-mode/form_for f. drop-down list/form_for submit.yasnippet index f41553a..14652d2 100644 --- a/extras/imported/rails-mode/form_for f. drop-down list/form_for submit.yasnippet +++ b/extras/imported/rails-mode/form_for f. drop-down list/form_for submit.yasnippet @@ -1,7 +1,7 @@ # -*- mode: snippet -*- # key: f. # contributor: Translated from TextMate Snippet -# name: f.submit (ffs) -## condition: "text.html.ruby, text.haml" +# name: f.submit (ffs +# condition: (yas/rails-view-p) # -- <%= f.submit "${1:Submit}"${2:, :disable_with => '${3:$1ing...}'} %> \ No newline at end of file diff --git a/extras/imported/rails-mode/form_for f. drop-down list/form_for text_area.yasnippet b/extras/imported/rails-mode/form_for f. drop-down list/form_for text_area.yasnippet index e9366d3..97aa312 100644 --- a/extras/imported/rails-mode/form_for f. drop-down list/form_for text_area.yasnippet +++ b/extras/imported/rails-mode/form_for f. drop-down list/form_for text_area.yasnippet @@ -2,6 +2,6 @@ # key: f. # contributor: Translated from TextMate Snippet # name: f.text_area (ffta) -## condition: "text.html.ruby, text.haml" +# condition: (yas/rails-view-p) # -- <%= f.text_area :${1:attribute} %> \ No newline at end of file diff --git a/extras/imported/rails-mode/form_for f. drop-down list/form_for text_field.yasnippet b/extras/imported/rails-mode/form_for f. drop-down list/form_for text_field.yasnippet index c29dd1b..98b528c 100644 --- a/extras/imported/rails-mode/form_for f. drop-down list/form_for text_field.yasnippet +++ b/extras/imported/rails-mode/form_for f. drop-down list/form_for text_field.yasnippet @@ -2,6 +2,6 @@ # key: f. # contributor: Translated from TextMate Snippet # name: f.text_field (fftf) -## condition: "text.html.ruby, text.haml" +# condition: (yas/rails-view-p) # -- <%= f.text_field :${1:attribute} %> \ No newline at end of file diff --git a/extras/imported/rails-mode/form_for helpers/form_for check_box.yasnippet b/extras/imported/rails-mode/form_for helpers/form_for check_box.yasnippet index f041cdf..558ee95 100644 --- a/extras/imported/rails-mode/form_for helpers/form_for check_box.yasnippet +++ b/extras/imported/rails-mode/form_for helpers/form_for check_box.yasnippet @@ -2,6 +2,6 @@ # key: ffcb # contributor: Translated from TextMate Snippet # name: form_for check_box -## condition: "text.html.ruby, text.haml" +# condition: (yas/rails-view-p) # -- <%= f.check_box :${1:attribute} %> \ No newline at end of file diff --git a/extras/imported/rails-mode/form_for helpers/form_for file_field 2.yasnippet b/extras/imported/rails-mode/form_for helpers/form_for file_field 2.yasnippet index cfd3a22..9b09d0d 100644 --- a/extras/imported/rails-mode/form_for helpers/form_for file_field 2.yasnippet +++ b/extras/imported/rails-mode/form_for helpers/form_for file_field 2.yasnippet @@ -2,6 +2,6 @@ # key: ffff # contributor: Translated from TextMate Snippet # name: form_for file_field -## condition: "text.html.ruby, text.haml" +# condition: (yas/rails-view-p) # -- <%= f.file_field :${1:attribute} %> \ No newline at end of file diff --git a/extras/imported/rails-mode/form_for helpers/form_for hidden_field 2.yasnippet b/extras/imported/rails-mode/form_for helpers/form_for hidden_field 2.yasnippet index 19e5e3b..f57b09e 100644 --- a/extras/imported/rails-mode/form_for helpers/form_for hidden_field 2.yasnippet +++ b/extras/imported/rails-mode/form_for helpers/form_for hidden_field 2.yasnippet @@ -2,6 +2,6 @@ # key: ffhf # contributor: Translated from TextMate Snippet # name: form_for hidden_field -## condition: "text.html.ruby, text.haml" +# condition: (yas/rails-view-p) # -- <%= f.hidden_field :${1:attribute} %> \ No newline at end of file diff --git a/extras/imported/rails-mode/form_for helpers/form_for label 2.yasnippet b/extras/imported/rails-mode/form_for helpers/form_for label 2.yasnippet index 607c4df..570cbed 100644 --- a/extras/imported/rails-mode/form_for helpers/form_for label 2.yasnippet +++ b/extras/imported/rails-mode/form_for helpers/form_for label 2.yasnippet @@ -2,6 +2,6 @@ # key: ffl # contributor: Translated from TextMate Snippet # name: form_for label -## condition: "text.html.ruby, text.haml" +# condition: (yas/rails-view-p) # -- <%= f.label :${1:attribute}${2:, "${3:${1:$(capitalize (replace-regexp-in-string "_" " " yas/text))}}"} %> \ No newline at end of file diff --git a/extras/imported/rails-mode/form_for helpers/form_for password_field 2.yasnippet b/extras/imported/rails-mode/form_for helpers/form_for password_field 2.yasnippet index 1c102bd..afe09ce 100644 --- a/extras/imported/rails-mode/form_for helpers/form_for password_field 2.yasnippet +++ b/extras/imported/rails-mode/form_for helpers/form_for password_field 2.yasnippet @@ -2,6 +2,6 @@ # key: ffpf # contributor: Translated from TextMate Snippet # name: form_for password_field -## condition: "text.html.ruby, text.haml" +# condition: (yas/rails-view-p) # -- <%= f.password_field :${1:attribute} %> \ No newline at end of file diff --git a/extras/imported/rails-mode/form_for helpers/form_for radio_box 2.yasnippet b/extras/imported/rails-mode/form_for helpers/form_for radio_box 2.yasnippet index 404dd74..b7e96d9 100644 --- a/extras/imported/rails-mode/form_for helpers/form_for radio_box 2.yasnippet +++ b/extras/imported/rails-mode/form_for helpers/form_for radio_box 2.yasnippet @@ -2,6 +2,6 @@ # key: ffrb # contributor: Translated from TextMate Snippet # name: form_for radio_box -## condition: "text.html.ruby, text.haml" +# condition: (yas/rails-view-p) # -- <%= f.radio_box :${1:attribute}, :${2:tag_value} %> \ No newline at end of file diff --git a/extras/imported/rails-mode/form_for helpers/form_for submit 2.yasnippet b/extras/imported/rails-mode/form_for helpers/form_for submit 2.yasnippet index 6005cdf..193377b 100644 --- a/extras/imported/rails-mode/form_for helpers/form_for submit 2.yasnippet +++ b/extras/imported/rails-mode/form_for helpers/form_for submit 2.yasnippet @@ -2,6 +2,6 @@ # key: ffs # contributor: Translated from TextMate Snippet # name: form_for submit -## condition: "text.html.ruby, text.haml" +# condition: (yas/rails-view-p) # -- <%= f.submit "${1:Submit}"${2:, :disable_with => '${3:$1ing...}'} %> \ No newline at end of file diff --git a/extras/imported/rails-mode/form_for helpers/form_for text_area 2.yasnippet b/extras/imported/rails-mode/form_for helpers/form_for text_area 2.yasnippet index 5f6f27c..0cfcb69 100644 --- a/extras/imported/rails-mode/form_for helpers/form_for text_area 2.yasnippet +++ b/extras/imported/rails-mode/form_for helpers/form_for text_area 2.yasnippet @@ -2,6 +2,6 @@ # key: ffta # contributor: Translated from TextMate Snippet # name: form_for text_area -## condition: "text.html.ruby, text.haml" +# condition: (yas/rails-view-p) # -- <%= f.text_area :${1:attribute} %> \ No newline at end of file diff --git a/extras/imported/rails-mode/form_for helpers/form_for text_field 2.yasnippet b/extras/imported/rails-mode/form_for helpers/form_for text_field 2.yasnippet index 1fe99d9..3ec8667 100644 --- a/extras/imported/rails-mode/form_for helpers/form_for text_field 2.yasnippet +++ b/extras/imported/rails-mode/form_for helpers/form_for text_field 2.yasnippet @@ -2,6 +2,6 @@ # key: fftf # contributor: Translated from TextMate Snippet # name: form_for text_field -## condition: "text.html.ruby, text.haml" +# condition: (yas/rails-view-p) # -- <%= f.text_field :${1:attribute} %> \ No newline at end of file diff --git a/extras/imported/ruby-mode/Classes and Modules/class .. initialize .. end.yasnippet b/extras/imported/ruby-mode/Classes and Modules/class .. initialize .. end.yasnippet index d5c3566..f7c556f 100644 --- a/extras/imported/ruby-mode/Classes and Modules/class .. initialize .. end.yasnippet +++ b/extras/imported/ruby-mode/Classes and Modules/class .. initialize .. end.yasnippet @@ -7,6 +7,5 @@ class ${1:`(yas/ruby-infer-class-name)`} def initialize${2:$(if (string= yas/text "") "" "(")}${2:args}${2:$(if (string= yas/text "") "" ")")} $0 - end + end end - diff --git a/extras/imported/text-mode/010 Copyright.yasnippet b/extras/imported/text-mode/010 Copyright.yasnippet index 43434cc..b8bdcaf 100644 --- a/extras/imported/text-mode/010 Copyright.yasnippet +++ b/extras/imported/text-mode/010 Copyright.yasnippet @@ -3,4 +3,4 @@ # contributor: Translated from TextMate Snippet # name: Copyright Notice # -- -(c) Copyright `(replace-regexp-in-string "[[:space:]]+$" "" (shell-command-to-string "date +%Y"))` `user-full-name`. All Rights Reserved. \ No newline at end of file +(c) Copyright `(replace-regexp-in-string "[ \n\t]+$" "" (shell-command-to-string "date +%Y"))` `user-full-name`. All Rights Reserved. \ No newline at end of file