WARNING! Do not install anything from update sites before installing Eclim! This is because Eclim determines available project natures (android, scala, etc) by trying to discover them at install time. If they are installed on a per-user basis, it won't find them. If you're installing Eclim for use with an existing Eclipse install
You're also better off not to install any plugins via your package manager. Eclim will give you the option to install plugins associated with each project nature from its install wizard.
Install Eclipse Luna. On Arch Linux, it's available in extra.
pacman -Sy eclipse
Install Eclim using the JAR installer and select the plugins you want.
At the end of the install process, the installer will print a long path to eclimd
executable in your home directory. For convenience, I've aliased eclimd
to that path in .bashrc
.
alias eclimd='/home/sean/.eclipse/org.eclipse.platform_4.4.1_1543616141_linux_gtk_x86_64/eclimd'
Start eclimd
and ping Eclim from Vim with :PingEclim
. If you got some version info, you're in good shape. Stop Eclim for the time being.
Update your Vim helptags to include help docs for Eclim. If you're using Pathogen, this is as easy as:
:Helptags
Otherwise, something like the following should work.
:helpt ~/.vim/eclim/doc
Check out your Scala project to your Eclipse workspace.
git clone blah && cd blah
Add sbteclipse to project/plugins.sbt
.
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "3.0.0")
Reload SBT plugins and generate Eclipse .project
and .classpath
files.
sbt reload && sbt eclipse
Before restarting Eclim, open Eclipse once to resolve any build errors in your project. For example, you may need to remove empty src directories from the classpath, since Eclipse thinks these are missing and will complain about them.
Restart Eclim and open your project from Vim.
:ProjectOpen yourproject
Read all about Eclim with :help eclim
and then get to work!
Install vim-scala. This also provides the handy :SortScalaImports
command. Get more info on that with :help scala
.
I use Neocomplete for completion. It doesn't support Eclim directly, but it can be made to play nicely with it via omni completion.
Make sure you have Neocomplete enabled. I also like to set a minimum keyword length.
" Enable at startup
let g:neocomplete#enable_at_startup = 1
" Minimum syntax keyword length
let g:neocomplete#sources#syntax#min_keyword_length = 3
First tell Eclim to use omni completion in .vimrc
.
let g:EclimCompletionMethod = "omnifunc"
Then tell Neocomplete to pick up completion from omnicomplete for Java and Scala files.
if !exists('g:neocomplete#force_omni_input_patterns')
let g:neocomplete#force_omni_input_patterns = {}
endif
let g:neocomplete#force_omni_input_patterns.java = '\k\.\k*'
let g:neocomplete#force_omni_input_patterns.scala = '\k\.\k*'
Any time you type a period, you should get a list of suggestions that includes applicable members of your classpath. If something is missing, check that it has an entry in your .classpath
file.
To trigger completion manually in other contexts, use omni completion as usual with C-x C-o
. See :help omnifunc
and :help neocomplete
for more.