General help after installing eclim (newbie question) ...

43 views
Skip to first unread message

NYCeyes

unread,
Oct 6, 2009, 1:38:14 AM10/6/09
to eclim-user
Hello:

Being a long time Unix person, I'd like to get vi (vim) functionality
into Eclipse,
and vice versa.

So after following the steps to install eclim, and after verifying
that the daemon starts
and is pingable from within vim, I really can't figure out from the
documentation what
to do next to get vim to do the magic as I type java statements.

For example, after starting eclimd manually (with Eclipse not
running), I opened a
new file in vim, and started typing some java statements.

Perhaps I'm wrong, but I expected colorful interaction, with dynamic
suggestions, etc.
as I typed. But all I see is plain old vim (with white letters on a
black background).

Clearly I'm missing something(s) - and the documentation is not
hitting me.

So I ask my friends here... I installed the eclim software
successfully (that's what
it said). I verified I can start the eclim server on the command line,
and also from
within Eclipse. I can ping the server from within vim.

So, step-by-step, what do I do next so that when I do, say, "user$ vi
Test.java",
I get a rich interactive, color coded session, with similar behaviors
I would
see in Eclipse as I type there. I'm stuck

Thank you all in advance.
Noel

Eric Van Dewoestine

unread,
Oct 6, 2009, 10:56:23 AM10/6/09
to eclim...@googlegroups.com

It sounds like you are just missing the filetype plugin support. In
vim, try running the following command:
:EclimValidate

That command will run some checks to ensure that your vim instance has
the minimum required settings. I have a feeling that it will prompt
you to add the following to your .vimrc:
filetype plugin indent on

If after adding that you still don't get any syntax highlighting, then
be sure to add the following to your .vimrc as well:
syntax on

Once you have the basic vim settings enabled, then you can start
taking advantage of eclim features (after creating a project[1] of
course).

Hopefully that gets you going, but if you have more questions, feel
free to ask.

[1] http://eclim.sourceforge.net/guides/java/project.html
--
eric

NYCeyes

unread,
Oct 20, 2009, 5:11:42 PM10/20/09
to eclim-user
Hello Eric:

Thanks for responding. I was pulled away on another (non programming)
project, and didn't get an opportunity to continue with this problem.
I'm back.

Following up on what you suggested above, here is what I can validate
(cut-and-pasted from within VIM):


:EclimValidate
Result: OK, required settings are valid.

:PingEclim
eclim 1.5.2
eclipse 3.5.1
Press ENTER or type command to continue

(And "netstat -an" shows port 9091 being listened on).

cat ${HOME}/.vimrc
================================
syntax on
================================
(Note: that is the only line in my "~/.vimrc" file).

With that, when I "homeDir$ vi Test.java", I sill get the plain-ole
VIM behavior as before (no rich interactive, color coded,
dynamic suggestion session). The only thing I do notice, is
that when I write or save a VIM'ed file *now*, I get the following
error notice (even on trivial tiny files):

>> Error detected while processing function
eclim#project#util#RefreshFileBootstrap..eclim#project#util
>> #GetCurrentProjectName..eclim#project#util#GetProjects:
>> line 64:
>> E706: Variable type mismatch for: result
>> line 65:
>> E691: Can only compare List with List
>> "Test" [New] 1L, 14C written

Since my "Test.java" file had only one line in it (a few random
ASCII characters in fact), I don't understand why lines 64 and 65 are
even being referenced. (Note: "Test.java" was created in my home
directory, not
in my IDE workspace directory if that somehow makes a difference).

In summary, not only am I not getting the "Eclipse experience" within
VIM,
but saving trivially small files (3 or 4 characters), now results in
the
error(s) above.

Could use some more help. Perhaps I'm missing other settings within
~/.vimrc?
(A complete sample would be appreciated).

Thank again in advance!
Regards,
Noel






Eric Van Dewoestine

unread,
Oct 20, 2009, 5:34:55 PM10/20/09
to eclim...@googlegroups.com
On Tue, Oct 20, 2009 at 02:11:42PM -0700, NYCeyes wrote:
>
> Hello Eric:
>
> Thanks for responding. I was pulled away on another (non programming)
> project, and didn't get an opportunity to continue with this problem.
> I'm back.
>
> Following up on what you suggested above, here is what I can validate
> (cut-and-pasted from within VIM):
>
>
> :EclimValidate
> Result: OK, required settings are valid.
>
> :PingEclim
> eclim 1.5.2
> eclipse 3.5.1
> Press ENTER or type command to continue
>
> (And "netstat -an" shows port 9091 being listened on).
>
> cat ${HOME}/.vimrc
> ================================
> syntax on
> ================================
> (Note: that is the only line in my "~/.vimrc" file).
>
> With that, when I "homeDir$ vi Test.java", I sill get the plain-ole
> VIM behavior as before (no rich interactive, color coded,
> dynamic suggestion session).

Have you created a java project yet? Eclipse/eclim requires a project
to be created before features like code completion, etc can be
provided. Take a look at the java project guide[1] which should get
you started.

> The only thing I do notice, is
> that when I write or save a VIM'ed file *now*, I get the following
> error notice (even on trivial tiny files):
>
> >> Error detected while processing function
> eclim#project#util#RefreshFileBootstrap..eclim#project#util
> >> #GetCurrentProjectName..eclim#project#util#GetProjects:
> >> line 64:
> >> E706: Variable type mismatch for: result
> >> line 65:
> >> E691: Can only compare List with List
> >> "Test" [New] 1L, 14C written
>
> Since my "Test.java" file had only one line in it (a few random
> ASCII characters in fact), I don't understand why lines 64 and 65 are
> even being referenced. (Note: "Test.java" was created in my home
> directory, not
> in my IDE workspace directory if that somehow makes a difference).

