Files
.emacs.d/modules/projects/siren-treemacs.el

92 lines
2.4 KiB
EmacsLisp

;;; siren-treemacs.el --- jimeh's Emacs Siren: treemacs configuration.
;;; Commentary:
;; Basic configuration for treemacs.
;;; Code:
(use-package treemacs
:bind
("C-x C-p" . treemacs)
("C-x p" . treemacs-select-window)
:hook
(treemacs-mode . siren-treemacs-change-hl-line-mode)
:custom
(treemacs-collapse-dirs 3)
(treemacs-follow-after-init t)
(treemacs-goto-tag-strategy 'refetch-index)
(treemacs-indentation 2)
(treemacs-is-never-other-window t)
(treemacs-show-hidden-files t)
(treemacs-silent-refresh nil)
(treemacs-sorting 'alphabetic-asc)
(treemacs-width 40)
(treemacs-persist-file (expand-file-name "treemacs-persist" siren-cache-dir))
(treemacs-last-error-persist-file
(expand-file-name "treemacs-persist-at-last-error" siren-cache-dir))
:init
(defgroup siren-treemacs nil
"Siren specific settings for treemacs."
:group 'treemacs)
(defface siren-treemacs-line-highlight '((t (:extend t)))
"Custom line-highlight face for treemacs."
:group 'siren-treemacs)
(defun siren-treemacs-change-hl-line-mode ()
"Use a custom face to control style of highlighted line."
(setq-local hl-line-face 'siren-treemacs-line-highlight)
(overlay-put hl-line-overlay 'face hl-line-face)
(treemacs--setup-icon-background-colors))
:config
(defvar treemacs-no-load-time-warnings t)
(treemacs-follow-mode t)
(treemacs-filewatch-mode t)
(treemacs-git-mode 'deferred)
(treemacs-define-doubleclick-action
'file-node-open #'treemacs-visit-node-in-most-recently-used-window)
(treemacs-define-doubleclick-action
'file-node-closed #'treemacs-visit-node-in-most-recently-used-window)
(treemacs-define-RET-action
'file-node-open #'treemacs-visit-node-in-most-recently-used-window)
(treemacs-define-RET-action
'file-node-closed #'treemacs-visit-node-in-most-recently-used-window)
;; Unbind keys which conflict with global keybindings I use.
(unbind-key "M-l" treemacs-mode-map))
(use-package treemacs-all-the-icons
:defer t
:after (treemacs))
(use-package treemacs-projectile
:defer t
:after (treemacs projectile)
:custom
(treemacs-header-function #'treemacs-projectile-create-header))
(use-package treemacs-magit
:defer t
:after (treemacs magit))
(use-package lsp-treemacs
:defer t
:after (treemacs lsp-mode)
:custom
(lsp-metals-treeview-show-when-views-received t)
:config
(lsp-treemacs-sync-mode 1))
(provide 'siren-treemacs)
;;; siren-treemacs.el ends here