Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer
    
Thanks for this. Very helpful –  Rich Ashworth Apr 17 '12 at 12:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.