Replace treemacs, add groups to tabs

This commit is contained in:
zongor 2023-08-30 16:28:42 -04:00
parent a2f56f0dc5
commit 3fb73b6888
1 changed files with 208 additions and 15 deletions

219
.emacs
View File

@ -108,10 +108,10 @@
(use-package verb)
(use-package org
:after verb
:mode ("\\.org\\'" . org-mode)
:config (define-key org-mode-map (kbd "C-c C-r") verb-command-map))
(use-package dashboard
:ensure t
:config
(dashboard-setup-startup-hook))
(use-package doom-themes
:ensure t
@ -126,22 +126,200 @@
(doom-themes-org-config))
(use-package all-the-icons)
(use-package neotree
:config
(global-set-key [f8] 'neotree-toggle))
(use-package dashboard
(use-package treemacs
:ensure t
:defer t
:init
(with-eval-after-load 'winum
(define-key winum-keymap (kbd "M-0") #'treemacs-select-window))
:config
(dashboard-setup-startup-hook))
(progn
(setq treemacs-collapse-dirs (if treemacs-python-executable 3 0)
treemacs-deferred-git-apply-delay 0.5
treemacs-directory-name-transformer #'identity
treemacs-display-in-side-window t
treemacs-eldoc-display 'simple
treemacs-file-event-delay 2000
treemacs-file-extension-regex treemacs-last-period-regex-value
treemacs-file-follow-delay 0.2
treemacs-file-name-transformer #'identity
treemacs-follow-after-init t
treemacs-expand-after-init t
treemacs-find-workspace-method 'find-for-file-or-pick-first
treemacs-git-command-pipe ""
treemacs-goto-tag-strategy 'refetch-index
treemacs-header-scroll-indicators '(nil . "^^^^^^")
treemacs-hide-dot-git-directory t
treemacs-indentation 2
treemacs-indentation-string " "
treemacs-is-never-other-window nil
treemacs-max-git-entries 5000
treemacs-missing-project-action 'ask
treemacs-move-forward-on-expand nil
treemacs-no-png-images nil
treemacs-no-delete-other-windows t
treemacs-project-follow-cleanup nil
treemacs-persist-file (expand-file-name ".cache/treemacs-persist" user-emacs-directory)
treemacs-position 'left
treemacs-read-string-input 'from-child-frame
treemacs-recenter-distance 0.1
treemacs-recenter-after-file-follow nil
treemacs-recenter-after-tag-follow nil
treemacs-recenter-after-project-jump 'always
treemacs-recenter-after-project-expand 'on-distance
treemacs-litter-directories '("/node_modules" "/.venv" "/.cask")
treemacs-project-follow-into-home nil
treemacs-show-cursor nil
treemacs-show-hidden-files t
treemacs-silent-filewatch nil
treemacs-silent-refresh nil
treemacs-sorting 'alphabetic-asc
treemacs-select-when-already-in-treemacs 'move-back
treemacs-space-between-root-nodes t
treemacs-tag-follow-cleanup t
treemacs-tag-follow-delay 1.5
treemacs-text-scale nil
treemacs-user-mode-line-format nil
treemacs-user-header-line-format nil
treemacs-wide-toggle-width 70
treemacs-width 35
treemacs-width-increment 1
treemacs-width-is-initially-locked t
treemacs-workspace-switch-cleanup nil)
;; The default width and height of the icons is 22 pixels. If you are
;; using a Hi-DPI display, uncomment this to double the icon size.
;;(treemacs-resize-icons 44)
(treemacs-follow-mode t)
(treemacs-filewatch-mode t)
(treemacs-fringe-indicator-mode 'always)
(when treemacs-python-executable
(treemacs-git-commit-diff-mode t))
(pcase (cons (not (null (executable-find "git")))
(not (null treemacs-python-executable)))
(`(t . t)
(treemacs-git-mode 'deferred))
(`(t . _)
(treemacs-git-mode 'simple)))
(treemacs-hide-gitignored-files-mode nil))
:bind
(:map global-map
("M-0" . treemacs-select-window)
("C-x t 1" . treemacs-delete-other-windows)
("C-x t t" . treemacs)
("C-x t d" . treemacs-select-directory)
("C-x t B" . treemacs-bookmark)
("C-x t C-t" . treemacs-find-file)
("C-x t M-t" . treemacs-find-tag)))
(use-package treemacs-evil
:after (treemacs evil)
:ensure t)
(use-package treemacs-projectile
:after (treemacs projectile)
:ensure t)
(use-package treemacs-icons-dired
:hook (dired-mode . treemacs-icons-dired-enable-once)
:ensure t)
(use-package treemacs-magit
:after (treemacs magit)
:ensure t)
(use-package treemacs-persp ;;treemacs-perspective if you use perspective.el vs. persp-mode
:after (treemacs persp-mode) ;;or perspective vs. persp-mode
:ensure t
:config (treemacs-set-scope-type 'Perspectives))
(use-package treemacs-tab-bar ;;treemacs-tab-bar if you use tab-bar-mode
:after (treemacs)
:ensure t
:config (treemacs-set-scope-type 'Tabs))
(use-package centaur-tabs
:demand
:init
(setq centaur-tabs-enable-key-bindings t)
:config
(setq centaur-tabs-style "bar"
centaur-tabs-height 32
centaur-tabs-set-icons t
centaur-tabs-show-new-tab-button t
centaur-tabs-set-modified-marker t
centaur-tabs-show-navigation-buttons t
centaur-tabs-set-bar 'under
centaur-tabs-show-count nil
;; centaur-tabs-label-fixed-length 15
;; centaur-tabs-gray-out-icons 'buffer
;; centaur-tabs-plain-icons t
x-underline-at-descent-line t
centaur-tabs-left-edge-margin nil)
(centaur-tabs-change-fonts (face-attribute 'default :font) 110)
(centaur-tabs-headline-match)
;; (centaur-tabs-enable-buffer-alphabetical-reordering)
;; (setq centaur-tabs-adjust-buffer-order t)
(centaur-tabs-mode t)
(setq uniquify-separator "/")
(setq uniquify-buffer-name-style 'forward)
(defun centaur-tabs-buffer-groups ()
"`centaur-tabs-buffer-groups' control buffers' group rules.
Group centaur-tabs with mode if buffer is derived from `eshell-mode' `emacs-lisp-mode' `dired-mode' `org-mode' `magit-mode'.
All buffer name start with * will group to \"Emacs\".
Other buffer group by `centaur-tabs-get-group-name' with project name."
(list
(cond
;; ((not (eq (file-remote-p (buffer-file-name)) nil))
;; "Remote")
((or (string-equal "*" (substring (buffer-name) 0 1))
(memq major-mode '(magit-process-mode
magit-status-mode
magit-diff-mode
magit-log-mode
magit-file-mode
magit-blob-mode
magit-blame-mode
)))
"Emacs")
((derived-mode-p 'prog-mode)
"Editing")
((derived-mode-p 'dired-mode)
"Dired")
((memq major-mode '(helpful-mode
help-mode))
"Help")
((memq major-mode '(org-mode
org-agenda-clockreport-mode
org-src-mode
org-agenda-mode
org-beamer-mode
org-indent-mode
org-bullets-mode
org-cdlatex-mode
org-agenda-log-mode
diary-mode))
"OrgMode")
(t
(centaur-tabs-get-group-name (current-buffer))))))
:hook
(dashboard-mode . centaur-tabs-local-mode)
(term-mode . centaur-tabs-local-mode)
(calendar-mode . centaur-tabs-local-mode)
(org-agenda-mode . centaur-tabs-local-mode)
:bind
("C-<prior>" . centaur-tabs-backward)
("C-<next>" . centaur-tabs-forward))
("C-<next>" . centaur-tabs-forward)
("C-S-<prior>" . centaur-tabs-move-current-tab-to-left)
("C-S-<next>" . centaur-tabs-move-current-tab-to-right)
(:map evil-normal-state-map
("g t" . centaur-tabs-forward)
("g T" . centaur-tabs-backward)))
(use-package undo-tree
:config (global-undo-tree-mode 1)
@ -265,6 +443,22 @@
(electric-pair-mode 1)
(setf electric-pair-skip-self nil)
(require 'display-line-numbers)
(defcustom display-line-numbers-exempt-modes
'(vterm-mode eshell-mode shell-mode term-mode ansi-term-mode)
"Major modes on which to disable line numbers."
:group 'display-line-numbers
:type 'list
:version "green")
(defun display-line-numbers--turn-on ()
"Turn on line numbers except for certain major modes.
Exempt major modes are defined in `display-line-numbers-exempt-modes'."
(unless (or (minibufferp)
(member major-mode display-line-numbers-exempt-modes))
(display-line-numbers-mode)))
(global-set-key [f11] 'toggle-frame-fullscreen)
(global-set-key (kbd "C-s") 'ripgrep-regexp)
(global-set-key (kbd "C-,") 'move-to-previous-window)
@ -273,8 +467,7 @@
(global-set-key (kbd "C-M-i") 'xref-pop-marker-stack)
(global-column-enforce-mode)
(global-linum-mode)
(global-display-line-numbers-mode)
(scroll-bar-mode -1)
(tool-bar-mode -1)