Open osen opened 6 years ago
What behaviour you recommend?
I believe the first option could be better because that also means in the files list (:f) it keeps the original paths. I believe at the moment when you change directory (i.e via the inbuilt file browser), it resets all these paths to full paths rather than the original relative ones.
(Of course, it should continue changing directory if you explicitly use :cd to do so.)
Edit: I should add, only the inbuilt file browser seems to change the directory when opening files. If just opening files via ":e" then the directory remains the same.
Hi,
I think you can control the current directory using the Buffin hook in your ed.cfg:
assign %(Buffinhook) = mod/OnBuffin.vi
My OnBuffin.vi contains:
# Change to directory of opened file
CD %D%P
This keeps the current directory in line with the file in focus, both for the file browser and tab completion at the command line.
Kind Regards Gavin Holt
Thank you very much for the tip. I didn't know this was possible; hooks like this aren't really discussed in the manual. 4 years later but I am still oddly compelled to give it a shot!
My OnBuffin.vi would still need to be a bit different because I want to make absolute sure that Watcom Vi never changes directory. I suppose I could search upwards for Makefile or some environment variable. This is definitely a good place to start though :)
Hello,
Even though the original DOS Watcom Vi did this it is a feature that I think would be extremely useful. Perhaps a good addition to one of the options and one that I don't believe would be too difficult to implement if you know your way around the Vi codebase.
Unlike nvi and vim, when you open a new file from within Watcom Vi (i.e src\main.c) it actually changes the current directory to the opened files directory. As a workflow thing this is actually very annoying because if you then do:
:shell
> wmake
It won't work because you have been frustratingly placed inside the $PROJDIR/src directory.
At the moment (and for years) I am using a terrible script that searches up directories to the one containing the Makefile and then cds to that ;).