diff options
| author | Ben Beltran <ben@freshout.us> | 2013-06-05 10:50:57 -0500 |
|---|---|---|
| committer | Ben Beltran <ben@freshout.us> | 2013-06-05 10:50:57 -0500 |
| commit | fe337504f2fb3ded76326b1e3d4d02787a27d853 (patch) | |
| tree | b84891d78de37ae078ea9850a541799b5bca8085 /vim/plugin/31-create-scala.vim | |
| parent | e23d7a9f7363bdc69e95a1df31e093db15459fcf (diff) | |
Aand that's all the plugins.
Diffstat (limited to 'vim/plugin/31-create-scala.vim')
| -rw-r--r-- | vim/plugin/31-create-scala.vim | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/vim/plugin/31-create-scala.vim b/vim/plugin/31-create-scala.vim deleted file mode 100644 index e4ecb44..0000000 --- a/vim/plugin/31-create-scala.vim +++ /dev/null @@ -1,55 +0,0 @@ -" Vim plugin that generates new Scala source file when you type -" vim nonexistent.scala. -" Scripts tries to detect package name from the directory path, e. g. -" .../src/main/scala/com/mycompany/myapp/app.scala gets header -" package com.mycompany.myapp -" -" Author : Stepan Koltsov <yozh@mx1.ru> - -function! MakeScalaFile() - if exists("b:template_used") && b:template_used - return - endif - - let b:template_used = 1 - - let filename = expand("<afile>:p") - let x = substitute(filename, "\.scala$", "", "") - - let p = substitute(x, "/[^/]*$", "", "") - let p = substitute(p, "/", ".", "g") - let p = substitute(p, ".*\.src$", "@", "") " unnamed package - let p = substitute(p, ".*\.src\.", "!", "") - let p = substitute(p, "^!main\.scala\.", "!", "") " - let p = substitute(p, "^!.*\.ru\.", "!ru.", "") - let p = substitute(p, "^!.*\.org\.", "!org.", "") - let p = substitute(p, "^!.*\.com\.", "!com.", "") - - " ! marks that we found package name. - if match(p, "^!") == 0 - let p = substitute(p, "^!", "", "") - else - " Don't know package name. - let p = "@" - endif - - let class = substitute(x, ".*/", "", "") - - if p != "@" - call append("0", "package " . p) - endif - - "norm G - "call append(".", "class " . class . " {") - - "norm G - "call append(".", "} /// end of " . class) - - call append(".", "// vim: set ts=4 sw=4 et:") - call append(".", "") - -endfunction - -au BufNewFile *.scala call MakeScalaFile() - -" vim: set ts=4 sw=4 et: |