2019-10-14 17:38:14 +02:00
|
|
|
;;; ui.el --- Configure user interfaces. -*- lexical-binding: t; -*-
|
|
|
|
|
2020-03-24 12:21:13 +01:00
|
|
|
;; Time-stamp: <2020-03-24T12:21:05+0100>
|
2019-10-14 17:38:14 +02:00
|
|
|
|
|
|
|
;;; Commentary:
|
2019-11-09 18:55:55 +01:00
|
|
|
;; * treemacs
|
2019-10-14 18:02:20 +02:00
|
|
|
;; * ivy + counsel.
|
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-03-15 23:38:06 +01:00
|
|
|
;; :pin melpa ; We need > 2.6 for lsp-treemacs.
|
2020-02-19 15:08:14 +01:00
|
|
|
:demand t
|
2019-11-09 19:29:49 +01:00
|
|
|
:after (display-line-numbers)
|
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.
|
|
|
|
:bind (("<f8>" . treemacs-select-window) ; Focus treemacs.
|
|
|
|
("C-<f8>" . treemacs) ; Toggle treemacs.
|
|
|
|
("M-<f8>" . treemacs-add-and-display-current-project)
|
|
|
|
(:map treemacs-mode-map
|
|
|
|
("<mouse-1>" . treemacs-single-click-expand-action)))
|
|
|
|
:hook (treemacs-mode . my/disable-line-numbers))
|
2019-11-09 18:55:55 +01:00
|
|
|
|
|
|
|
(use-package treemacs-projectile
|
2020-03-10 14:33:47 +01:00
|
|
|
:after (treemacs projectile))
|
2019-11-09 18:55:55 +01:00
|
|
|
|
|
|
|
(use-package treemacs-magit
|
2020-03-15 23:38:06 +01:00
|
|
|
;; :pin melpa ; See treemacs.
|
|
|
|
:after (treemacs magit))
|
2019-10-14 17:38:14 +02:00
|
|
|
|
|
|
|
;; Completion in many Emacs commands.
|
|
|
|
(use-package ivy
|
2019-10-15 14:23:28 +02:00
|
|
|
:demand t
|
2020-02-11 17:48:50 +01:00
|
|
|
:diminish ivy-mode
|
2020-03-10 14:33:47 +01:00
|
|
|
:custom ((ivy-use-virtual-buffers t)
|
|
|
|
(ivy-count-format "[%d/%d] ")
|
|
|
|
(ivy-wrap t))
|
|
|
|
:config (ivy-mode 1)
|
|
|
|
:bind (("C-c C-r" . ivy-resume)
|
|
|
|
(:map ivy-minibuffer-map
|
|
|
|
("M-<up>" . ivy-previous-history-element)
|
|
|
|
("M-<down>" . ivy-next-history-element)
|
|
|
|
("S-<return>" . ivy-immediate-done)))) ; Ignore completion.
|
2019-10-14 17:38:14 +02:00
|
|
|
|
|
|
|
;; Extensions for ivy
|
|
|
|
(use-package counsel
|
2019-10-15 14:23:28 +02:00
|
|
|
:after (ivy)
|
|
|
|
:demand t
|
2020-03-10 14:33:47 +01:00
|
|
|
:bind (("C-x C-f" . counsel-find-file)
|
|
|
|
("M-x" . counsel-M-x)))
|
2019-10-14 17:38:14 +02:00
|
|
|
|
|
|
|
;; Use icons in ivy.
|
|
|
|
(use-package all-the-icons-ivy
|
|
|
|
:after (all-the-icons counsel)
|
2020-03-10 14:33:47 +01:00
|
|
|
:config (all-the-icons-ivy-setup))
|
2019-10-14 17:38:14 +02:00
|
|
|
|
|
|
|
;; More information in ivy mini-buffers.
|
|
|
|
(use-package ivy-rich
|
|
|
|
;; all-the-icons-ivy would override the ivy-rich switch-buffer improvements.
|
|
|
|
:after (all-the-icons-ivy counsel)
|
2020-03-10 14:33:47 +01:00
|
|
|
:config (ivy-rich-mode 1))
|
2019-10-14 17:38:14 +02:00
|
|
|
|
2020-02-20 18:50:23 +01:00
|
|
|
;; Use icons in ivy-rich.
|
|
|
|
(use-package all-the-icons-ivy-rich
|
|
|
|
:after (all-the-icons ivy-rich)
|
2020-03-10 14:33:47 +01:00
|
|
|
:config (all-the-icons-ivy-rich-mode 1))
|
2020-02-19 23:51:22 +01:00
|
|
|
|
2020-01-21 02:52:03 +01:00
|
|
|
(use-package ivy-purpose
|
|
|
|
:after (window-purpose)
|
2020-03-10 14:33:47 +01:00
|
|
|
:config (ivy-purpose-setup)
|
|
|
|
:bind (:map purpose-mode-map
|
|
|
|
("C-x b" . ivy-switch-buffer)))
|
2020-01-21 02:52:03 +01:00
|
|
|
|
2020-03-24 12:21:13 +01:00
|
|
|
(use-package ivy-emoji ; Insert emojis with ivy.
|
|
|
|
:after (ivy)
|
|
|
|
:bind ("C-c e" . ivy-emoji))
|
|
|
|
|
2020-02-11 16:47:12 +01:00
|
|
|
(use-package counsel-projectile
|
|
|
|
:after (projectile)
|
2020-03-10 14:33:47 +01:00
|
|
|
:custom ((counsel-projectile-mode t)
|
|
|
|
(projectile-switch-project-action 'my/switch-project))
|
|
|
|
:config (progn
|
|
|
|
(defun my/counsel-projectile-switch-project-action (project)
|
|
|
|
"Call `my/switch-project'."
|
|
|
|
(let ((projectile-switch-project-action 'my/switch-project))
|
|
|
|
(counsel-projectile-switch-project-by-name project)))
|
|
|
|
|
|
|
|
(counsel-projectile-modify-action
|
|
|
|
'counsel-projectile-switch-project-action
|
|
|
|
'((add ("Y" my/counsel-projectile-switch-project-action
|
|
|
|
"open project in treemacs") 1)))))
|
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
|
|
|
|
: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))))
|
|
|
|
(tab-line-tab-current ((t (:inherit tab-line-tab
|
|
|
|
:background "grey10"
|
|
|
|
:foreground "grey70"))))
|
2019-12-26 21:38:03 +01:00
|
|
|
(tab-line-highlight ((t (:inherit tab-line-tab-current
|
2020-03-10 14:33:47 +01:00
|
|
|
:foreground "white"))))))
|
2019-12-26 21:30:46 +01:00
|
|
|
|
2019-10-14 17:38:14 +02:00
|
|
|
(provide 'basics/ui)
|
|
|
|
;;; ui.el ends here
|