4

I am using Windows gVim and I am trying to invoke commands to run on cygwin's bash. It is working, but the working directory is set to $HOME every time. Would it possible to set to the current file's directory?

I have the following line in my .vimrc:

set shell=C:/cygwin/bin/bash set shellcmdflag=--login\ -c set shellxquote=\" 

I have the following lines in my .profile:

if [ -n "$BASH_VERSION" ]; then # include .bashrc if it exists if [ -f "$HOME/.bashrc" ]; then . "$HOME/.bashrc" fi fi 

2 Answers 2

2

I think the --login does that; remove that argument and the shell will be opened in GVIM's current directory.

Sign up to request clarification or add additional context in comments.

Comments

1

You can pass the current file's directory to external commands like this:

:!ls %:p:h 

See :h filename-modifiers and possibly :h shellescape().

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.