RE: gVim and Cygwin
-Original Message- From: Waters, Bill [mailto:[EMAIL PROTECTED] Sent: Friday, March 30, 2007 18:06 To: vim@vim.org Subject: gVim and Cygwin Does anyone have experience with running gVim and using Cygwin commands (ex. indent)? I would prefer not to run vim in a Cygwin terminal, unless someone has all of the configurations needed (syntax highlighting, etc) to have that act like gVim. I use the UnxUtils package: http://unxutils.sourceforge.net/ It includes all of the commands I need and accepts forward slashes as well as backslashes. I use these commands from the standard precompiled gvim.exe from vim.org. I have cygwin as well, but it is later in my %PATH%. Although technically not an answer to your question, I think this is the best solution to your problem. Best regards, Robert PS: Actually I use the Labrat Toolkit which includes the UnxUtils package, but labrattech.com seems to have issues with php syntax at the moment. When they are up and running again you must check this out.
Re: gVim and Cygwin
On 30-Mar-2007 21:23, A.J.Mechelynck wrote: OTOH, since (IIRC) builds of Vim available on the Cygwin site are usually console builds, to get a Cygwin/X11 build of gvim you would have to compile it yourself. Actually, an X11 gvim *is* available using Cygwin's setup.exe. It's not installed by default, but it is listed, under the 'Editors' category. - Michael
Re: gVim and Cygwin
David Fishburn wrote: -Original Message- From: A.J.Mechelynck [mailto:[EMAIL PROTECTED] Sent: Friday, March 30, 2007 6:42 PM To: Charles E Campbell Jr Cc: Waters, Bill; vim@vim.org Subject: Re: gVim and Cygwin Charles E Campbell Jr wrote: Waters, Bill wrote: Does anyone have experience with running gVim and using Cygwin commands (ex. indent)? I would prefer not to run vim in a Cygwin terminal, unless someone has all of the configurations needed (syntax highlighting, etc) to have that act like gVim. I generally compile both gvim and vim under cygwin, and haven't run into any problems. I haven't used indent, though. The problems I generally have had have been with Windows' paths and trying to get netrw to understand them properly, but that's not because of gvim and cygwin. If you already have cygwin, just get vim 7.0 source, and go to its source directory. gmake -f Make_cyg.mak will make gvim.exe by default. Edit Make_cyg.mak, and change GUI=yes to GUI=no, and type the same command above. That way you'll get vim.exe. Its really quite straightforward! Regards, Chip Campbell Make_cyg.mak uses Cygwin tools to (cross-) compile a native-Windows Vim or gvim which doesn't need Cygwin to run and doesn't understand the POSIX paths of cygwin. It won't interface easily with Cygwin bash (or any other Cygwin program for that matter). To compile a Unix-like Vim for Cygwin you must use the top-level Makefile or the src/Makefile which will invoke a configure step. If configure finds the necessary headers and libraries it may compile a GUI version of Vim, which will need Cygwin to run, and X11 to display a GUI. Hmm, based on your response and Gary's (libncurses-devel) and this post: http://www.cygwin.com/ml/cygwin/2003-06/msg00886.html I ran the following: cd /c/OpenSrc/vim7/src ./configure \ --prefix=/usr \ --sysconfdir=/etc \ --libexecdir='$(sbindir)' \ --localstatedir=/var \ --datadir='$(prefix)/share' \ --enable-multibyte \ --without-x \ --enable-gui=no This results in: ./configure: line 3: $'\r': command not found auto/configure: line 11: $'\r': command not found auto/configure: line 19: syntax error near unexpected token `elif' auto/configure: line 19: `elif test -n ${BASH_VERSION+set} (set -o posix) 'dev/null 21; then ./configure: line 6: $'\r': command not found ./configure: line 11: syntax error: unexpected end of file I have never tried this before, I am wondering if it is related to dos line endings? Could be. Try converting all of those to Unix line endings, e.g. with something like (untested) make distclean vim -u NONE -N -cmd set ffs= ff=dos src/* -c bufdo setlocal ff=unix|w -c q I pulled the source from a win32 SVN client. It is the same directory I compile for win32 from. Any suggestions? Thanks, Dave Best regards, Tony. -- Brain, v. [as in to brain]: To rebuke bluntly, but not pointedly; to dispel a source of error in an opponent. -- Ambrose Bierce, The Devil's Dictionary
Re: gVim and Cygwin
Cc to list. Next time, please use bottom-posting or inter-posting in preference to top-posting, and Reply to All or Reply to List in preference to Reply to Sender. ben lieb wrote: I've had no real problems. I use cygwin. I type 'startx' to run the x terminal. Then I run 'gvim' from that. As far as 'indent', it is not a bash command, it is a program that may have to be installed with the cygwin package manager. Either way, I don't have file or path translation problems. It doesn't, if invoked from bash or from some other cygwin program (including a Cygwin build of console Vim or a Cygwin/X11 build of gvim). If invoked from a Windows-native build of gvim, the user would have to make sure that what gvim thinks of as C:\Documents and Settings\johndoe\foobar.c gets translated to /home/johndoe/foobar.c or /cygdrive/c/Documents\ and\ Settings/johndoe/foobar.c -- or even /cygdrive/c/DOCUME~1/johndoe/foobar.c -- when invoking Cygwin indent. OTOH, since (IIRC) builds of Vim available on the Cygwin site are usually console builds, to get a Cygwin/X11 build of gvim you would have to compile it yourself. Best regards, Tony. -- Being disintegrated makes me ve-ry an-gry! huff, huff
Re: gVim and Cygwin
Waters, Bill wrote: Does anyone have experience with running gVim and using Cygwin commands (ex. indent)? I would prefer not to run vim in a Cygwin terminal, unless someone has all of the configurations needed (syntax highlighting, etc) to have that act like gVim. I generally compile both gvim and vim under cygwin, and haven't run into any problems. I haven't used indent, though. The problems I generally have had have been with Windows' paths and trying to get netrw to understand them properly, but that's not because of gvim and cygwin. If you already have cygwin, just get vim 7.0 source, and go to its source directory. gmake -f Make_cyg.mak will make gvim.exe by default. Edit Make_cyg.mak, and change GUI=yes to GUI=no, and type the same command above. That way you'll get vim.exe. Its really quite straightforward! Regards, Chip Campbell
Re: gVim and Cygwin
On 2007-03-30, Charles E Campbell Jr [EMAIL PROTECTED] wrote: Waters, Bill wrote: Does anyone have experience with running gVim and using Cygwin commands (ex. indent)? I would prefer not to run vim in a Cygwin terminal, unless someone has all of the configurations needed (syntax highlighting, etc) to have that act like gVim. I generally compile both gvim and vim under cygwin, and haven't run into any problems. I haven't used indent, though. The problems I generally have had have been with Windows' paths and trying to get netrw to understand them properly, but that's not because of gvim and cygwin. If you already have cygwin, just get vim 7.0 source, and go to its source directory. gmake -f Make_cyg.mak will make gvim.exe by default. Edit Make_cyg.mak, and change GUI=yes to GUI=no, and type the same command above. That way you'll get vim.exe. Its really quite straightforward! To build a console vim that used color, I had to also install the Cygwin libncurses-devel package. HTH, Gary -- Gary Johnson | Agilent Technologies [EMAIL PROTECTED] | Mobile Broadband Division | Spokane, Washington, USA
Re: gVim and Cygwin
Charles E Campbell Jr wrote: Waters, Bill wrote: Does anyone have experience with running gVim and using Cygwin commands (ex. indent)? I would prefer not to run vim in a Cygwin terminal, unless someone has all of the configurations needed (syntax highlighting, etc) to have that act like gVim. I generally compile both gvim and vim under cygwin, and haven't run into any problems. I haven't used indent, though. The problems I generally have had have been with Windows' paths and trying to get netrw to understand them properly, but that's not because of gvim and cygwin. If you already have cygwin, just get vim 7.0 source, and go to its source directory. gmake -f Make_cyg.mak will make gvim.exe by default. Edit Make_cyg.mak, and change GUI=yes to GUI=no, and type the same command above. That way you'll get vim.exe. Its really quite straightforward! Regards, Chip Campbell Make_cyg.mak uses Cygwin tools to (cross-) compile a native-Windows Vim or gvim which doesn't need Cygwin to run and doesn't understand the POSIX paths of cygwin. It won't interface easily with Cygwin bash (or any other Cygwin program for that matter). To compile a Unix-like Vim for Cygwin you must use the top-level Makefile or the src/Makefile which will invoke a configure step. If configure finds the necessary headers and libraries it may compile a GUI version of Vim, which will need Cygwin to run, and X11 to display a GUI. Best regards, Tony. -- hundred-and-one symptoms of being an internet addict: 153. You find yourself staring at your inbox waiting for new e-mail to arrive.
RE: gVim and Cygwin
-Original Message- From: A.J.Mechelynck [mailto:[EMAIL PROTECTED] Sent: Friday, March 30, 2007 6:42 PM To: Charles E Campbell Jr Cc: Waters, Bill; vim@vim.org Subject: Re: gVim and Cygwin Charles E Campbell Jr wrote: Waters, Bill wrote: Does anyone have experience with running gVim and using Cygwin commands (ex. indent)? I would prefer not to run vim in a Cygwin terminal, unless someone has all of the configurations needed (syntax highlighting, etc) to have that act like gVim. I generally compile both gvim and vim under cygwin, and haven't run into any problems. I haven't used indent, though. The problems I generally have had have been with Windows' paths and trying to get netrw to understand them properly, but that's not because of gvim and cygwin. If you already have cygwin, just get vim 7.0 source, and go to its source directory. gmake -f Make_cyg.mak will make gvim.exe by default. Edit Make_cyg.mak, and change GUI=yes to GUI=no, and type the same command above. That way you'll get vim.exe. Its really quite straightforward! Regards, Chip Campbell Make_cyg.mak uses Cygwin tools to (cross-) compile a native-Windows Vim or gvim which doesn't need Cygwin to run and doesn't understand the POSIX paths of cygwin. It won't interface easily with Cygwin bash (or any other Cygwin program for that matter). To compile a Unix-like Vim for Cygwin you must use the top-level Makefile or the src/Makefile which will invoke a configure step. If configure finds the necessary headers and libraries it may compile a GUI version of Vim, which will need Cygwin to run, and X11 to display a GUI. Hmm, based on your response and Gary's (libncurses-devel) and this post: http://www.cygwin.com/ml/cygwin/2003-06/msg00886.html I ran the following: cd /c/OpenSrc/vim7/src ./configure \ --prefix=/usr \ --sysconfdir=/etc \ --libexecdir='$(sbindir)' \ --localstatedir=/var \ --datadir='$(prefix)/share' \ --enable-multibyte \ --without-x \ --enable-gui=no This results in: ./configure: line 3: $'\r': command not found auto/configure: line 11: $'\r': command not found auto/configure: line 19: syntax error near unexpected token `elif' auto/configure: line 19: `elif test -n ${BASH_VERSION+set} (set -o posix) 'dev/null 21; then ./configure: line 6: $'\r': command not found ./configure: line 11: syntax error: unexpected end of file I have never tried this before, I am wondering if it is related to dos line endings? I pulled the source from a win32 SVN client. It is the same directory I compile for win32 from. Any suggestions? Thanks, Dave
Re: gVim and Cygwin
On 2007-03-30, David Fishburn [EMAIL PROTECTED] wrote: -Original Message- From: A.J.Mechelynck [mailto:[EMAIL PROTECTED] Sent: Friday, March 30, 2007 6:42 PM To compile a Unix-like Vim for Cygwin you must use the top-level Makefile or the src/Makefile which will invoke a configure step. If configure finds the necessary headers and libraries it may compile a GUI version of Vim, which will need Cygwin to run, and X11 to display a GUI. Hmm, based on your response and Gary's (libncurses-devel) and this post: http://www.cygwin.com/ml/cygwin/2003-06/msg00886.html I ran the following: cd /c/OpenSrc/vim7/src ./configure \ --prefix=/usr \ --sysconfdir=/etc \ --libexecdir='$(sbindir)' \ --localstatedir=/var \ --datadir='$(prefix)/share' \ --enable-multibyte \ --without-x \ --enable-gui=no This results in: ./configure: line 3: $'\r': command not found auto/configure: line 11: $'\r': command not found auto/configure: line 19: syntax error near unexpected token `elif' auto/configure: line 19: `elif test -n ${BASH_VERSION+set} (set -o posix) 'dev/null 21; then ./configure: line 6: $'\r': command not found ./configure: line 11: syntax error: unexpected end of file I have never tried this before, I am wondering if it is related to dos line endings? I pulled the source from a win32 SVN client. It is the same directory I compile for win32 from. Any suggestions? I haven't had this problem myself, but from what I've seen posted to the cygwin list, this looks like a line-ending problem. You can be pretty sure it didn't come from any file installed with setup.exe unless you edited some file with WordPad, for example, that changes LF endings to CR-LF. Something else that can mess you up is using WinZip to unzip a package. While the option can be changed, WizZip's default behavior is to change all text file line endings to CR-LF. The 'file' command will show you the type of line endings that each file has, and 'd2u' will convert CR-LF endings to LF. Regards, Gary -- Gary Johnson | Agilent Technologies [EMAIL PROTECTED] | Mobile Broadband Division | Spokane, Washington, USA
Re: gVim and Cygwin
Waters, Bill wrote: Does anyone have experience with running gVim and using Cygwin commands (ex. indent)? I would prefer not to run vim in a Cygwin terminal, unless someone has all of the configurations needed (syntax highlighting, etc) to have that act like gVim. Thanks, Bill I do use gVim and cygwin. For using the cygwin bash shell instead of the regular Windows DOS prompt, I use the following in my _vimrc: :set shell=c:\cygwin\cygwin.bat The only problem I have is that I have to type the command twice. The first time opens the shell, the second will insert the result of the command. For example to insert the current date, I do the following: :r!date enter date enter exit enter On my Mac OS X box, I can just type :r!date
Re: Running win32 vim and gvim under Cygwin and pure Windows XP
On 2006-07-27, Luc Hermitte [EMAIL PROTECTED] wrote: More over I don't have any c:/ drive, and the shell can be anything. I'm having a little trouble understanding how the shell can be anything. What I think you're saying, and what I've understood from reading your web pages, is that you launch Cygwin programs from within vim using a set of macros, and that if you execute :sh or :! you will be using Windows' cmd.exe. Is that true? What I've been trying to achieve is a vim configuration that looks and feels the same under Cygwin as it does under Linux or Solaris; so for example, executing :sh gives me a Cygwin bash shell and executing :r !ls inserts the contents of the current directory into the current buffer. BTW, we can also detect cygwin presence with executable('cygpath') ; as long as cygwin paths are in the $PATH, because the windows box is set to have cygwin in the $PATH, or because vim is launched from cygwin. I was trying to allow vim to distinguish between being started from a bash shell or from the Command Prompt. The executable('cygpath') test will give the wrong answer if C:\cygwin\bin is in the Windows PATH. The problem is deeper than just having the right vim executable. There are many different vim executables running on various system. As plugin writers, we have to make our plugins portable. Discarding one vim binary because there is another (patched) one that is compatible with the plugin is not the solution. Note: in case you are interrested, you will found on my web site: - a shell script that lauches win32-vim from cygwin and that translates pathnames (and only pathnames) - cyg-wrapper.sh - a plugin that provides a few functions to detect the current system - .vimrc specific settings according to the current box vim is running on - a few plugins that call external programs (lh-vim-spell, triggers) - a compiler plugin-filter for cygwin that translates :make outputs from posix pathnames to windows pathnames. (- experimental plugin BuildToolWrapper (lh-BTW.tar.gz in vim/ressources/) This is great! Thank you for the pointers. I'm still reading and digesting this and the results of a few related Google searches. I think I will be using your cyg-wrapper.sh script and your aliases for vim, gvim and explorer. I just installed rxvt using Cygwin setup.exe and it seems to work fine except when I execute vim: then my CPU usage goes to 50% and I can see vim.exe in the Task Manager process list, but vim never appears in the rxvt window. I finally just kill vim with ^C in the rxvt window. I can execute vim from the Command Prompt and from the Cygwin prompt, and I can execute gvim from all three. I have been executing vim as vim -u NONE so the problem shouldn't be any of my vim files. Using -V20 didn't show anything, either. Any idea why I can't run vim from rxvt? Regards, Gary -- Gary Johnson | Agilent Technologies [EMAIL PROTECTED] | Wireless Division | Spokane, Washington, USA
Re: Running win32 vim and gvim under Cygwin and pure Windows XP
Hello, Gary Johnson [EMAIL PROTECTED] wrote: On 2006-07-27, Luc Hermitte [EMAIL PROTECTED] wrote: More over I don't have any c:/ drive, and the shell can be anything. I'm having a little trouble understanding how the shell can be anything. I just meant it can be bash, sh, tcsh, ksh, ... In a general way, we cannot assume it is always bash. What I think you're saying, and what I've understood from reading your web pages, is that you launch Cygwin programs from within vim using a set of macros, and that if you execute :sh or :! you will be using Windows' cmd.exe. Is that true? No. The only times I use $COMSPEC as my main shell (from vim - 'shell') is when I test my plugins under different environments. I have two commands :GoBash and :GoCmd when I need to switch the current shell, which is quite always bash -- I used to use zsh for a few years. What I've been trying to achieve is a vim configuration that looks and feels the same under Cygwin as it does under Linux or Solaris; so for example, executing :sh gives me a Cygwin bash shell and executing :r !ls inserts the contents of the current directory into the current buffer. That's the easiest part. However, it will become tricky when you will have to convert posix pathss to windows paths, assuming you are using win32-vim. This path convertions issue is what motivated cyg-wrapper.sh and one of the compiler-filter plugins from BuildToolWrapper. If you want to have the exact same look and feel, using cygwin-vim is probably the best solution. BTW, we can also detect cygwin presence with executable('cygpath') ; as long as cygwin paths are in the $PATH, because the windows box is set to have cygwin in the $PATH, or because vim is launched from cygwin. I was trying to allow vim to distinguish between being started from a bash shell or from the Command Prompt. The executable('cygpath') test will give the wrong answer if C:\cygwin\bin is in the Windows PATH. IIRC, then test if shell =~ '^.*sh'. Vim uses as the default shell the shell it as been launched from. I will have a look at it tonight on the box I have cygwin installed. (NB for plugin writers: the tricky part with just testing '^.*sh' is that there are other ports of *nix tools to windows ; I guess a better test would be sh =~ '^.*sh' globpath(substitute($PATH, ':',',','g'), sh) =~ '.*cygwin') [...] This is great! Thank you for the pointers. You're welcome. I think I will be using your cyg-wrapper.sh script and your aliases for vim, gvim and explorer. If you have any comment, do not hesitate. I just installed rxvt using Cygwin setup.exe and it seems to work fine except when I execute vim: then my CPU usage goes to 50% and I can see vim.exe in the Task Manager process list, but vim never appears in the rxvt window. I finally just kill vim with ^C in the rxvt window. I can execute vim from the Command Prompt and from the Cygwin prompt, and I can execute gvim from all three. I have been executing vim as vim -u NONE so the problem shouldn't be any of my vim files. Using -V20 didn't show anything, either. Any idea why I can't run vim from rxvt? As I never use rxvt, I cannot help you here. We will have to know which version of vim you are using: cygwin-vim or vim32-vim ? In the former case, may be you can try to start vim with the -X option (- do not try to connect to the X server) -- Luc Hermitte
Re: Running win32 vim and gvim under Cygwin and pure Windows XP
On 2006-07-31, [EMAIL PROTECTED] wrote: Gary Johnson [EMAIL PROTECTED] wrote: I just installed rxvt using Cygwin setup.exe and it seems to work fine except when I execute vim: then my CPU usage goes to 50% and I can see vim.exe in the Task Manager process list, but vim never appears in the rxvt window. I finally just kill vim with ^C in the rxvt window. I can execute vim from the Command Prompt and from the Cygwin prompt, and I can execute gvim from all three. I have been executing vim as vim -u NONE so the problem shouldn't be any of my vim files. Using -V20 didn't show anything, either. Any idea why I can't run vim from rxvt? As I never use rxvt, I cannot help you here. We will have to know which version of vim you are using: cygwin-vim or vim32-vim ? In the former case, may be you can try to start vim with the -X option (- do not try to connect to the X server) I am using the win32 version. I even tried launching that version with -X, just in case, but as you might expect, it made no difference. Thanks, Gary -- Gary Johnson | Agilent Technologies [EMAIL PROTECTED] | Wireless Division | Spokane, Washington, USA
Re: Running win32 vim and gvim under Cygwin and pure Windows XP
Hello, I run vim on Solaris, Linux and Cygwin (actually I use only the win32 native version of vim, generally the one compiled by Tony). And I have one set of scripts for all systems. * On Tue, Jul 25, 2006 at 12:14:43AM -0700, Gary Johnson [EMAIL PROTECTED] wrote: To that end, I have done a standard install of Cygwin, installed the standard vim for Windows from vim.sf.net, put C:\Program Files\Vim\vim70 in my Windows PATH, added export SHELL to my $HOME/.bash_profile, and added the following lines to the top of my _vimrc (C:\Program Files\Vim\_vimrc): if has(win32) $SHELL == /bin/bash executable(C:/cygwin/bin/bash) Running in Cygwin. I though I was detecting cygwin presence on $CYGWIN -- as it is more likelly to be widelly spread. But it seems I'm using either $OSTYPE or $TERM. More over I don't have any c:/ drive, and the shell can be anything. BTW, we can also detect cygwin presence with executable('cygpath') ; as long as cygwin paths are in the $PATH, because the windows box is set to have cygwin in the $PATH, or because vim is launched from cygwin. In addition, I have found it necessary to make some changes to some plugins (ctags.vim and ccase.vim) following this example in $VIMRUNTIME/ftplugin/perl.vim: Indeed. Plugins need to transform a few things in order to be portable. In my plugin system_utils.vim, I provide a few functions that help in that purpose. I use them in my other plugins when I need to call external programs like aspell, mkdir, ... So my questions to anyone else using Vim and Cygwin on Windows XP are: Does what I'm doing make sense? Yes. Is there some way to fix the 'shellxquote' problem other than modifying every plugin I use as I've done above? None that I know of. Is there a better way of doing any of this? I suppose I could build a Cygwin-aware vim binary, but I have successfully avoided having to compile anything under Windows so far and would really like to avoid that headache. The problem is deeper than just having the right vim executable. There are many different vim executables running on various system. As plugin writers, we have to make our plugins portable. Discarding one vim binary because there is another (patched) one that is compatible with the plugin is not the solution. Note: in case you are interrested, you will found on my web site: - a shell script that lauches win32-vim from cygwin and that translates pathnames (and only pathnames) - cyg-wrapper.sh - a plugin that provides a few functions to detect the current system - .vimrc specific settings according to the current box vim is running on - a few plugins that call external programs (lh-vim-spell, triggers) - a compiler plugin-filter for cygwin that translates :make outputs from posix pathnames to windows pathnames. (- experimental plugin BuildToolWrapper (lh-BTW.tar.gz in vim/ressources/) HTH, -- Luc Hermitte http://hermitte.free.fr/vim/
Re: Running win32 vim and gvim under Cygwin and pure Windows XP
Luc Hermitte wrote: Hello, I run vim on Solaris, Linux and Cygwin (actually I use only the win32 native version of vim, generally the one compiled by Tony). [...] I'm not distributing them anymore at the moment. My latest Vim for Windows was a v7.0aa ALPHA, now outdated. Please fall back on those compiled by Steve Hall https://sourceforge.net/project/showfiles.php?group_id=43866package_id=39721 . As I'm writing this I see a 7.0.42 listed there for downloading: that's currently the latest version and patchlevel. Note: That page belongs to the Cream sourceforge project but it's not the Cream download, it's the Vim download, with standard gvim and runtime files. Clicking Notes shows you the gvim :version listing: Big version, +ole -mzscheme +perl/dyn +python/dyn +ruby/dyn +tcl/dyn Best regards, Tony.
Running win32 vim and gvim under Cygwin and pure Windows XP
Most of my development work is done on a Unix system (usually SunOS but sometimes Linux or HP-UX), but some requires that I use Windows XP. Source code is maintained under ClearCase on all these systems except Linux. I'm trying to get my Windows environment tuned up so that development is as easy for me using Windows as it already is using Unix. One thing I've done is installed Cygwin. This has been really nice, but I can't always use the Cygwin environment because of all the tools and applications that understand only Windows. So the environment I think I want is this: when I open gvim from a Windows tool or application, I get a Windows gvim that executes system(), :sh, :!, :r!, etc. in a Windows environment; but when I start vim or gvim from the Cygwin shell, I get the same Windows vim or gvim executable, but one which executes system(), etc., in the Cygwin environment, i.e., pretty much as it would in a real Unix environment. To that end, I have done a standard install of Cygwin, installed the standard vim for Windows from vim.sf.net, put C:\Program Files\Vim\vim70 in my Windows PATH, added export SHELL to my $HOME/.bash_profile, and added the following lines to the top of my _vimrc (C:\Program Files\Vim\_vimrc): if has(win32) $SHELL == /bin/bash executable(C:/cygwin/bin/bash) Running in Cygwin. set shell=C:/cygwin/bin/bash if executable('grep') set grepprg=grep\ -n\ $*\ /dev/null endif if exists(+shellslash) set shellslash endif else set diffexpr=MyDiff() function MyDiff() let opt = '-a --binary ' if diffopt =~ 'icase' | let opt = opt . '-i ' | endif if diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif let arg1 = v:fname_in if arg1 =~ ' ' | let arg1 = '' . arg1 . '' | endif let arg2 = v:fname_new if arg2 =~ ' ' | let arg2 = '' . arg2 . '' | endif let arg3 = v:fname_out if arg3 =~ ' ' | let arg3 = '' . arg3 . '' | endif let eq = '' if $VIMRUNTIME =~ ' ' if sh =~ '\cmd' let cmd = '' . $VIMRUNTIME . '\diff' let eq = '' else let cmd = substitute($VIMRUNTIME, ' ', ' ', '') . '\diff' endif else let cmd = $VIMRUNTIME . '\diff' endif silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' ' . arg3 . eq endfunction endif where the outer else clause encloses vim's default MyDiff() for Windows installations. In addition, I have found it necessary to make some changes to some plugins (ctags.vim and ccase.vim) following this example in $VIMRUNTIME/ftplugin/perl.vim: if shellxquote != '' let perlpath = system('perl -e print join(q/,/,@INC)') else let perlpath = system(perl -e 'print join(q/,/,@INC)') endif Vim automatically sets 'shellxquote' to when 'shell' is set to the Cygwin shell. Without this, system() commands don't handle temporary files properly. With this, however, you have to use single-quotes (') instead of double-quotes () in system() commands as shown above. So my questions to anyone else using Vim and Cygwin on Windows XP are: Does what I'm doing make sense? Is there some way to fix the 'shellxquote' problem other than modifying every plugin I use as I've done above? Is there a better way of doing any of this? I suppose I could build a Cygwin-aware vim binary, but I have successfully avoided having to compile anything under Windows so far and would really like to avoid that headache. Regards, Gary -- Gary Johnson | Agilent Technologies [EMAIL PROTECTED] | Wireless Division | Spokane, Washington, USA
Re: Running win32 vim and gvim under Cygwin and pure Windows XP
Gary Johnson wrote: Most of my development work is done on a Unix system (usually SunOS but sometimes Linux or HP-UX), but some requires that I use Windows XP. Source code is maintained under ClearCase on all these systems except Linux. I'm trying to get my Windows environment tuned up so that development is as easy for me using Windows as it already is using Unix. One thing I've done is installed Cygwin. This has been really nice, but I can't always use the Cygwin environment because of all the tools and applications that understand only Windows. So the environment I think I want is this: when I open gvim from a Windows tool or application, I get a Windows gvim that executes system(), :sh, :!, :r!, etc. in a Windows environment; but when I start vim or gvim from the Cygwin shell, I get the same Windows vim or gvim executable, but one which executes system(), etc., in the Cygwin environment, i.e., pretty much as it would in a real Unix environment. To that end, I have done a standard install of Cygwin, installed the standard vim for Windows from vim.sf.net, put C:\Program Files\Vim\vim70 in my Windows PATH, added export SHELL to my $HOME/.bash_profile, and added the following lines to the top of my _vimrc (C:\Program Files\Vim\_vimrc): if has(win32) $SHELL == /bin/bash executable(C:/cygwin/bin/bash) Running in Cygwin. set shell=C:/cygwin/bin/bash if executable('grep') set grepprg=grep\ -n\ $*\ /dev/null endif if exists(+shellslash) set shellslash endif else set diffexpr=MyDiff() function MyDiff() let opt = '-a --binary ' if diffopt =~ 'icase' | let opt = opt . '-i ' | endif if diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif let arg1 = v:fname_in if arg1 =~ ' ' | let arg1 = '' . arg1 . '' | endif let arg2 = v:fname_new if arg2 =~ ' ' | let arg2 = '' . arg2 . '' | endif let arg3 = v:fname_out if arg3 =~ ' ' | let arg3 = '' . arg3 . '' | endif let eq = '' if $VIMRUNTIME =~ ' ' if sh =~ '\cmd' let cmd = '' . $VIMRUNTIME . '\diff' let eq = '' else let cmd = substitute($VIMRUNTIME, ' ', ' ', '') . '\diff' endif else let cmd = $VIMRUNTIME . '\diff' endif silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' ' . arg3 . eq endfunction endif where the outer else clause encloses vim's default MyDiff() for Windows installations. In addition, I have found it necessary to make some changes to some plugins (ctags.vim and ccase.vim) following this example in $VIMRUNTIME/ftplugin/perl.vim: if shellxquote != '' let perlpath = system('perl -e print join(q/,/,@INC)') else let perlpath = system(perl -e 'print join(q/,/,@INC)') endif Vim automatically sets 'shellxquote' to when 'shell' is set to the Cygwin shell. Without this, system() commands don't handle temporary files properly. With this, however, you have to use single-quotes (') instead of double-quotes () in system() commands as shown above. So my questions to anyone else using Vim and Cygwin on Windows XP are: Does what I'm doing make sense? Is there some way to fix the 'shellxquote' problem other than modifying every plugin I use as I've done above? Is there a better way of doing any of this? I suppose I could build a Cygwin-aware vim binary, but I have successfully avoided having to compile anything under Windows so far and would really like to avoid that headache. Regards, Gary Interfacing native-Windows programs with the Cygwin environment, or vice-versa, is a ticklish matter. Maybe not insoluble but it requires constant attention to all the differences. See for instance, how src/Make_cyg.mak (used to compile native-Windows Vim using Cygwin tools) uses the cygpath utility (see man cygpath) when generating if_perl.c from if_perl.xs, in order to pass to the native-Windows Perl interpreter a pathname that it can understand. And that is just the most obvious thing: disk paths. In Vim, you probably will need two separate vimrc files, and therefore either two separate $HOME directories (which is not Cygwin's normal usage), or else a bash wrapper script to invoke Windows Vim with a -u command-line option. Since you are already familiar with Unix-like tools, it just might be less of a headache to keep a Cygwin-aware Vim in the Cygwin /usr/bin aka /usr/local/bin directory (which is not part of the Windows %PATH% but comes early in the Cygwin $PATH), and also a native-Windows Vim in (for instance) C:\Program Files\vim\vim70. You can compile them both under Cygwin: the native-windows Vim using src/Make_cyg.mak and the Cygwin-aware Vim (or even gvim for Cygwin X11) using the top-level Makefile. I haven't (yet) built Vim for Cygwin but I have built both native-Windows Vim