Use %:p:h to get path to current file, not current filename for pwd.