mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2026-04-24 20:10:23 +10:00
Updating Doom Emacs.
This commit is contained in:
@@ -1,22 +1,5 @@
|
||||
;;; 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.
|
||||
@@ -29,13 +12,6 @@ Use `treemacs' command for old functionality."
|
||||
(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))))
|
||||
(_ (if (doom-project-p)
|
||||
(treemacs-add-and-display-current-project)
|
||||
(treemacs)))))
|
||||
|
||||
@@ -1,25 +1,48 @@
|
||||
;;; 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"))
|
||||
(defvar +treemacs-git-mode 'simple
|
||||
"Type of git integration for `treemacs-git-mode'.
|
||||
|
||||
There are 3 possible values:
|
||||
|
||||
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.")
|
||||
|
||||
|
||||
(after! treemacs
|
||||
(set-popup-rule! "^ \\*Treemacs"
|
||||
:side treemacs-position
|
||||
:size treemacs-width
|
||||
:quit nil
|
||||
:ttl 0)
|
||||
;;
|
||||
;;; Packages
|
||||
|
||||
(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
|
||||
;; Allow ace-window to target treemacs windows
|
||||
(after! ace-window
|
||||
(delq! 'treemacs-mode aw-ignored-buffers))
|
||||
|
||||
;; 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)))
|
||||
(when +treemacs-git-mode
|
||||
;; If they aren't supported, fall back to simpler methods
|
||||
(when (and (memq +treemacs-git-mode '(deferred extended))
|
||||
(not (executable-find "python3")))
|
||||
(setq +treemacs-git-mode 'simple))
|
||||
(treemacs-git-mode +treemacs-git-mode)
|
||||
(setq treemacs-collapse-dirs
|
||||
(if (memq treemacs-git-mode '(extended deferred))
|
||||
3
|
||||
0))))
|
||||
|
||||
|
||||
(use-package! treemacs-evil
|
||||
@@ -43,3 +66,9 @@
|
||||
(use-package! treemacs-magit
|
||||
:when (featurep! :tools magit)
|
||||
:after treemacs magit)
|
||||
|
||||
|
||||
(use-package! treemacs-persp
|
||||
:when (featurep! :ui workspaces)
|
||||
:after treemacs
|
||||
:config (treemacs-set-scope-type 'Perspectives))
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
;; -*- no-byte-compile: t; -*-
|
||||
;;; ui/treemacs/packages.el
|
||||
|
||||
(package! treemacs)
|
||||
(package! treemacs :pin "327bf63e58348e0b5070054477db801d5392cd75")
|
||||
;; These packages have no :pin because they're in the same repo
|
||||
(when (featurep! :editor evil +everywhere)
|
||||
(package! treemacs-evil))
|
||||
(package! treemacs-projectile)
|
||||
(when (featurep! :tools magit)
|
||||
(package! treemacs-magit))
|
||||
(when (featurep! :ui workspaces)
|
||||
(package! treemacs-persp))
|
||||
|
||||
Reference in New Issue
Block a user