Skip to main content
added 43 characters in body
Source Link
DUWUDA
  • 113
  • 3

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.

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 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.

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.

Source Link
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 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.