pyzo
pyzo copied to clipboard
Let file browser follow shell working directory and vice versa
Similar to what Matlab does
I get your point. However, this can also be annoying. Imagine having a big project with a script somewhere in root to start the "application". You're working on a certain feature in a subpackage, e.g. root/foo/bar/*.py
and have the file browser open in that directory. Now each time that you run the script, it moves back to root :(
I just added an action to the shell context menu to open the current kernel dir in the file browser, and another to change the kernel directory to that of the file browser. So we now have:
- Can open directory containing file in editor via editor tab or context menu.
- Can open current kernel dir via shell context menu.
- Can set current directory of shell from shell context menu.
- Can set current directory from file browser's project menu (the star).
I think this should be sufficient. I can understand how keeping the directories in sync might be handy, but its complex due to existing workflows and also because there can be multiple kernels active at any given time.
Thanks! I'm not sure I got your first remarkt though. I mean sync between the file browser and the foremost shell. Running a script shouldn't change anything, you don't need to cd to the script's directory to run it, do you?
If you have multiple shells (I assume you use kernel as a synonym for shell), just sync with the foremost one and change dir every time a different shell becomes the foremost one. It's while interactively typing commands into the shell that the visual disconnect between file browser and shell panes bothers me, not when running/editing scripts.
I mean sync between the file browser and the foremost shell.
Yes, that would help. As for executing code, the current directory is certainly changed when running as a script, and IIRC also when executing normally. I suspect that this will be annoying, but perhaps it will not be so for everybody, since not everyone has the same workflow.
I'm reopening, and we can try making available as an option at some point.