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; -*-
;; Time-stamp: <2019-10-15T12:17:42+00:00>
;; Time-stamp: <2019-11-09T17:19:20+00:00>
;;; Commentary:
;; * neotree.
;; * treemacs
;; * ivy + counsel.
;;; Code:
;; Show directory tree in a window.
(use-package neotree
:pin melpa ; <= 0.5.2 changes directory on file switch.
;; Directory tree.
(use-package treemacs
:demand t
:after (all-the-icons)
:custom
(neo-smart-open t)
(neo-show-updir-line t) ; Disabled by doom-themes?
(neo-window-width 40)
(neo-show-hidden-files t)
(neo-theme 'icons)
(treemacs-project-follow-cleanup t)
:bind
("<f8>" . neotree-show)
("C-<f8>" . neotree-hide)
("<f8>" . treemacs-select-window) ; Focus treemacs.
("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.

View File

@ -1,6 +1,6 @@
;;; 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:
@ -100,16 +100,29 @@
;; Automatic project management.
(unless slow-computer
(use-package projectile
:after (neotree ivy)
:after (treemacs ivy)
:init
(defvar my/cmake-compile-command ; cmake command for compiling with 1
(concat "cmake --build . -- -j" ; core less than available.
(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
(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
"cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-GUnix\\ Makefiles ..")
@ -126,6 +139,8 @@
:bind
("C-c p" . 'projectile-command-map)
(:map projectile-command-map
("k" . 'my/projectile-kill-buffers))
)
) ; unless slow-computer.