How to connect JabRef with vim and push entries to it?

Dear everyone,
I am using JabRef_3.6.jar on Ubuntu. The option in ‘External programs’ is:
Path to Vim: /usr/bin/vim
Vim server name:vim
I use ‘which vim’ in terminal and it shows ‘/usr/bin/vim’. I think the path is right.
However, whem I use the button ‘Push to Vim’ in JabRef to push entries, an error pops up, the message is 'Could not connect to Vim server. Make sure that Vim is running with correct server name.'
I tried to find solutions in help manual, but I failed.
Could anybody tell me how to fix this problem?
Any help would be much appreciated!

Althought I do not use vim myself, I understand that vim needs to be started with a specific option for the server to be on. This option in --servername NAME
Can you try in the command-line something like
vim --servername vim
and let us know if this helps?

1 Like

I tried this out and it worked for gvim (start with gvim --servername vim), but for vim it did complain that there was no option --servername… I have
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jul 24 2015 02:23:23)
Still, reading manuals on the internet it says that this option should be available, see e.g. http://vimdoc.sourceforge.net/htmldoc/remote.html
I also figured out that I have something called vimx which appears to be the same core program (same version and dates, but compiled 44 seconds earlier…), ehich accepts the --servername option.

Hence, depending on distribution (I guess), the correct executable differs. Starting with --servername is crucial though.

The doc you point out states that When compiled with the +clientserver option [...]. Although that was in 2008, this may be an issue for some users.

I have tried `vim --servername’ on Ubuntu 14.04LTS, it shows that vim does not have this option --servername.
And I am very sorry, I cannot quite follow the other discussions on the above.

So, you will need to use another version of vim…
But maybe you already have it installed: when you launch vim in the command line, it launches /usr/bin/vim (as shown by the “which” command). This /usr/bin/vim may not be the actual vim program, but a link to it. Could you look at the results of ls /usr/bin/vim* ? You may have a file named vim.full, which is likely to have the option servername enabled (to start it: /usr/bin/vim.full.
The alternative will be to find a repository containing vim with servername enabled, or to compile it yourself (as described, for example, at https://michaelheap.com/installing-vim-with-clientserver/)

Check if you have a command called vimx. On my CentOS system that has the option --servername and is the same core as vim.

I typed ls -l /usr/bin/vim*, it shows that /usr/bin/vim is a link to /etc/alternatives/vim, and /usr/bin/vimdiff is a link to /etc/alternatives/vimdiff. I also have vim.basic, vim.tiny and vimtutor under /usr/bin, unfortunately I do not have vim.full on my Ubuntu.
I also tried vim.basic --servername and vim.tiny --servername, still , it shows ‘Unknown option argument’.
So, the only option left for me is to installed another vim myself?
Thanks very much!

Sorry, it seems there is no vimx on my Ubuntu 14.04LTS.
Any other suggestions? Thanks very much!

Sorry that you do not have a vim version with the relevant option…
I am afraid that without installing by yourself a version of vim compiled with the option servername, you will not be able to send references from JabRef to vim…
You could compile vim by yourself, You may also find a suitable version on an Ubuntu repository.

Thanks a lot! I’ll try that.

Please, when you are done, post the method you finally used, so that other JabRef users can take benefit of your experience.

I found this link on Jabref mailing list. Maybe from the author of the vim support function. The message says vim needs gui mode. So I installed GVim, which is in the Ubuntu repository, on my Ubuntu 14.04LTS.
After that, I followed your instructions and invoked vim by vim --servername vim in terminal. And then, Jabref can push entry to vim successfully. So, I think the simplest way to solve my problem is to install GVim on Ubuntu.
However, it seems I must use vim -servername vim filename.tex. Otherwise, if I use vim filename.tex, Jabref still cannot push entry to vim. It is a little inconvenient. Is there any simplified way to do this?
Thanks very much!

Good to know that GVim can be easily installed on your system!

For you present issue, you can create an alias, so that typing vim actually launch vim --servername. The mechanism is explained here https://askubuntu.com/questions/1414/how-to-create-a-permanent-alias (for example).

That really helps a lot and thanks very much!
I used ls /usr/bin/vim* and found that there is one more file vim.gnome added in this direction. And it seems that actually it is vim.gnome that has the option --servername.
Could you please tell me what is the difference between invoking vim by ‘vim --servername vim’ or just vim?

When you call vim --servername MyVimServer, you can choose the name of the server (here MyVimServer). Then, you can use this name in other software, such as JabRef, so that JabRef can communicate with vim.

Many many thanks for your patient answers! That helps a lot.:+1:

You are welcome! Happy use of JabRef!