This commit is contained in:
Zelong Kuang
2025-12-20 15:13:13 +11:00
parent c8506c77af
commit 51c9e0a8e7
5 changed files with 137 additions and 12 deletions

55
lisp/init-treemacs.el Normal file
View File

@@ -0,0 +1,55 @@
;; -*- lexical-binding: t; -*-
(use-package treemacs
:ensure t
:defer t
:custom-face
(cfrs-border-color ((t (:inherit posframe-border))))
:init
(with-eval-after-load 'winum
(define-key winum-keymap (kbd "M-0") #'treemacs-select-window))
:config
(treemacs-follow-mode t)
(treemacs-filewatch-mode t)
(treemacs-fringe-indicator-mode 'always)
(pcase (cons (not (null (executable-find "git")))
(not (null (executable-find "python3"))))
(`(t . t)
(treemacs-git-mode 'deferred))
(`(t . _)
(treemacs-git-mode 'simple)))
(treemacs-git-commit-diff-mode t)
(treemacs-hide-gitignored-files-mode t)
(setq treemacs-collapse-dirs (if treemacs-python-executable 3 0)
treemacs-missing-project-action 'remove
treemacs-user-mode-line-format 'none
treemacs-sorting 'alphabetic-asc
treemacs-follow-after-init t
treemacs-width 30
treemacs-no-png-images 1)
:bind
(:map global-map
("M-0" . treemacs-select-window)
("C-x t 1" . treemacs-delete-other-windows)
("C-c o p" . treemacs)
("C-x t d" . treemacs-select-directory)
("C-x t B" . treemacs-bookmark)
("C-x t C-t" . treemacs-find-file)
("C-x t M-t" . treemacs-find-tag)))
(use-package treemacs-magit
:hook ((magit-post-commit
git-commit-post-finish
magit-post-stage
magit-post-unstage)
. treemacs-magit--schedule-update))
(use-package treemacs-tab-bar ;;treemacs-tab-bar if you use tab-bar-mode
:after (treemacs)
:ensure t
:config (treemacs-set-scope-type 'Tabs))
(use-package treemacs-nerd-icons
:demand t
:config (treemacs-nerd-icons-config))
(provide 'init-treemacs)