On Sep 7, 1:10 am, Linda W <[email protected]> wrote: > AndyHancock wrote: >> This problem dogged me for many years, and I finally hunkered down >> to chase it down. >> >> Here is the solution that I found works for me: >> >> "set shell=c:\cygwin\bin\bash.exe\ -i >> "Won't always find ~/.bashrc cuz depending on how vim is >> "launched, ~ doesn't always resolve to c:/cygwin/home/$USERNAME >> "let &shell='c:\cygwin\bin\bash.exe\ --rcfile c:\cygwin\home\' . >> " \ $USERNAME . '\.bashrc' >> "Backslashes are hated by bash. Also needs -i to ensure >> "bash is interactive so that .bashrc is sourced >> let &shell='c:\cygwin\bin\bash.exe --rcfile c:/cygwin/home/' . >> \ $USERNAME . '/.bashrc -i' >> " Depending on how vim is launched, c:/cygwin/home/$USERNAME >> " will sometimes be equivalent to ~. If so, then it will be >> " replaced by ~ in &shell. > > Wow... that looks complicated.
I think it looks complicated at first glance, but it's only one vim command. The rest is either comments explaining the one command, or commented-out alternative commands along with why they were not used. I deliberately left them because if people started to customize the one command line, those are the obvious alternatives (at least they were to me) and I wanted to save them the lengthy troubleshooting to find out that it didn't work. > Why don't you just set > SHELL=C:/Bin/Bash.exe > > I have my cygwin in C:/ > > In my system environment vars (controlpanel->system-> > advanced system settings(system properties)->Advanced-> > Environment variables->System Variables, > I have: > > DISPLAY=:0 > CYGWIN=nodosfilewarning winsymlinks export > PATH=C:\prog64\vim;%SystemRoot%\system32;%SystemRoot%;C:\bin;[other > stuff]... > SHELL=C:/Bin/Bash.exe > > Bash starts and runs it's RC vars, which pick up my home.. and > that runs my .bashrc. > > One of the aliases I have in my bash startup files > for gvim is "setsid gvim" > > That allows gvim to run in the background... > > Would that work for you? > > I let bash & cygwin figure out my userid and home .. Interesting. I did not know that the shell could be set like that. But it makes sense. As for setsid, I'm shelling out from the Windows-based gvim, so I'm not sure if I really want bash to run in "separate session". It's not clear to me what that means, from the setsid man and info pages. However, if it's the same as appending an ampserand to a bash command so that it runs in the background, then I probably don't want that. Shelling out from vim is a trick for using a bash command as a filter for a lot of text, so the user would want vim to wait for the output to come back before proceeding. I don't know if setting the environment variable SHELL would propagate its value into the vim option "shell". However, even if it did, I would feel more comfortable with the command in my code because just setting the shell alone left the rc file un-executed, even with the interactive flag was provided as part of the "shell" option (which is suppose to cause the rc file to run). It's all kind of foggy to me now, but I believe that one of the possible causes was that $HOME was being set to different things depending on how vim was invoked. So it wasn't finding the rc file in many cases. Thanks for sharing though. I feel a bit more smarter after looking up stuff based on your examples. -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
