Emacs: Replace neotree with treemacs.

This commit is contained in:
tastytea 2019-11-09 18:55:55 +01:00
parent 601c6dcdd0
commit c045ab8349
2 changed files with 36 additions and 16 deletions

View File

@ -1,29 +1,34 @@
;;; ui.el --- Configure user interfaces. -*- lexical-binding: t; -*- ;;; ui.el --- Configure user interfaces. -*- lexical-binding: t; -*-
;; Time-stamp: <2019-10-15T12:17:42+00:00> ;; Time-stamp: <2019-11-09T17:19:20+00:00>
;;; Commentary: ;;; Commentary:
;; * neotree. ;; * treemacs
;; * ivy + counsel. ;; * ivy + counsel.
;;; Code: ;;; Code:
;; Show directory tree in a window. ;; Directory tree.
(use-package neotree (use-package treemacs
:pin melpa ; <= 0.5.2 changes directory on file switch.
:demand t :demand t
:after (all-the-icons)
:custom :custom
(neo-smart-open t) (treemacs-project-follow-cleanup t)
(neo-show-updir-line t) ; Disabled by doom-themes?
(neo-window-width 40)
(neo-show-hidden-files t)
(neo-theme 'icons)
:bind :bind
("<f8>" . neotree-show) ("<f8>" . treemacs-select-window) ; Focus treemacs.
("C-<f8>" . neotree-hide) ("C-<f8>" . treemacs) ; Toggle treemacs.
("M-<f8>" . treemacs-add-and-display-current-project) ; Add current project.
(:map treemacs-mode-map
("<mouse-1>" . treemacs-single-click-expand-action))
)
(use-package treemacs-projectile
:after (treemacs projectile)
)
(use-package treemacs-magit
:after (treemacs magit)
) )
;; Completion in many Emacs commands. ;; Completion in many Emacs commands.

View File

@ -1,6 +1,6 @@
;;; common.el --- Common programming settings. -*- lexical-binding: t; -*- ;;; common.el --- Common programming settings. -*- lexical-binding: t; -*-
;; Time-stamp: <2019-10-14T15:06:34+00:00> ;; Time-stamp: <2019-11-09T17:48:35+00:00>
;;; Commentary: ;;; Commentary:
@ -100,16 +100,29 @@
;; Automatic project management. ;; Automatic project management.
(unless slow-computer (unless slow-computer
(use-package projectile (use-package projectile
:after (neotree ivy) :after (treemacs ivy)
:init :init
(defvar my/cmake-compile-command ; cmake command for compiling with 1 (defvar my/cmake-compile-command ; cmake command for compiling with 1
(concat "cmake --build . -- -j" ; core less than available. (concat "cmake --build . -- -j" ; core less than available.
(substring (shell-command-to-string "nproc --ignore=1") 0 -1))) (substring (shell-command-to-string "nproc --ignore=1") 0 -1)))
(defun my/switch-project ()
"Add project to treemacs."
(treemacs-add-and-display-current-project)
(treemacs-collapse-other-projects))
(defun my/projectile-kill-buffers ()
"Kill project buffers and remove project from treemacs."
(interactive)
(projectile-kill-buffers)
(let ((current-prefix-arg (projectile-project-name)))
(treemacs-remove-project-from-workspace)))
:custom :custom
(projectile-project-compilation-dir "build") (projectile-project-compilation-dir "build")
(projectile-switch-project-action 'neotree-projectile-action) ;; (projectile-switch-project-action 'neotree-projectile-action)
(projectile-switch-project-action 'my/switch-project)
(projectile-project-configure-cmd (projectile-project-configure-cmd
"cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ "cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-GUnix\\ Makefiles ..") -GUnix\\ Makefiles ..")
@ -126,6 +139,8 @@
:bind :bind
("C-c p" . 'projectile-command-map) ("C-c p" . 'projectile-command-map)
(:map projectile-command-map
("k" . 'my/projectile-kill-buffers))
) )
) ; unless slow-computer. ) ; unless slow-computer.