;;; ui.el --- Configure user interfaces. -*- lexical-binding: t; -*- ;; Time-stamp: <2020-05-24T22:38:01+0200> ;;; Commentary: ;; * treemacs ;; * ivy + counsel. ;;; Code: ;; Directory tree. (require 'basics/package-management) (use-package treemacs :demand t :after (display-line-numbers) :custom ((treemacs-project-follow-cleanup t) ; Collapse projects when leaving. (treemacs-silent-refresh t)) ; No log message on refresh. :config (progn (make-face 'hl-line-treemacs-face) (set-face-attribute 'hl-line-treemacs-face nil :background "#080011") (when (>= emacs-major-version 27) (set-face-attribute 'hl-line-treemacs-face nil :extend t)) (defun my/treemacs-set-hl-line () (set (make-local-variable 'hl-line-face) 'hl-line-treemacs-face))) :bind (("" . treemacs-select-window) ; Focus treemacs. ("C-" . treemacs) ; Toggle treemacs. ("M-" . treemacs-add-and-display-current-project) (:map treemacs-mode-map ("" . treemacs-single-click-expand-action))) :hook ((treemacs-mode . my/disable-line-numbers) (treemacs-mode . my/treemacs-set-hl-line))) (use-package treemacs-projectile :after (treemacs projectile)) (use-package treemacs-magit :after (treemacs magit)) ;; Completion in many Emacs commands. (use-package ivy :demand t :diminish ivy-mode :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-" . ivy-previous-history-element) ("M-" . ivy-next-history-element) ("S-" . ivy-immediate-done)))) ; Ignore completion. ;; Extensions for ivy (use-package counsel :after (ivy) :bind (("C-x C-f" . counsel-find-file) ("M-x" . counsel-M-x))) ;; Use icons in ivy. (use-package all-the-icons-ivy :after (all-the-icons counsel) :config (all-the-icons-ivy-setup)) ;; 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) :config (ivy-rich-mode 1)) ;; Use icons in ivy-rich. (use-package all-the-icons-ivy-rich :after (all-the-icons ivy-rich) :config (all-the-icons-ivy-rich-mode 1)) (use-package ivy-purpose :after (window-purpose) :config (ivy-purpose-setup) :bind (:map purpose-mode-map ("C-x b" . ivy-switch-buffer))) (use-package ivy-emoji ; Insert emojis with ivy. :after (ivy) :bind ("C-c e" . ivy-emoji)) (use-package counsel-projectile :after (projectile) :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))))) ;; Shows tabs of all visible buffers per window. (when (>= emacs-major-version 27) (use-package tab-line :defer 4 :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 ruler-mode-fill-column)))) (tab-line-highlight ((t (:inherit tab-line-tab-current)))))) (provide 'basics/ui) ;;; ui.el ends here