Vim silent launch of ConEmu (into Git Bash) - Windows 7 Command Prompt seizes

3

From a Windows 7 Command Prompt:

ConEmu.exe /cmd "C:\Program Files\Git\bin\sh.exe" --login -i && exit

opens ConEmu (or a new tab therein) logged into Git Bash for the current directory, and (very quickly) exits the Command Prompt window, all good.

From gVim:

:silent !ConEmu.exe /cmd "C:\Program Files\Git\bin\sh.exe" --login -i
  1. if ConEmu was already running, opens a new tab logged into Git Bash for the buffer's directory, and exits the intermediary Command Prompt window, and returns me to my current buffer, all good.
  2. if ConEmu was not running, it's opened logged into Git Bash as above, but the intermediary Command Prompt window is left up in a seized state, requiring me to terminate it to unfreeze gVim. (Appending $$ exit to the above gVim command doesn't help.)

The Question: How can I fix the 2nd gVim case, such that the Command Prompt window called by gVim closes automatically as in the 1st gVim case?


Supplementary gVim info (responding to @Maximus):

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Aug 29 2014 07:03:32)

Sysinternals' Process Monitor Filter'd for Operation Process Start finds that this heirarchy of Commands, all labelled "(ConEmu.exe)", are triggered by :!ConEmu:

  1. "C:\Program Files\vim\vim74\vimrun" C:\windows\system32\cmd.exe /c
  2. C:\windows\system32\cmd.exe /c C:\windows\system32\cmd.exe /c
  3. C:\windows\system32\cmd.exe /c

vimrun.exe is not in %PATH%.


Alternative attempt from gVim, using win32-!start:

Don Reba at Vim Wikia explains:

if you enter a command like :!calc (to run calc.exe for the Windows calculator), Vim will open a shell window, then launch a new calc window from that shell. When calc is closed, the prompt Hit any key to close this window... appears, and Vim is frozen until a key is pressed. But Calculator is a GUI program so it runs in a new process, in a new window. So, if you want to asynchronously run a GUI program like Calculator, you can simply enter :!start calc

So I tried:

!start ConEmu.exe /cmd "C:\Program Files\Git\bin\sh.exe" --login -i && exit

- which doesn't seize gVim and opens a new ConEmu tab in Git at gVim's working directory, but fails to login, reporting sh.exe": &&: No such file or directory, followed by:

Command to be executed: "C:\Program Files\Git\bin\sh.exe" --login -i && exit
ConEmuC: Root process was alive less than 10 sec, ExitCode=127.
Press Enter or Esc to close console...

JosephHarriott

Posted 2014-11-14T20:07:49.617

Reputation: 195

>

  • Question unclear. 2. sh.exe": &&: No such file or directory.
  • < – Maximus – 2014-11-14T21:24:02.437

    @Maximus, I've attempted to clarify the question (on the last line). I can't make sense of your 2nd point. – JosephHarriott – 2014-11-15T14:39:48.090

    When I run :silent !ConEmu.exe from gVim there is no "command prompt window", only ConEmu. – Maximus – 2014-11-15T18:28:00.217

    @Maximus, I've just tried that on my ancient N130, and (maybe because it's so slow) there is, for about one second, a Command Prompt window. Run just :!ConEmu, and you'll see that CP window stating "Hit any key to close this window...", which is necessary to now unfreeze gVim. – JosephHarriott – 2014-11-15T18:41:39.517

    gVim version. Show screenshot. Run ProcessMonitor and look for Process Start events. What is started? – Maximus – 2014-11-15T20:15:50.890

    @Maximus, sorry, I need reputation at least 10 to post screenshot of the seized CP window. – JosephHarriott – 2014-11-15T22:15:11.990

    :help win32-vimrun. So you need silent if you do not want to get cmd window. BTW, I have no vimrun.exe in %PATH% and cmd window does not appear at all :) – Maximus – 2014-11-16T00:01:38.087

    No answers