Closed HebaruSan closed 7 years ago
Awesome again :) There are a few breaking changes, e.g. remove default keybinding for 'insert-filename', that I have been saving for v1.0. Not that I particularly want to release a 1.0 but I haven't been following semver and I should. (Though actually you're allowed to do anything pre 1.0, but people might want to know about breaking changes). This change will go there.
Currently if config.startingDir is 'project' and multiple project folders are open in the current window, the root of the project at the top of the list when first launched is always used.
If the user edits a file from another project, this may not be desirable. If the file is part of a Node.js package, for example, the user may need to run Node Package Manager (npm) commands from the file's project root, and similarly for git commands. This patch updates the 'project' setting to check the project root of the currently open file, falling back to the old behavior if no such file is open.
Since the active file can change, we re-evaluate the starting directory each time a shell process is spawned instead of permanently storing it in @options.cwd with the existential assignment operator. That way, we can open a file and then terminate our shell in order to open a fresh shell in the new file's project root.