4

Is it possible to get gVim (on windows) to execute external commands in cygwin by default? i.e. !ps will open a cygwin terminal showing the currenty running processes?

1 Answers1

4

First you need to tell Vim to run the bash program instead of cmd.exe, and bash needs to run as a login shell so that it will read the profile/login scripts and set up the environment (PATH, etc) properly.

You also need to change the setting that introduces command-line options to the shell:

:set shell=C:\Cygwin\bin\bash.exe\ -login
:set shellcmdflag=-c

If your cygwin commands require arguments, you should probably also

:set shellquote=\"

to ensure that the whole command gets wrapped up in quotes properly, otherwise the shell will only get the first word and ignore the rest.

njd
  • 11,426