Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Changed some settings for my new gig

  • Loading branch information...
commit 254dd74e7eb910525d8d91424d5a3de3d5ec7548 1 parent 2061a58
@derekwyatt authored
View
18 ftplugin/scala.vim
@@ -9,27 +9,31 @@ if !exists("*s:CodeOrTestFile")
function! s:CodeOrTestFile(precmd)
let current = expand('%:p')
let other = current
+ let specExt = "Spec.scala"
+ if current =~ "/npl/"
+ let specExt = "Test.scala"
+ endif
if current =~ "/src/main/"
let other = substitute(current, "/main/", "/test/", "")
- let other = substitute(other, ".scala$", "Spec.scala", "")
+ let other = substitute(other, ".scala$", specExt, "")
elseif current =~ "/src/test/"
let other = substitute(current, "/test/", "/main/", "")
- let other = substitute(other, "Spec.scala$", ".scala", "")
+ let other = substitute(other, specExt . "$", ".scala", "")
elseif current =~ "/src/it/"
let other = substitute(current, "/it/", "/main/", "")
- let other = substitute(other, "Spec.scala$", ".scala", "")
+ let other = substitute(other, specExt . "$", ".scala", "")
elseif current =~ "/app/model/"
let other = substitute(current, "/app/model/", "/test/", "")
- let other = substitute(other, ".scala$", "Spec.scala", "")
+ let other = substitute(other, ".scala$", specExt, "")
elseif current =~ "/app/controllers/"
let other = substitute(current, "/app/", "/test/scala/", "")
- let other = substitute(other, ".scala$", "Spec.scala", "")
+ let other = substitute(other, ".scala$", specExt, "")
elseif current =~ "/test/scala/controllers/"
let other = substitute(current, "/test/scala/", "/app/", "")
- let other = substitute(other, "Spec.scala$", ".scala", "")
+ let other = substitute(other, specExt . "$", ".scala", "")
elseif current =~ "/test/"
let other = substitute(current, "/test/", "/app/model/", "")
- let other = substitute(other, "Spec.scala$", ".scala", "")
+ let other = substitute(other, specExt . "$", ".scala", "")
endif
if &switchbuf =~ "^use"
let i = 1
View
11 vimrc
@@ -192,6 +192,7 @@ nmap <silent> ,p :set invpaste<CR>:set paste?<CR>
" cd to the directory containing the file in the buffer
nmap <silent> ,cd :lcd %:h<CR>
+nmap <silent> ,cr :lcd <c-r>=FindGitDirOrRoot()<cr><cr>
nmap <silent> ,md :!mkdir -p %:p:h<CR>
" Turn off that stupid highlight search
@@ -564,6 +565,16 @@ function! IndentToNextBraceInLineAbove()
:normal j"vPl
endfunction
+function! FindGitDirOrRoot()
+ let curdir = expand('%:p:h')
+ let gitdir = finddir('.git', curdir . ';')
+ if gitdir != ''
+ return substitute(gitdir, '\/\.git$', '', '')
+ else
+ return '/'
+ endif
+endfunction
+
nmap <silent> ,ii :call IndentToNextBraceInLineAbove()<cr>
nmap <silent> ,mba :call MarkBufferInJumpList(expand('%:p'), 'a')<cr>
View
40 xpt-personal/ftplugin/scala/scala.xpt.vim
@@ -65,8 +65,8 @@ function! s:f.multiJvmNode(num, ...)
\ ' import ' . s:f.classNameFromSpec() . '._',
\ ' val nodes = NrOfNodes',
\ '',
- \ ' "' . s:f.classNameFromSpec() . '" should { //{1',
- \ ' } //}1',
+ \ ' "' . s:f.classNameFromSpec() . '" should {',
+ \ ' }',
\ '}'], "\n")
return class
endfunction
@@ -164,11 +164,11 @@ XPT specfile hint=Creates\ a\ new\ Specs2\ test\ file
import org.specs2.mutable._
class `classname()^ extends Specification {
- "`classNameFromSpec()^" should { //{1
- "`spec^" in { //{2
+ "`classNameFromSpec()^" should {
+ "`spec^" in {
`cursor^
- } //}2
- } //}1
+ }
+ }
}
XPT wrapin wrap=code hint=Wraps\ in\ a\ block
@@ -183,19 +183,19 @@ XPT match hint=Creates\ a\ pattern\ matching\ sequence
}
XPT spec hint=Creates\ a\ new\ specs2\ test
-"`spec^" in { //{2
+"`spec^" in {
`cursor^
-} //}2
+}
XPT wst hint=Creates\ a\ new\ WordSpec\ test
-"`spec^" in { //{2
+"`spec^" in {
`cursor^
-} //}2
+}
XPT groupwordspec hint=Creates\ a\ new\ WordSpec\ test\ group
-"`spec^" should { //{1
+"`spec^" should {
`cursor^
-} //}1
+}
XPT filewordspec hint=Creates\ a\ new\ WordSpec\ test\ file
`getPackageLine()^
@@ -203,9 +203,9 @@ XPT filewordspec hint=Creates\ a\ new\ WordSpec\ test\ file
import org.scalatest.{WordSpec, Matchers}
class `classname()^ extends WordSpec with Matchers {
- "`classNameFromSpec()^" should { //{1
+ "`classNameFromSpec()^" should {
`cursor^
- } //}1
+ }
}
// vim:fdl=1:
@@ -270,9 +270,9 @@ class `classname()^ extends TestKit(ActorSystem("`classname()^"))
system.shutdown()
}
- "`classNameFromSpec()^" should { //{1
+ "`classNameFromSpec()^" should {
`cursor^
- } //}1
+ }
}
XPT multijvm hint=Multi\ JVM\ Test\ for\ Scala
@@ -284,22 +284,22 @@ import com.typesafe.config.{Config, ConfigFactory}
import org.scalatest.{WordSpec, BeforeAndAfterAll}
import org.scalatest.matchers.MustMatchers
-object `multijvmObject()^ extends AbstractRemoteActorMultiJvmSpec { //{2
+object `multijvmObject()^ extends AbstractRemoteActorMultiJvmSpec {
override def NrOfNodes = `numberOfNodes^
def commonConfig = ConfigFactory.parseString("""
akka.actor.provider = "akka.remote.RemoteActorRefProvider",
akka.remote.transport = "akka.remote.netty.NettyRemoteTransport"
""")
-} //{2
+}
-trait `multijvmBase()^ extends WordSpec //{2
+trait `multijvmBase()^ extends WordSpec
with BeforeAndAfterAll
with MustMatchers {
override def beforeAll(configMap: Map[String, Any]) {
}
override def afterAll(configMap: Map[String, Any]) {
}
-} //{2
+}
`expandNodes...^
XSETm expandNodes...|post
Please sign in to comment.
Something went wrong with that request. Please try again.