Whenever I open a script (Python or R), I want Sublime automatically changes the current working directory to the path of that file. Is it possible?
I added the setting "working_dir": "$file_path",
to Sublime preferences but it doesn't help.
Ok, I solved the problem. Here is what I did:
PackageResourceViewer
PackageResourceViewer: Open Resource
Python
resource then open Python.sublime-build
"shell_cmd": "python -u \"$file\"",
Add the following 2 lines:
"cmd": ["python", "-u", "$file"],
"working_dir": "$file_path",
Alternately, you can replace the above 2 lines by:
"shell_cmd": "cd $file_path; python -u \"$file\""
Do the same thing for R
or other build resources if you want Sublime Text 3 automatically change the current working directory in accordance with the active scripts' path.