This is unfortunately a bug in eclim that you've encountered. The
line numbers referenced are from the eclim vim file that has the
error, not your java file. The particular issue was fixed with the
following changeset:
http://eclim.git.sourceforge.net/git/gitweb.cgi?p=eclim/eclim;a=commitdiff;h=edd210991530b63b243e00019cc2227c6cdf5bb9

Try manually applying those changes (renaming 'result' to 'results' in
that else block), which should resolve that error.

> In summary, not only am I not getting the "Eclipse experience" within
> VIM,
> but saving trivially small files (3 or 4 characters), now results in
> the
> error(s) above.
>
> Could use some more help. Perhaps I'm missing other settings within
> ~/.vimrc?
> (A complete sample would be appreciated).

Since :EclimValidate passed for you, then you must have the necessary
minimum setting enabled. Since your ~/.vimrc only has the one line,
my guess is that your OS is providing a default vimrc somewhere else,
like at /etc/vim/vimrc.

Overall it seems as though you have everything setup correctly. Once
you've patched that one file to fix that bug, and you've created a
java project, you should able to leverage eclim's features.

NYCeyes

unread,
Oct 21, 2009, 4:24:47 PM10/21/09
to eclim-user
Hi Eric:

Thank you. I manually patch the file as you prescribed, and the file
saving error
has been corrected.

I'm still not getting the intended behavior. I have some projects
created and
Java files already in place. For the sake of discussion:

Let's say:
=============================================================
(1) One Eclipse Project resides here:
/home/user/ECLIPSE.d/MyProject/
/home/user/ECLIPSE.d/MyProject/src/

(2) root# mv /etc/vimrc /etc/vimrc.disabled
So the only .vimrc file left is "/home/user/.vimrc", which only has
"syntax on" in it.

(3) I've manully (from the CLI) started eclimd as follows (Note: the
Eclipse GUI is itself *never* running):
user$ nohup /home/user/.eclipse/latest/configuration/eclipse/plugins/
latest-eclim/bin/eclimd &
[[ This succeeds. Pingable; Verifable; etc. from within VIM ]]

(4) vi /home/user/Test.java (which is my home directory, not any of
the Eclipse Projects Directories).
vi /home/user/ECLIPSE.d/MyProject/src/Test.java (Which *is* an
Eclipse project directory).
=============================================================

The above scenarios do not produce the desired result. Does that help
you with clues? Appreciated.

Thanks & Regards,
Noel

Eric Van Dewoestine

unread,
Oct 21, 2009, 5:01:15 PM10/21/09
to eclim...@googlegroups.com
On Wed, Oct 21, 2009 at 01:24:47PM -0700, NYCeyes wrote:
>
> Hi Eric:
>
> Thank you. I manually patch the file as you prescribed, and the file
> saving error
> has been corrected.
>
> I'm still not getting the intended behavior. I have some projects
> created and
> Java files already in place. For the sake of discussion:
>
> Let's say:
> =============================================================
> (1) One Eclipse Project resides here:
> /home/user/ECLIPSE.d/MyProject/
> /home/user/ECLIPSE.d/MyProject/src/
>
> (2) root# mv /etc/vimrc /etc/vimrc.disabled
> So the only .vimrc file left is "/home/user/.vimrc", which only has
> "syntax on" in it.

I would go ahead and move that file back. It's highly unlikely that
the vimrc in etc is hurting anything and since your local .vimrc is so
bare bones, not having the etc vimrc might just make things worse. For
instance, does :EclimValidate still give you a positive result when
/etc/vimrc is disabled?

> (3) I've manully (from the CLI) started eclimd as follows (Note: the
> Eclipse GUI is itself *never* running):
> user$ nohup /home/user/.eclipse/latest/configuration/eclipse/plugins/
> latest-eclim/bin/eclimd &
> [[ This succeeds. Pingable; Verifable; etc. from within VIM ]]
>
> (4) vi /home/user/Test.java (which is my home directory, not any of
> the Eclipse Projects Directories).
> vi /home/user/ECLIPSE.d/MyProject/src/Test.java (Which *is* an
> Eclipse project directory).
> =============================================================
>
> The above scenarios do not produce the desired result. Does that help
> you with clues? Appreciated.

What are your expected results? Can you describe what you are doing
in the java source file that is not behaving as you expect?

Looking back on your original mail, you mention expecting "colorful


interaction, with dynamic suggestions, etc. as I typed. But all I see
is plain old vim (with white letters on a black background)."

So first off, I don't think you've resolved the syntax highlighting
issue, something that should work independent of eclim. Perhaps using
'vi' instead of 'vim' is contributing to the lack of syntax
highlighting (on some distros, using 'vi' is not the same as using
'vim', even though both may share the same binary, the 'vi' version
sometimes runs vim with various features disabled).

As for "dynamic suggestions" I believe you are referring to code
completion? Note that all the code completion support that eclim
provides, is done so using the standard vim completion mechanisms[1].
So, unlike some IDEs you won't get a popup of suggestions as you type.
Instead you have to actually tell vim that you want suggestions (in
vim type ':help ins-completion' for more detail). In the case of
eclim provided code completion, the default key combination to
initiate the completion mode is 'ctrl-x ctrl-u', which is the default
vim key binding for 'user defined completion'. I personally find that
key binding cumbersome, so I use supertab[2] to make things easier.

[1] http://eclim.sourceforge.net/vim/code_completion.html
[2] http://www.vim.org/scripts/script.php?script_id=1643

--
eric

Reply all
Reply to author
Forward
0 new messages