Sticky project dir

This commit is contained in:
BirDt_ 2026-05-22 08:31:27 +08:00
parent 611ff17566
commit 714e3dfd58

View file

@ -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))))