diff --git a/lib/extensions/development/init.el b/lib/extensions/development/init.el index 750e956..ae0ff67 100644 --- a/lib/extensions/development/init.el +++ b/lib/extensions/development/init.el @@ -43,6 +43,8 @@ (ability yas () "Snippet configuration." + (let ((snippet_home (concat fg42-home "/lib/snippets"))) + (setq yas-snippet-dirs (list snippet_home))) (yas-global-mode 1)) (ability project-management () diff --git a/lib/extensions/editor/about.el b/lib/extensions/editor/about.el index 24edb61..214fca0 100644 --- a/lib/extensions/editor/about.el +++ b/lib/extensions/editor/about.el @@ -7,10 +7,12 @@ Home page: \thttp://fg42.lxsameer.com Credits: -\tSameer Rahmani (lxsameer) +\tSameer Rahmani (@lxsameer) +\tDanial Parsi (@intuxticated) +\tAmir Houghangi \tNima Nazari (niman) -\tDanial Parsi (intuxticated) \tKeyvan Hedayati (k1-hedayati) +\tBehnam Khan Beigi (@yottanami) " "About FG42") diff --git a/lib/fg42.el b/lib/fg42.el index 7d265fd..2a85b98 100644 --- a/lib/fg42.el +++ b/lib/fg42.el @@ -27,6 +27,9 @@ (require 'fpkg) (require 'fg42/base) +(defvar fg42-home (getenv "FG42_HOME") + "The pass to fg42-home") + (defun fg42-initialize () "Initialize FG42 editor." (fpkg-initialize) diff --git a/lib/snippets/js-mode/belongs_to b/lib/snippets/js-mode/belongs_to new file mode 100644 index 0000000..951cf0f --- /dev/null +++ b/lib/snippets/js-mode/belongs_to @@ -0,0 +1,13 @@ +# name: belongs_to +# key: bt +# expand-env: ((yas-indent-line 'fixed) (yas-wrap-around-region 'nil) +# condition: (featurep 'flymake-json) +# contributor: Sameer Rahmani +# -- +{ + "name": "$1", + "type": "belongs_to", + "bulk": ${2:$$(yas-choose-value '("true" "false"))}, + "to": "${1:$(pluralize-string yas-text)}" +}, + $0 \ No newline at end of file diff --git a/lib/snippets/js-mode/field b/lib/snippets/js-mode/field new file mode 100644 index 0000000..1179ff0 --- /dev/null +++ b/lib/snippets/js-mode/field @@ -0,0 +1,12 @@ +# name: field +# key: ff +# expand-env: ((yas-indent-line 'fixed) (yas-wrap-around-region 'nil) +# condition: (featurep 'flymake-json) +# contributor: Sameer Rahmani +# -- +{ + "name": "$1", + "type": "${2:$$(yas-choose-value '("string" "integer" "datetime" "float" "image" "in" "belongs_to" "has_many"))}", + "bulk": ${3:$$(yas-choose-value '("true" "false"))} +}, + $0 \ No newline at end of file diff --git a/lib/snippets/js-mode/has_many b/lib/snippets/js-mode/has_many new file mode 100644 index 0000000..2160f79 --- /dev/null +++ b/lib/snippets/js-mode/has_many @@ -0,0 +1,13 @@ +# name: has_many +# key: hm +# expand-env: ((yas-indent-line 'fixed) (yas-wrap-around-region 'nil) +# condition: (featurep 'flymake-json) +# contributor: Sameer Rahmani +# -- +{ + "name": "$1", + "type": "has_many", + "bulk": ${2:$$(yas-choose-value '("true" "false"))}, + "to": "${1:$(pluralize-string yas-text)}" +}, + $0 \ No newline at end of file diff --git a/lib/snippets/js-mode/in b/lib/snippets/js-mode/in new file mode 100644 index 0000000..941c415 --- /dev/null +++ b/lib/snippets/js-mode/in @@ -0,0 +1,14 @@ +# name: in +# key: in +# expand-env: ((yas-indent-line 'fixed) (yas-wrap-around-region 'nil) +# condition: (featurep 'flymake-json) +# contributor: Sameer Rahmani +# -- +{ + "name": "$1", + "type": "in", + "bulk": ${2:$$(yas-choose-value '("true" "false"))}, + "to": [ + $0 + ] +}, diff --git a/lib/snippets/js-mode/resource b/lib/snippets/js-mode/resource new file mode 100644 index 0000000..bc725b9 --- /dev/null +++ b/lib/snippets/js-mode/resource @@ -0,0 +1,14 @@ +# name: resource +# key: resource +# expand-env: ((yas-indent-line 'fixed) (yas-wrap-around-region 'nil) +# condition: (featurep 'flymake-json) +# contributor: Sameer Rahmani +# -- +{ + "name": "$1", + "fields": [ + $0 + ], + "no_filter": ${2:$$(yas-choose-value '("true" "false"))}, + "title-field": "$3" +} diff --git a/lib/snippets/web-mode/.yas-parents b/lib/snippets/web-mode/.yas-parents new file mode 100644 index 0000000..8a11383 --- /dev/null +++ b/lib/snippets/web-mode/.yas-parents @@ -0,0 +1 @@ +html-mode