2018-06-09 12:16:29 +10:00
|
|
|
;;; ui/treemacs/config.el -*- lexical-binding: t; -*-
|
|
|
|
|
2020-02-25 22:27:29 -05:00
|
|
|
(defvar +treemacs-git-mode 'simple
|
|
|
|
"Type of git integration for `treemacs-git-mode'.
|
2019-02-03 18:54:13 -05:00
|
|
|
|
2020-02-25 22:27:29 -05:00
|
|
|
There are 3 possible values:
|
2019-07-22 04:46:14 +02:00
|
|
|
|
2020-02-25 22:27:29 -05:00
|
|
|
1) `simple', which highlights only files based on their git status, and is
|
|
|
|
slightly faster,
|
|
|
|
2) `extended', which highlights both files and directories, but requires
|
|
|
|
python,
|
|
|
|
3) `deferred', same as extended, but highlights asynchronously.
|
|
|
|
|
|
|
|
This must be set before `treemacs' has loaded.")
|
|
|
|
|
|
|
|
|
|
|
|
;;
|
|
|
|
;;; Packages
|
2019-02-18 20:17:19 -05:00
|
|
|
|
2020-02-25 22:27:29 -05:00
|
|
|
(use-package! treemacs
|
|
|
|
:defer t
|
|
|
|
:init
|
|
|
|
(setq treemacs-follow-after-init t
|
|
|
|
treemacs-is-never-other-window t
|
|
|
|
treemacs-sorting 'alphabetic-case-insensitive-asc
|
|
|
|
treemacs-persist-file (concat doom-cache-dir "treemacs-persist")
|
|
|
|
treemacs-last-error-persist-file (concat doom-cache-dir "treemacs-last-error-persist"))
|
|
|
|
:config
|
|
|
|
;; Don't follow the cursor
|
|
|
|
(treemacs-follow-mode -1)
|
|
|
|
|
2023-03-04 22:26:59 +08:00
|
|
|
(set-popup-rule! "^ ?\\*Treemacs" :ignore t)
|
2020-02-25 22:27:29 -05:00
|
|
|
(when +treemacs-git-mode
|
|
|
|
;; If they aren't supported, fall back to simpler methods
|
|
|
|
(when (and (memq +treemacs-git-mode '(deferred extended))
|
2023-10-15 00:22:24 -04:00
|
|
|
(not treemacs-python-executable)
|
2020-02-25 22:27:29 -05:00
|
|
|
(not (executable-find "python3")))
|
|
|
|
(setq +treemacs-git-mode 'simple))
|
|
|
|
(treemacs-git-mode +treemacs-git-mode)
|
|
|
|
(setq treemacs-collapse-dirs
|
2022-10-01 04:39:24 +08:00
|
|
|
(if (memq +treemacs-git-mode '(extended deferred))
|
2020-02-25 22:27:29 -05:00
|
|
|
3
|
|
|
|
0))))
|
2018-06-09 12:16:29 +10:00
|
|
|
|
|
|
|
|
2023-09-15 21:19:06 +02:00
|
|
|
(use-package! treemacs-nerd-icons
|
2024-03-11 00:37:17 -04:00
|
|
|
:defer t
|
|
|
|
;; HACK: Because `lsp-treemacs' mutates Treemacs' default theme, and
|
|
|
|
;; `treemacs-nerd-icons' reads from it to populate its nerd-icons theme,
|
|
|
|
;; load order is important to ensure they don't step on each other's toes.
|
|
|
|
:init (with-eval-after-load (if (modulep! +lsp) 'lsp-treemacs 'treemacs)
|
|
|
|
(require 'treemacs-nerd-icons))
|
2023-09-15 21:19:06 +02:00
|
|
|
:config (treemacs-load-theme "nerd-icons"))
|
|
|
|
|
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! treemacs-evil
|
2022-08-12 20:29:19 +02:00
|
|
|
:when (modulep! :editor evil +everywhere)
|
2021-05-15 17:33:04 -04:00
|
|
|
:defer t
|
2021-05-23 21:50:11 -04:00
|
|
|
:init
|
|
|
|
(after! treemacs (require 'treemacs-evil))
|
|
|
|
(add-to-list 'doom-evil-state-alist '(?T . treemacs))
|
2019-03-15 01:48:29 -04:00
|
|
|
:config
|
|
|
|
(define-key! evil-treemacs-state-map
|
|
|
|
[return] #'treemacs-RET-action
|
|
|
|
[tab] #'treemacs-TAB-action
|
2019-10-10 16:57:26 -04:00
|
|
|
"TAB" #'treemacs-TAB-action
|
2019-10-20 13:29:29 -04:00
|
|
|
;; REVIEW Fix #1875 to be consistent with C-w {v,s}, but this should really
|
|
|
|
;; be considered upstream.
|
2019-10-10 16:57:26 -04:00
|
|
|
"o v" #'treemacs-visit-node-horizontal-split
|
2021-05-15 17:33:04 -04:00
|
|
|
"o s" #'treemacs-visit-node-vertical-split))
|
2018-06-10 23:16:50 +02:00
|
|
|
|
2018-06-09 12:16:29 +10:00
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! treemacs-projectile
|
2018-06-10 23:16:50 +02:00
|
|
|
:after treemacs)
|
2019-05-09 14:43:56 -04:00
|
|
|
|
2019-10-10 16:57:26 -04:00
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! treemacs-magit
|
2022-08-12 20:29:19 +02:00
|
|
|
:when (modulep! :tools magit)
|
2019-05-09 14:43:56 -04:00
|
|
|
:after treemacs magit)
|
2020-04-02 21:05:49 +01:00
|
|
|
|
2020-04-03 09:30:10 +01:00
|
|
|
|
2020-04-02 21:05:49 +01:00
|
|
|
(use-package! treemacs-persp
|
2022-08-12 20:29:19 +02:00
|
|
|
:when (modulep! :ui workspaces)
|
2020-04-03 09:30:10 +01:00
|
|
|
:after treemacs
|
2020-04-02 21:05:49 +01:00
|
|
|
:config (treemacs-set-scope-type 'Perspectives))
|
2021-04-04 23:16:37 -03:00
|
|
|
|
|
|
|
(use-package! lsp-treemacs
|
2022-08-12 20:29:19 +02:00
|
|
|
:when (modulep! +lsp)
|
2021-04-04 23:16:37 -03:00
|
|
|
:after (treemacs lsp))
|