On Jun 24, 10:02 pm, AndyHancock <andymhanc...@gmail.com> wrote:
>On Jun 23, 7:49 am, Tim Chase <v...@tim.thechases.com> wrote:
>>On 06/22/12 23:33, AndyHancock wrote:
>>> I've have the following in my vimrc to try to get bash
>>> functionality:
>>>
>>> set shell=c:\cygwin\bin\bash.exe -i
>>
>> I'm surprised this doesn't give an error. Using ":set", spaces are
>> treated as delimiters between options, so it should give an error
>> something like "E518: Unknown option -i"
>>
>>> set shell=c:\cygwin\bin\bash.exe --rcfile\ c:\cygwin\home\USER
>>> \.bashrc
>>
>> which I would expect to happen here too (you escape the one after
>> "--rcfile", but not the one after "exe").
>
> You're right. I was handraulically trying to copy the bashrc
> statements into my posting. Foolish me. Humans stopped typing
> error free the moment computer editors and word processors became
> widespread.
>
>> There are a couple of options, as you can escape the spaces with
>> "\" (though using Windows "\" as the path separator may then cause
>> issues; since Vim understands both, I'd stick to using "/" for
>> portability). You can also use Vim's ability to use :let do more
>> complex evaluations which is what I expect you want in this case:
>>
>> :let &shell='c:\cyg '.$USERNAME.'/.bashrc'
>>
>> which you can read about at
>>
>> :help :let-option
>>
>> I might use "$HOME" instead of the full-path-with-username-replaced
>> as that should be more portable.
>
> I was starting to much around with the following in my vimrc:
>
> let &shell='c:\cygwin\bin\bash.exe\ --rcfile c:\cygwin\home\'.
> $USERNAME.'\.bashrc'
>
> Then I found the *real* source of my problem. There is nothing
> wrong with
>
> set shell=c:\cygwin\bin\bash.exe\ -i
>
> The problem is that it was enclosed
>
> if has("win32")
> " etc.
> endif
>
> I was running on a 64-bit Windows 7. Heh. Heh heh. (I smack my
> forehead).
>
> However, your example is still highly educational, for which I thank
> you.
Just a word of warning, now that I got it running and had a chance to
try it out...the Windows-based vim defaults to a filetype of dos. I
wrote scripts that used "mv" to rename a bunch of files and sent them
to bash using
:w !bash
This ended up embedding invisible ^M characters at the end of each
filename. Extremely hard to figure out. At first, I thought it was
the new-fangled Windows 7 UAC Virtualization that was causing
recursive diff to report differences in my file tree. Not so, it was
the invisible characters in the filenames.
Anyway, I'm going to google around to find out how to set the default
filetype in order to avoid this. Mind you, having a filetype of unix
carries consequences too. You tend to lose track of the fact that
you're writing text files or source code using filetype=unix. When
you send these files to others (most of whom don't know or care about
unix), all they get is gibberish. Maybe I should keep the default
filetype=dos and use something like:
:w !dos2unix|bash
I'll have to figure out the escaping for the piping, but we'll see.
--
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
Tuesday, June 26, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment