Swap neotree to tab project directory automatically

This commit is contained in:
BirDt_ 2025-08-20 22:21:56 +08:00
parent e9e3eb63ab
commit e2cdbb2959
3 changed files with 12 additions and 105 deletions

View file

@ -49,8 +49,17 @@
(whaler :action (lambda (dir)
(find-file (get-project-default-file dir))
(tab-rename (file-name-nondirectory (string-remove-suffix "/" dir)))
(tab-bar-change-tab-group (concat "project: " dir))
(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 (string-match-p "^project:" tab-group-name)
(neotree-dir (string-remove-prefix "project: " tab-group-name)))))
(add-hook 'tab-bar-select-tab-hook #'theurgy-swap-to-tab-project)
(defun theurgy-edit-projects-list ()
"Open list of projects in customize."
(interactive)