2019-10-14 17:38:14 +02:00
|
|
|
;;; ui.el --- Configure user interfaces. -*- lexical-binding: t; -*-
|
|
|
|
|
|
|
|
;;; Commentary:
|
2019-11-09 18:55:55 +01:00
|
|
|
;; * treemacs
|
2019-10-14 17:38:14 +02:00
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
2019-11-09 18:55:55 +01:00
|
|
|
;; Directory tree.
|
2020-03-18 15:00:17 +01:00
|
|
|
|
|
|
|
(require 'basics/package-management)
|
|
|
|
|
2019-11-09 18:55:55 +01:00
|
|
|
(use-package treemacs
|
2020-11-29 09:11:03 +01:00
|
|
|
:after (display-line-numbers doom-themes hl-line)
|
2020-11-29 11:52:10 +01:00
|
|
|
:commands (my/treemacs-show-maybe)
|
2020-03-10 14:33:47 +01:00
|
|
|
:custom ((treemacs-project-follow-cleanup t) ; Collapse projects when leaving.
|
|
|
|
(treemacs-silent-refresh t)) ; No log message on refresh.
|
2020-04-21 04:21:38 +02:00
|
|
|
:config (progn
|
2020-11-14 21:57:28 +01:00
|
|
|
;; (treemacs-tag-follow-mode)
|
2020-04-21 04:21:38 +02:00
|
|
|
(make-face 'hl-line-treemacs-face)
|
2020-04-22 03:17:11 +02:00
|
|
|
(when (>= emacs-major-version 27)
|
|
|
|
(set-face-attribute 'hl-line-treemacs-face nil
|
|
|
|
:extend t))
|
2020-04-21 04:21:38 +02:00
|
|
|
(defun my/treemacs-set-hl-line ()
|
|
|
|
(set (make-local-variable 'hl-line-face)
|
2020-11-14 22:10:34 +01:00
|
|
|
'hl-line-treemacs-face))
|
|
|
|
(defun my/treemacs-show-maybe ()
|
|
|
|
(when (and (>= (frame-width) 120)
|
2020-11-29 15:50:02 +01:00
|
|
|
(file-exists-p treemacs-persist-file)
|
|
|
|
(<= (length (frame-list)) 2))
|
2020-11-29 11:52:10 +01:00
|
|
|
(treemacs-select-window)
|
2020-11-14 22:10:34 +01:00
|
|
|
(other-window 1))))
|
2020-04-15 14:24:44 +02:00
|
|
|
:bind (("<f9>" . treemacs-select-window) ; Focus treemacs.
|
|
|
|
("C-<f9>" . treemacs) ; Toggle treemacs.
|
|
|
|
("M-<f9>" . treemacs-add-and-display-current-project)
|
2020-03-10 14:33:47 +01:00
|
|
|
(:map treemacs-mode-map
|
|
|
|
("<mouse-1>" . treemacs-single-click-expand-action)))
|
2020-04-21 04:21:38 +02:00
|
|
|
:hook ((treemacs-mode . my/disable-line-numbers)
|
2020-11-14 22:10:34 +01:00
|
|
|
(treemacs-mode . my/treemacs-set-hl-line)
|
2020-11-29 09:15:58 +01:00
|
|
|
(after-init . (lambda () (when (display-graphic-p)
|
|
|
|
(my/treemacs-show-maybe))))
|
|
|
|
(server-after-make-frame . my/treemacs-show-maybe)))
|
2019-11-09 18:55:55 +01:00
|
|
|
|
|
|
|
(use-package treemacs-projectile
|
2020-05-27 04:48:11 +02:00
|
|
|
:demand t
|
2020-03-10 14:33:47 +01:00
|
|
|
:after (treemacs projectile))
|
2019-11-09 18:55:55 +01:00
|
|
|
|
|
|
|
(use-package treemacs-magit
|
2020-05-25 13:40:41 +02:00
|
|
|
:demand t
|
2020-03-15 23:38:06 +01:00
|
|
|
:after (treemacs magit))
|
2019-10-14 17:38:14 +02:00
|
|
|
|
2019-12-26 21:30:46 +01:00
|
|
|
;; Shows tabs of all visible buffers per window.
|
|
|
|
(when (>= emacs-major-version 27)
|
|
|
|
(use-package tab-line
|
2020-05-24 22:59:31 +02:00
|
|
|
:defer 4
|
2019-12-26 21:30:46 +01:00
|
|
|
:custom-face
|
|
|
|
(tab-line ((t (:inherit ruler-mode-default))))
|
|
|
|
(tab-line-tab ((t (:inherit ruler-mode-default))))
|
|
|
|
(tab-line-tab-inactive ((t (:inherit tab-line-tab))))
|
2020-04-17 03:51:57 +02:00
|
|
|
(tab-line-tab-current ((t (:inherit ruler-mode-fill-column))))
|
|
|
|
(tab-line-highlight ((t (:inherit tab-line-tab-current))))))
|
2019-12-26 21:30:46 +01:00
|
|
|
|
2019-10-14 17:38:14 +02:00
|
|
|
(provide 'basics/ui)
|
|
|
|
;;; ui.el ends here
|