1

Following to this question, I discovered that I can use --servername <name> and --remote on my console vim executable under Cygwin.

So I installed vim-common vim and gvim and I do not have such options in /bin/vim. There are only available with /bin/gvim. Unfortunately I do not want to use the gvim version of vim.

I thought the problem was that vim was not build with the X support. So I built Vim from scratch with ./configure --with-x. This does not change anything.

How can I use vim server on the console version of Vim?

2 Answers 2

2

Make sure libX11-devel and libXt-devel are installed. If your installation of cygwin is up to date, you might have to patch src/mbyte.c to compile Vim 7.4 with +clientserver and +X11.

check libX11-devel and libXt-devel

# vim configure log
#$ grep X_LIB src/auto/config.log
GUI_X_LIBS=''
X_LIB='-lXt -lX11'
X_LIBS=' '

# cygwin
#$ cygcheck.exe -c | grep libX11-devel
libX11-devel                            1.6.3-1                          OK
#$ cygcheck.exe -c | grep libXt-devel
libXt-devel                             1.1.4-2                          OK

Apply Lech Lorens src/mbyte.c patch

https://groups.google.com/forum/#!topic/vim_dev/OJjnbKQ7oYU

diff --git a/src/mbyte.c b/src/mbyte.c
 index 6340992..cb14a25 100644
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -83,10 +83,18 @@
 # ifndef WIN32_LEAN_AND_MEAN
 #  define WIN32_LEAN_AND_MEAN
 # endif
-# include <windows.h>
+# if defined(FEAT_GUI) || defined(FEAT_XCLIPBOARD)
+#  include <X11/Xwindows.h>
+#  define WINBYTE wBYTE
+# else
+#  include <windows.h>
+#  define WINBYTE BYTE
+# endif
 # ifdef WIN32
 #  undef WIN32     /* Some windows.h define WIN32, we don't want that here. */
 # endif
+#else
+# define WINBYTE BYTE
 #endif

 #if (defined(WIN3264) || defined(WIN32UNIX)) && !defined(__MINGW32__)
@@ -698,7 +706,7 @@ codepage_invalid:
        /* enc_dbcs is set by setting 'fileencoding'.  It becomes a Windows
     * CodePage identifier, which we can pass directly in to Windows
     * API */
-       n = IsDBCSLeadByteEx(enc_dbcs, (BYTE)i) ? 2 : 1;
+       n = IsDBCSLeadByteEx(enc_dbcs, (WINBYTE)i) ? 2 : 1;
 #else
 # if defined(MACOS) || defined(__amigaos4__)
    /*

compile Vim 7.4 +clientserver +X11

#$./configure --with-x
#$ make
#$ ./src/vim.exe --version
VIM - Vi IMproved 7.4 

Normal version without GUI.  Features included (+) or not (-):

+clientserver    -hangul_input    +netbeans_intg   +title

+digraphs        +mksession       +scrollbind      +X11

#$ ./src/vim.exe --serverlist
TEST
1
  • Good point. I was missing libXt-devel. Now I have +X11 with my Vim. Unfortunately I still did not finished the game. If I start a session with ./vim --servername foo and in another term I test ./vim --serverlist I don't see the foo server. My X-server is running and I can execute xeyes on both terminals.
    – nowox
    May 28, 2015 at 7:11
2

Assuming you have a properly compiled instance of Vim, you have to run the cygwin X server. I have mine set to start when I log in to my Windows machine, with the command line:

C:\cygwin64\bin\XWin.exe -multiwindow

Then I make sure I have DISPLAY set in my ~/.bash_profile:

DISPLAY=:0.0; export DISPLAY

This has the added benefit that I can use cygwin's gVim, although I tend to prefer a native Windows gVim instance.

1
  • Done. I've added this to my startup's script. I always did startxwin& before without knowing what I was doing...
    – nowox
    May 28, 2015 at 7:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .