title: Set shell's working directory to the current file opened in vim
body: <p>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?</p>
  
  <p>I have the following line in my <code>.vimrc</code>:</p>
  
  <pre><code>set shell=C:/cygwin/bin/bash
  set shellcmdflag=--login\ -c
  set shellxquote=\"
  </code></pre>
  
  <p>I have the following lines in my <code>.profile</code>:</p>
  
  <pre><code>if [ -n "$BASH_VERSION" ]; then
      # include .bashrc if it exists
      if [ -f "$HOME/.bashrc" ]; then
      . "$HOME/.bashrc"
      fi
  fi
  </code></pre>