save selected window

This commit is contained in:
BirDt_ 2025-08-21 17:02:00 +08:00
parent 549536ca05
commit 8592cb0134

View file

@ -50,13 +50,15 @@
(find-file (get-project-default-file dir))
(tab-rename (file-name-nondirectory (string-remove-suffix "/" dir)))
(tab-bar-change-tab-group (concat "project: " dir)) ;; We use the tab group name to store the project working directory
(neotree-dir dir))))
(save-selected-window
(neotree-dir 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))))
(when (and tab-group-name (string-match-p "^project:" tab-group-name))
(neotree-dir (string-remove-prefix "project: " tab-group-name)))))
(save-selected-window
(neotree-dir (string-remove-prefix "project: " tab-group-name))))))
(add-hook 'tab-bar-select-tab-hook #'theurgy-swap-to-tab-project)