This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/+filetree/treemacs/packages.el

129 lines
4.5 KiB
EmacsLisp
Raw Normal View History

;;; packages.el --- Treemacs Layer packages File for Spacemacs
2017-08-07 06:37:47 +00:00
;;
;; Copyright (c) 2012-2019 Sylvain Benner & Contributors
2017-08-07 06:37:47 +00:00
;;
;; Author: Alexander Miller <alexanderm@web.de>
;; 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
'(
golden-ratio
treemacs
2017-08-07 06:37:47 +00:00
(treemacs-evil :toggle (memq dotspacemacs-editing-style '(vim hybrid)))
(treemacs-icons-dired :toggle treemacs-use-icons-dired)
(treemacs-all-the-icons :toggle treemacs-use-all-the-icons-theme)
(treemacs-magit :requires magit)
2020-01-16 04:19:31 +00:00
(treemacs-persp :requires persp-mode)
treemacs-projectile
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
treemacs-current-visibility)
:defer t
2017-08-07 06:37:47 +00:00
:init
(progn
(setq treemacs-follow-after-init t)
(add-hook 'treemacs-mode-hook
#'spacemacs/treemacs-setup-width-lock)
(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"))))
(which-key-add-major-mode-key-based-replacements 'treemacs-mode
"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"))
:config
(progn
(spacemacs/define-evil-state-face "treemacs" "MediumPurple1")
;; minor modes are enabled by default, so they must be explicitly
;; turned off
(if (eq treemacs-use-follow-mode t)
(treemacs-follow-mode t)
(treemacs-follow-mode -1))
(if (eq treemacs-use-follow-mode 'tag)
(treemacs-tag-follow-mode t)
(treemacs-tag-follow-mode -1))
(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))
(add-to-list 'spacemacs-window-split-ignore-prefixes
treemacs--buffer-name-prefix))))
(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
:defer t
:init (require 'treemacs-projectile)))
2020-01-16 04:19:31 +00:00
(defun treemacs/init-treemacs-persp ()
(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
(defun treemacs/init-treemacs-icons-dired ()
(use-package treemacs-icons-dired
:hook (dired-mode . treemacs-icons-dired-mode)))
(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)))))
(defun treemacs/pre-init-winum ()
(spacemacs|use-package-add-hook winum
:post-config
(progn
;; `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)
(with-eval-after-load 'treemacs
(dolist (n (number-sequence 1 5))
(add-to-list 'winum-ignored-buffers
(format "%sFramebuffer-%s*"
treemacs--buffer-name-prefix n)))))))
(defun treemacs/init-treemacs-magit ()
(use-package treemacs-magit
:after treemacs magit
:defer t))