mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2026-04-23 19:40:24 +10:00
Moving to Doom Emacs!
This commit is contained in:
41
.emacs.d/modules/ui/treemacs/autoload.el
Normal file
41
.emacs.d/modules/ui/treemacs/autoload.el
Normal file
@@ -0,0 +1,41 @@
|
||||
;;; ui/treemacs/autoload.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defun +treemacs--init ()
|
||||
(require 'treemacs)
|
||||
(let ((origin-buffer (current-buffer)))
|
||||
(cl-letf (((symbol-function 'treemacs-workspace->is-empty?)
|
||||
(symbol-function 'ignore)))
|
||||
(treemacs--init))
|
||||
(dolist (project (treemacs-workspace->projects (treemacs-current-workspace)))
|
||||
(treemacs-do-remove-project-from-workspace project))
|
||||
(with-current-buffer origin-buffer
|
||||
(let ((project-root (or (doom-project-root) default-directory)))
|
||||
(treemacs-do-add-project-to-workspace
|
||||
(treemacs--canonical-path project-root)
|
||||
(doom-project-name project-root)))
|
||||
(setq treemacs--ready-to-follow t)
|
||||
(when (or treemacs-follow-after-init treemacs-follow-mode)
|
||||
(treemacs--follow)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +treemacs/toggle ()
|
||||
"Initialize or toggle treemacs.
|
||||
|
||||
Ensures that only the current project is present and all other projects have
|
||||
been removed.
|
||||
|
||||
Use `treemacs' command for old functionality."
|
||||
(interactive)
|
||||
(require 'treemacs)
|
||||
(pcase (treemacs-current-visibility)
|
||||
(`visible (delete-window (treemacs-get-local-window)))
|
||||
(_ (+treemacs--init))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +treemacs/find-file (arg)
|
||||
"Open treemacs (if necessary) and find current file."
|
||||
(interactive "P")
|
||||
(let ((origin-buffer (current-buffer)))
|
||||
(+treemacs--init)
|
||||
(with-current-buffer origin-buffer
|
||||
(treemacs-find-file arg))))
|
||||
45
.emacs.d/modules/ui/treemacs/config.el
Normal file
45
.emacs.d/modules/ui/treemacs/config.el
Normal file
@@ -0,0 +1,45 @@
|
||||
;;; ui/treemacs/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(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"))
|
||||
|
||||
|
||||
(after! treemacs
|
||||
(set-popup-rule! "^ \\*Treemacs"
|
||||
:side treemacs-position
|
||||
:size treemacs-width
|
||||
:quit nil
|
||||
:ttl 0)
|
||||
|
||||
;; Don't follow the cursor
|
||||
(treemacs-follow-mode -1)
|
||||
|
||||
;; Allow ace-window to target treemacs windows
|
||||
(after! ace-window
|
||||
(delq! 'treemacs-mode aw-ignored-buffers)))
|
||||
|
||||
|
||||
(use-package! treemacs-evil
|
||||
:when (featurep! :editor evil +everywhere)
|
||||
:after treemacs
|
||||
:config
|
||||
(define-key! evil-treemacs-state-map
|
||||
[return] #'treemacs-RET-action
|
||||
[tab] #'treemacs-TAB-action
|
||||
"TAB" #'treemacs-TAB-action
|
||||
;; REVIEW Fix #1875 to be consistent with C-w {v,s}, but this should really
|
||||
;; be considered upstream.
|
||||
"o v" #'treemacs-visit-node-horizontal-split
|
||||
"o s" #'treemacs-visit-node-vertical-split))
|
||||
|
||||
|
||||
(use-package! treemacs-projectile
|
||||
:after treemacs)
|
||||
|
||||
|
||||
(use-package! treemacs-magit
|
||||
:when (featurep! :tools magit)
|
||||
:after treemacs magit)
|
||||
9
.emacs.d/modules/ui/treemacs/packages.el
Normal file
9
.emacs.d/modules/ui/treemacs/packages.el
Normal file
@@ -0,0 +1,9 @@
|
||||
;; -*- no-byte-compile: t; -*-
|
||||
;;; ui/treemacs/packages.el
|
||||
|
||||
(package! treemacs)
|
||||
(when (featurep! :editor evil +everywhere)
|
||||
(package! treemacs-evil))
|
||||
(package! treemacs-projectile)
|
||||
(when (featurep! :tools magit)
|
||||
(package! treemacs-magit))
|
||||
Reference in New Issue
Block a user