Skip to main content
2 of 2
added 43 characters in body
DUWUDA
  • 113
  • 3

Execute current file outside of working directory

I know I can execute the current file, lets say a bash file, with :! bash %. But what can I do if I want to execute the current file in a different directory (such as the location of the current file) than the current vim working directory. I know that I could change to the working directory of the current file by :cd %:p:h and then execute the file but then I would need to jump back again.

Would really appreciate any help.

DUWUDA
  • 113
  • 3