diff --git a/userland/theurgy-projects.el b/userland/theurgy-projects.el index 0a34740..e6658ac 100644 --- a/userland/theurgy-projects.el +++ b/userland/theurgy-projects.el @@ -53,6 +53,24 @@ (save-selected-window (neotree-dir dir))))) +(defcustom theurgy-sticky-project-dir t + "When true, this will persist any changes to the Neotree root when switching tabs." + :type 'boolean + :group 'theurgy + :group 'theurgy-projects) + +(defun theurgy-change-tab-dir () + "Change the tab directory to the one selected in neotree." + (interactive) + (tab-bar-change-tab-group + (concat "project: " + (save-selected-window + (neotree) + neo-buffer--start-node)))) + +(when theurgy-sticky-project-dir + (advice-add 'neotree-change-root :after #'theurgy-change-tab-dir)) + (defun theurgy-swap-to-tab-project () "Go to the project dir of the tab group." (let ((tab-group-name (tab-bar-tab-group-default (tab-bar--current-tab))))