Index: term.c
===================================================================
--- term.c	(revision 1296)
+++ term.c	(working copy)
@@ -1922,7 +1922,9 @@
 #    ifdef FEAT_GUI
 	if (!gui.in_use)
 #    endif
+#    ifndef FEAT_CYGWIN_WIN32_CLIPBOARD
 	    clip_init(FALSE);
+#    endif
 #   endif
 	if (use_xterm_like_mouse(term))
 	{
Index: configure.in
===================================================================
--- configure.in	(revision 1296)
+++ configure.in	(working copy)
@@ -2023,7 +2023,21 @@
 dnl end of GUI-checking
 dnl ---------------------------------------------------------------------------
 
+dnl Check for Cygwin, which needs an extra source file if not using X11
+AC_MSG_CHECKING(for CYGWIN environment)
+case `uname` in
+    CYGWIN*)    CYGWIN=yes; AC_MSG_RESULT(yes)
+                AC_MSG_CHECKING(for CYGWIN clipboard support)
+                if test "x$with_x" = "xno" ; then
+                  AC_MSG_RESULT(yes)
+                  AC_DEFINE(FEAT_CYGWIN_WIN32_CLIPBOARD)
+                else
+                  AC_MSG_RESULT(no - using X11)
+                fi ;;
 
+    *)          CYGWIN=no; AC_MSG_RESULT(no);;
+esac
+
 dnl Only really enable hangul input when GUI and XFONTSET are available
 if test "$enable_hangulinput" = "yes"; then
   if test "x$GUITYPE" = "xNONE"; then
Index: vim.h
===================================================================
--- vim.h	(revision 1296)
+++ vim.h	(working copy)
@@ -1792,7 +1792,7 @@
     GdkAtom     gtk_sel_atom;	/* PRIMARY/CLIPBOARD selection ID */
 # endif
 
-# ifdef MSWIN
+# if defined(MSWIN) || defined(FEAT_CYGWIN_WIN32_CLIPBOARD)
     int_u	format;		/* Vim's own special clipboard format */
     int_u	format_raw;	/* Vim's raw text clipboard format */
 # endif
Index: feature.h
===================================================================
--- feature.h	(revision 1296)
+++ feature.h	(working copy)
@@ -1066,6 +1066,11 @@
  * +xterm_clipboard	Unix only: Include code for handling the clipboard
  *			in an xterm like in the GUI.
  */
+
+#ifdef FEAT_CYGWIN_WIN32_CLIPBOARD
+# define FEAT_CLIPBOARD
+#endif
+
 #ifdef FEAT_GUI
 # ifndef FEAT_CLIPBOARD
 #  define FEAT_CLIPBOARD
Index: Makefile
===================================================================
--- Makefile	(revision 1296)
+++ Makefile	(working copy)
@@ -1467,6 +1467,7 @@
 	objects/ops.o \
 	objects/option.o \
 	objects/os_unix.o \
+	objects/os_mswin.o \
 	objects/pathdef.o \
 	objects/popupmnu.o \
 	objects/quickfix.o \
@@ -2498,6 +2499,9 @@
 objects/os_unix.o: os_unix.c
 	$(CCC) -o $@ os_unix.c
 
+objects/os_mswin.o: os_mswin.c
+	$(CCC) -o $@ os_mswin.c
+
 objects/pathdef.o: auto/pathdef.c
 	$(CCC) -o $@ auto/pathdef.c
 
Index: config.h.in
===================================================================
--- config.h.in	(revision 1296)
+++ config.h.in	(working copy)
@@ -378,3 +378,6 @@
 
 /* Define if you want XSMP interaction as well as vanilla swapfile safety */
 #undef USE_XSMP_INTERACT
+
+/* Define if you want Cygwin to use the WIN32 clipboard, not compatible with X11*/
+#undef FEAT_CYGWIN_WIN32_CLIPBOARD
Index: mbyte.c
===================================================================
--- mbyte.c	(revision 1296)
+++ mbyte.c	(working copy)
@@ -591,7 +591,7 @@
     enc_dbcs = enc_dbcs_new;
     has_mbyte = (enc_dbcs != 0 || enc_utf8);
 
-#ifdef WIN3264
+#if defined(WIN3264) || defined(FEAT_CYGWIN_WIN32_CLIPBOARD)
     enc_codepage = encname2codepage(p_enc);
     enc_latin9 = (STRCMP(p_enc, "iso-8859-15") == 0);
 #endif
@@ -3146,7 +3146,7 @@
     return enc_canonize((char_u *)buf);
 }
 
-#if defined(WIN3264) || defined(PROTO)
+#if defined(WIN3264) || defined(PROTO) || defined(FEAT_CYGWIN_WIN32_CLIPBOARD)
 /*
  * Convert an encoding name to an MS-Windows codepage.
  * Returns zero if no codepage can be figured out.
Index: os_unix.c
===================================================================
--- os_unix.c	(revision 1296)
+++ os_unix.c	(working copy)
@@ -1156,6 +1156,9 @@
 #ifdef MACOS_CONVERT
     mac_conv_init();
 #endif
+#ifdef FEAT_CYGWIN_WIN32_CLIPBOARD
+    win_clip_init();
+#endif
 }
 
     static void
Index: os_mswin.c
===================================================================
--- os_mswin.c	(revision 1296)
+++ os_mswin.c	(working copy)
@@ -25,6 +25,18 @@
 #include "vimio.h"
 #include "vim.h"
 
+/* compile only the clipboard handling features when
+ * compiling for cygwin posix environment.
+ */
+#ifdef FEAT_CYGWIN_WIN32_CLIPBOARD
+# define WIN3264
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+# include "proto/os_mswin.pro"
+#endif
+
+#if !defined(FEAT_CYGWIN_WIN32_CLIPBOARD)
+
 #ifdef WIN16
 # define SHORT_FNAME		/* always 8.3 file name */
 # include <dos.h>
