Friday, June 22, 2012

How to set USERNAME in RHS of "set" command

I'm trying to get the PC-based vim to shell out to cygwin's bash
interpetter.

That way, I can issue commands like

!!cal " Gets a calendar

:2,3 w !bash " sends line 2 & 3 to a bash shell

This is the behaviour I'm use to from cygin's gvim.

I've have the following in my vimrc to try to get bash functionality:

set shell=c:\cygwin\bin\bash.exe -i

According to bash man pages, -i should force bash to run the startup
file .bashrc in the user's home directory, setting up paths, shortcut
command aliases, functions, etc.. Unfortunately, the home directory
is the Windows home directory, not the cygwin home directory. So I
wish to forcibly use the cygwin home directory:

set shell=c:\cygwin\bin\bash.exe --rcfile\ c:\cygwin\home\USER
\.bashrc

I want to do this rather than create a copy of .bashrc in the Windows
home directory because it's one less copy of .bashrc to update when
changes are made. Furthermore, all users accounts benefit from the
global vimrc.

Here's the sticky part. In place of USER, I've tried %USERNAME%,
expand('$USERNAME'), and ${USERNAME}. None of them work. Could
someone please respond with the proper syntax?

Thanks.

--
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

No comments: