2020-05-21 09:59:06 +00:00
|
|
|
;;; packages.el --- Treemacs Layer packages File for Spacemacs
|
2017-08-07 06:37:47 +00:00
|
|
|
;;
|
2019-10-05 19:47:12 +00:00
|
|
|
;; Copyright (c) 2012-2019 Sylvain Benner & Contributors
|
2017-08-07 06:37:47 +00:00
|
|
|
;;
|
|
|
|
;; Author: Alexander Miller <alexanderm@web.de>
|
2019-10-05 19:47:12 +00:00
|
|
|
;; Hong Xu <hong@topbug.net>
|
2017-08-07 06:37:47 +00:00
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
|
|
|
(defconst treemacs-packages
|
2018-11-20 19:55:37 +00:00
|
|
|
'(
|
|
|
|
golden-ratio
|
2017-10-08 16:01:48 +00:00
|
|
|
treemacs
|
2017-08-07 06:37:47 +00:00
|
|
|
(treemacs-evil :toggle (memq dotspacemacs-editing-style '(vim hybrid)))
|
2020-04-16 05:52:07 +00:00
|
|
|
(treemacs-icons-dired :toggle treemacs-use-icons-dired)
|
2020-08-02 14:56:38 +00:00
|
|
|
(treemacs-all-the-icons :toggle treemacs-use-all-the-icons-theme)
|
2019-09-16 19:16:38 +00:00
|
|
|
(treemacs-magit :requires magit)
|
2020-01-16 04:19:31 +00:00
|
|
|
(treemacs-persp :requires persp-mode)
|
2017-10-08 16:01:48 +00:00
|
|
|
treemacs-projectile
|
2018-11-20 19:55:37 +00:00
|
|
|
winum
|
|
|
|
))
|
2017-08-07 06:37:47 +00:00
|
|
|
|
|
|
|
(defun treemacs/pre-init-golden-ratio ()
|
|
|
|
(spacemacs|use-package-add-hook golden-ratio
|
|
|
|
:post-config
|
2017-10-08 16:05:43 +00:00
|
|
|
(add-to-list 'golden-ratio-exclude-buffer-regexp
|
|
|
|
(rx "*Treemacs" (0+ any)))))
|
2017-08-07 06:37:47 +00:00
|
|
|
|
|
|
|
(defun treemacs/init-treemacs ()
|
|
|
|
(use-package treemacs
|
2020-01-16 04:19:31 +00:00
|
|
|
:commands (treemacs-select-window
|
|
|
|
treemacs-select-scope-type
|
|
|
|
treemacs--window-number-ten
|
2018-08-31 21:28:12 +00:00
|
|
|
treemacs-current-visibility)
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2017-08-07 06:37:47 +00:00
|
|
|
:init
|
|
|
|
(progn
|
2020-01-28 10:13:30 +00:00
|
|
|
(setq treemacs-follow-after-init t)
|
2018-10-11 16:58:53 +00:00
|
|
|
(add-hook 'treemacs-mode-hook
|
|
|
|
#'spacemacs/treemacs-setup-width-lock)
|
2020-03-06 01:59:21 +00:00
|
|
|
(spacemacs|spacebind
|
2020-03-01 23:00:43 +00:00
|
|
|
"Files manipulation."
|
|
|
|
:global
|
|
|
|
(("f" "Files"
|
|
|
|
("t" treemacs "File tree")
|
|
|
|
("B" treemacs-bookmark "Find bookmark in file tree")
|
|
|
|
("T" treemacs-find-file "Focus current file in file tree")
|
|
|
|
("M-t" treemacs-find-tag "Focus tag in file tree" ))
|
|
|
|
("p" "Project"
|
|
|
|
("t" spacemacs/treemacs-project-toggle "Open project in file tree"))))
|
2018-09-09 12:55:15 +00:00
|
|
|
(which-key-add-major-mode-key-based-replacements 'treemacs-mode
|
2019-06-19 12:46:43 +00:00
|
|
|
"c" "treemacs-create"
|
|
|
|
"o" "treemacs-visit-node"
|
|
|
|
"oa" "treemacs-visit-node-ace"
|
|
|
|
"t" "treemacs-toggles"
|
|
|
|
"y" "treemacs-copy"
|
|
|
|
"C-c C-p" "treemacs-projects"
|
|
|
|
"C-c C-p c" "treemacs-projects-collapse"))
|
2018-05-28 15:12:16 +00:00
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
(spacemacs/define-evil-state-face "treemacs" "MediumPurple1")
|
2019-09-19 04:54:57 +00:00
|
|
|
;; minor modes are enabled by default, so they must be explicitly
|
|
|
|
;; turned off
|
2019-10-05 19:47:12 +00:00
|
|
|
(if (eq treemacs-use-follow-mode t)
|
2019-09-19 04:54:57 +00:00
|
|
|
(treemacs-follow-mode t)
|
|
|
|
(treemacs-follow-mode -1))
|
2019-10-05 19:47:12 +00:00
|
|
|
(if (eq treemacs-use-follow-mode 'tag)
|
|
|
|
(treemacs-tag-follow-mode t)
|
|
|
|
(treemacs-tag-follow-mode -1))
|
2019-09-19 04:54:57 +00:00
|
|
|
(if treemacs-use-filewatch-mode
|
|
|
|
(treemacs-filewatch-mode t)
|
|
|
|
(treemacs-filewatch-mode -1))
|
|
|
|
(if (memq treemacs-use-git-mode '(simple extended deferred))
|
|
|
|
(treemacs-git-mode treemacs-use-git-mode)
|
|
|
|
(treemacs-git-mode -1))
|
2018-10-04 10:01:49 +00:00
|
|
|
(add-to-list 'spacemacs-window-split-ignore-prefixes
|
|
|
|
treemacs--buffer-name-prefix))))
|
2017-10-08 16:01:48 +00:00
|
|
|
|
|
|
|
(defun treemacs/init-treemacs-evil ()
|
|
|
|
(use-package treemacs-evil
|
|
|
|
:after treemacs
|
|
|
|
:if (memq dotspacemacs-editing-style '(vim hybrid))))
|
|
|
|
|
|
|
|
(defun treemacs/init-treemacs-projectile ()
|
|
|
|
(use-package treemacs-projectile
|
2018-05-25 05:39:15 +00:00
|
|
|
:after treemacs
|
2019-06-19 14:00:03 +00:00
|
|
|
:defer t
|
|
|
|
:init (require 'treemacs-projectile)))
|
2017-10-08 16:01:48 +00:00
|
|
|
|
2020-01-16 04:19:31 +00:00
|
|
|
(defun treemacs/init-treemacs-persp ()
|
2020-04-09 11:09:03 +00:00
|
|
|
(use-package treemacs-persp
|
|
|
|
:after treemacs persp-mode
|
|
|
|
:config (when (eq treemacs-use-scope-type 'Perspectives)
|
|
|
|
(treemacs-set-scope-type 'Perspectives))))
|
2020-01-16 04:19:31 +00:00
|
|
|
|
2020-04-16 05:52:07 +00:00
|
|
|
(defun treemacs/init-treemacs-icons-dired ()
|
|
|
|
(use-package treemacs-icons-dired
|
2020-05-23 19:27:05 +00:00
|
|
|
:hook (dired-mode . treemacs-icons-dired-mode)))
|
2020-04-16 05:52:07 +00:00
|
|
|
|
2020-08-02 14:56:38 +00:00
|
|
|
(defun treemacs/init-treemacs-all-the-icons ()
|
|
|
|
(use-package treemacs-all-the-icons
|
|
|
|
:if treemacs-use-all-the-icons-theme
|
|
|
|
:hook (treemacs-mode . (lambda () (treemacs-load-theme 'all-the-icons)))))
|
|
|
|
|
2017-10-08 16:01:48 +00:00
|
|
|
(defun treemacs/pre-init-winum ()
|
|
|
|
(spacemacs|use-package-add-hook winum
|
|
|
|
:post-config
|
2017-11-26 15:00:04 +00:00
|
|
|
(progn
|
2018-09-10 17:55:44 +00:00
|
|
|
;; `0', `M-0' and `C-x w 0' are bound to `winum-select-window-0-or-10'
|
|
|
|
(define-key winum-keymap
|
|
|
|
[remap winum-select-window-0-or-10] #'treemacs-select-window)
|
|
|
|
;; replace the which-key name
|
|
|
|
(push '((nil . "winum-select-window-0-or-10") .
|
|
|
|
(nil . "treemacs-select-window"))
|
|
|
|
which-key-replacement-alist)
|
2019-01-19 15:32:55 +00:00
|
|
|
(with-eval-after-load 'treemacs
|
|
|
|
(dolist (n (number-sequence 1 5))
|
|
|
|
(add-to-list 'winum-ignored-buffers
|
2018-09-10 17:55:44 +00:00
|
|
|
(format "%sFramebuffer-%s*"
|
|
|
|
treemacs--buffer-name-prefix n)))))))
|
2019-07-25 18:05:11 +00:00
|
|
|
|
|
|
|
(defun treemacs/init-treemacs-magit ()
|
|
|
|
(use-package treemacs-magit
|
|
|
|
:after treemacs magit
|
2019-09-16 19:16:38 +00:00
|
|
|
:defer t))
|