diff options
author | Yasuhiro Matsumoto <mattn.jp@gmail.com> | 2015-10-02 19:48:21 +0900 |
---|---|---|
committer | Yasuhiro Matsumoto <mattn.jp@gmail.com> | 2015-10-02 19:48:21 +0900 |
commit | 89f67a9bacbcdcccd631dc4c0deab45c1c402eb7 (patch) | |
tree | 6bd6dcb9aebda582a559b4963467ca3f4d1b2507 | |
parent | b7fcf86759361752f669721742b308dc60c1f96e (diff) | |
download | vim-sonictemplate-89f67a9bacbcdcccd631dc4c0deab45c1c402eb7.tar.gz vim-sonictemplate-89f67a9bacbcdcccd631dc4c0deab45c1c402eb7.tar.bz2 vim-sonictemplate-89f67a9bacbcdcccd631dc4c0deab45c1c402eb7.zip |
java package name
-rw-r--r-- | autoload/sonictemplate.vim | 1 | ||||
-rw-r--r-- | autoload/sonictemplate/lang/java.vim | 6 | ||||
-rw-r--r-- | template/java/base-class.java | 2 | ||||
-rw-r--r-- | template/java/base-main.java | 2 | ||||
-rw-r--r-- | template/java/base-spark.java | 2 | ||||
-rw-r--r-- | template/java/base-test.java | 2 |
6 files changed, 15 insertions, 0 deletions
diff --git a/autoload/sonictemplate.vim b/autoload/sonictemplate.vim index 9f742ff..de61a07 100644 --- a/autoload/sonictemplate.vim +++ b/autoload/sonictemplate.vim @@ -253,6 +253,7 @@ function! sonictemplate#apply(name, mode, ...) abort endwhile sandbox let c = substitute(c, '{{_if_:\(.\{-}\);\(.\{-}\)\(;\(.\{-}\)\)\{-}}}', '\=eval(submatch(1))?submatch(2):submatch(4)', 'g') sandbox let c = substitute(c, '{{_expr_:\(.\{-}\)}}', '\=eval(submatch(1))', 'g') + silent! let c = substitute(c, '{{_lang_util_:\(.\{-}\)}}', '\=sonictemplate#lang#{ft}#util(submatch(1))', 'g') if len(c) == 0 return endif diff --git a/autoload/sonictemplate/lang/java.vim b/autoload/sonictemplate/lang/java.vim new file mode 100644 index 0000000..59e5d69 --- /dev/null +++ b/autoload/sonictemplate/lang/java.vim @@ -0,0 +1,6 @@ +function! sonictemplate#lang#java#util(name) + if a:name == 'package' + return 'package foo.bar;' + endif + return '' +endfunction diff --git a/template/java/base-class.java b/template/java/base-class.java index f472f63..fcc344e 100644 --- a/template/java/base-class.java +++ b/template/java/base-class.java @@ -1,3 +1,5 @@ +{{_lang_util_:package}} + /** * {{_name_}} */ diff --git a/template/java/base-main.java b/template/java/base-main.java index a8c1d0c..15cd450 100644 --- a/template/java/base-main.java +++ b/template/java/base-main.java @@ -1,3 +1,5 @@ +{{_lang_util_:package}} + /** * {{_name_}} */ diff --git a/template/java/base-spark.java b/template/java/base-spark.java index 48429ee..70c5bd7 100644 --- a/template/java/base-spark.java +++ b/template/java/base-spark.java @@ -1,3 +1,5 @@ +{{_lang_util_:package}} + import static spark.Spark.*; import spark.*; diff --git a/template/java/base-test.java b/template/java/base-test.java index 643cbd5..6938249 100644 --- a/template/java/base-test.java +++ b/template/java/base-test.java @@ -1,3 +1,5 @@ +{{_lang_util_:package}} + import static org.junit.Assert.*; import org.junit.Test; |