maxming2333 / puttycyg

Automatically exported from code.google.com/p/puttycyg
0 stars 0 forks source link

Can puttycyg do like this? #27

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I tried to use bash as default shell for vim, cos there are so many reasons
we need bash not cmd.exe :)

Vim call vimrun to run system command as default, so I replace vimrun.exe
as puttycyg, and I set shell=\"-\", then I can use external command in vim
to start up cygwin with puttycyg window(just type :! then press enter key).

It seems work till this step, but I can't transfer any command arguments to
run in puttycyg window after start up, like use :!echo "Hello World" in vim.

Can puttycyg support this function: transfer one command argument(like echo
command) into cygwin after login shell then run this command automatically?
So we can use bash as default shell then use any Unix command in vim even
under windows.

Thank you so much!

Original issue reported on code.google.com by rickywu1...@gmail.com on 20 Nov 2009 at 4:17

GoogleCodeExporter commented 8 years ago
Are you using a Cygwin-compiled vim?  I have no idea what vimrun.exe does, but 
it 
sounds like a Cygwin vim would have no need for such a program.

PuTTYcyg does pass command-line arguments along, so I'm not sure where they are 
getting lost.

Why do you need a terminal in which to run external commands from vim anyway?

Original comment by medgar123 on 20 Nov 2009 at 7:30

GoogleCodeExporter commented 8 years ago
Thank you for your response.

I'm using win32 GUI vim.
I need a terminal to replace cmd.exe, just because:
:!echo "Hello\" & World"
this command isn't work if call from cmd.exe, but if we type in bash, it works 
well.
The command which need pass double quote or & won't work, I also want to call 
shell
script in vim, that is why I need a terminal.

There is another problem, vim call system command through vimrun.exe, 
vimrun.exe is a
windows console application, use bash as default shell still have the problem 
above.

And I tried use puttycyg replace vimrun.exe, I set shell=\"-\". I use external
command in vim, vim call puttycyg and pass the -, then I can log into bash, but 
I
can't pass any argument after :! to run, puttycyg will throw out error:
:!which awk
-: No such file or directory

Am I did wrong? Could you tell me how to pass a command to puttycyg and run in
command line mode?

Another way is I use vimrun.exe to call puttycyg(set start puttycyg as the 
shell),
vimrun pass the command linke this:
"start puttytel -load "Cygwin" - "  which awk
still get: -: No such file or directory, I don't think this is correct way pass
command to puttycyg.

Thanks!

Original comment by rickywu1...@gmail.com on 21 Nov 2009 at 5:10

GoogleCodeExporter commented 8 years ago
I've investigated this.  First of all, the only way I got this to work was to 
set 
"Connection type" to "Cygterm" in the PuTTY "Default Settings".  For debugging, 
I 
recommend also changing "Close window on exit" to "Never" in "Default Settings" 
as 
well.

So, using :! seems to work fine, until you want whitespace and quoting to work 
properly.  However, :!r does not work as vim passes some flags to vimrun to 
handle 
this.  There are likely other variants of external command (makeprg, etc) which 
will 
likely break.

Given all that, if you still want to try to use putty.exe from gVim you can 
either 
double up your quoting:

:!printf \%\n \"hello world\"

Or, you can write a shim executable in place of vimrun which correctly requotes 
its 
command line for putty.exe.

In summary, using gVim with PuTTYcyg is not something I can support.  You 
should 
consider either using the Cygwin vim command, or to use something like 
unxutils.sf.net with the Windows (non-Cygwin) gVim.

Original comment by medgar123 on 8 Dec 2009 at 1:13

GoogleCodeExporter commented 8 years ago
You should look at using Vimshell, see 
http://theletterpsi.blogspot.com/2010/08/using-cygwin-bash-as-your-win32-vim.htm
l and http://code.google.com/p/vimshell/ . 

Original comment by ives.vdf on 14 Aug 2010 at 9:15

GoogleCodeExporter commented 8 years ago
Actually, I'm using vimshell now, thanks.
Vimshell still needs more improving that can implement shell more efficiency,
And I use another way: use shc compile shell script to executable files and 
call it in gvim, it works well.

Original comment by rickywu1...@gmail.com on 16 Aug 2010 at 11:30