@@ -889,6 +901,8 @@
 }
 #endif
 
+#endif /* !defined(FEAT_CYGWIN_WIN32_CLIPBOARD) */
+
 #if defined(FEAT_MBYTE) || defined(PROTO)
 /*
  * Convert an UTF-8 string to UTF-16.
@@ -1031,6 +1045,21 @@
  * Clipboard stuff, for cutting and pasting text to other windows.
  */
 
+    void
+win_clip_init(void)
+{
+    clip_init(TRUE);
+
+    /*
+     * Vim's own clipboard format recognises whether the text is char, line,
+     * or rectangular block.  Only useful for copying between two Vims.
+     * "VimClipboard" was used for previous versions, using the first
+     * character to specify MCHAR, MLINE or MBLOCK.
+     */
+    clip_star.format = RegisterClipboardFormat("VimClipboard2");
+    clip_star.format_raw = RegisterClipboardFormat("VimRawBytes");
+}
+
 /* Type used for the clipboard type of Vim's data. */
 typedef struct
 {
@@ -1599,6 +1628,7 @@
 
 #endif /* FEAT_CLIPBOARD */
 
+#if !defined(FEAT_CYGWIN_WIN32_CLIPBOARD)
 
 /*
  * Debugging helper: expose the MCH_WRITE_DUMP stuff to other modules
@@ -3469,3 +3499,5 @@
 }
 
 #endif /* defined(FEAT_GUI) || defined(FEAT_PRINTER) */
+
+#endif /* !defined(FEAT_CYGWIN_WIN32_CLIPBOARD) */
Index: os_win32.c
===================================================================
--- os_win32.c	(revision 1296)
+++ os_win32.c	(working copy)
@@ -1679,16 +1679,7 @@
 	set_option_value((char_u *)"grepprg", 0, (char_u *)"grep -n", 0);
 
 #ifdef FEAT_CLIPBOARD
-    clip_init(TRUE);
-
-    /*
-     * Vim's own clipboard format recognises whether the text is char, line,
-     * or rectangular block.  Only useful for copying between two Vims.
-     * "VimClipboard" was used for previous versions, using the first
-     * character to specify MCHAR, MLINE or MBLOCK.
-     */
-    clip_star.format = RegisterClipboardFormat("VimClipboard2");
-    clip_star.format_raw = RegisterClipboardFormat("VimRawBytes");
+    win_clip_init();
 #endif
 }
 
@@ -2171,16 +2162,7 @@
 #endif
 
 #ifdef FEAT_CLIPBOARD
-    clip_init(TRUE);
-
-    /*
-     * Vim's own clipboard format recognises whether the text is char, line, or
-     * rectangular block.  Only useful for copying between two Vims.
-     * "VimClipboard" was used for previous versions, using the first
-     * character to specify MCHAR, MLINE or MBLOCK.
-     */
-    clip_star.format = RegisterClipboardFormat("VimClipboard2");
-    clip_star.format_raw = RegisterClipboardFormat("VimRawBytes");
+    win_clip_init();
 #endif
 
     /* This will be NULL on anything but NT 4.0 */
Index: auto/configure
===================================================================
--- auto/configure	(revision 1296)
+++ auto/configure	(working copy)
@@ -10218,7 +10218,29 @@
 
 
 
+echo "$as_me:$LINENO: checking for CYGWIN environment" >&5
+echo $ECHO_N "checking for CYGWIN environment... $ECHO_C" >&6
+case `uname` in
+    CYGWIN*)    CYGWIN=yes; echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+                echo "$as_me:$LINENO: checking for CYGWIN clipboard support" >&5
+echo $ECHO_N "checking for CYGWIN clipboard support... $ECHO_C" >&6
+                if test "x$with_x" = "xno" ; then
+                  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+                  cat >>confdefs.h <<\_ACEOF
+#define FEAT_CYGWIN_WIN32_CLIPBOARD 1
+_ACEOF
 
+                else
+                  echo "$as_me:$LINENO: result: no - using X11" >&5
+echo "${ECHO_T}no - using X11" >&6
+                fi ;;
+
+    *)          CYGWIN=no; echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6;;
+esac
+
 if test "$enable_hangulinput" = "yes"; then
   if test "x$GUITYPE" = "xNONE"; then
     { $as_echo "$as_me:$LINENO: result: no GUI selected; hangul input has been disabled" >&5
Index: globals.h
===================================================================
--- globals.h	(revision 1296)
+++ globals.h	(working copy)
@@ -769,7 +769,7 @@
 EXTERN int	enc_unicode INIT(= 0);	/* 2: UCS-2 or UTF-16, 4: UCS-4 */
 EXTERN int	enc_utf8 INIT(= FALSE);		/* UTF-8 encoded Unicode */
 EXTERN int	enc_latin1like INIT(= TRUE);	/* 'encoding' is latin1 comp. */
-# ifdef WIN3264
+# if defined(WIN3264) || defined(FEAT_CYGWIN_WIN32_CLIPBOARD)
 /* Codepage nr of 'encoding'.  Negative means it's not been set yet, zero
  * means 'encoding' is not a valid codepage. */
 EXTERN int	enc_codepage INIT(= -1);
