From 714e3dfd5899d6a9cbdf64d97b19f27b7d60e5bc Mon Sep 17 00:00:00 2001 From: BirDt_ Date: Fri, 22 May 2026 08:31:27 +0800 Subject: [PATCH] Sticky project dir --- userland/theurgy-projects.el | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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))))