180 lines
5.2 KiB
EmacsLisp
180 lines
5.2 KiB
EmacsLisp
;;; ui.el --- UI components and packages -*- lexical-binding: t -*-
|
|
|
|
;; This file is not part of GNU Emacs
|
|
|
|
;; This program is free software: you can redistribute it and/or modify
|
|
;; it under the terms of the GNU General Public License as published by
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
;; (at your option) any later version.
|
|
|
|
;; This program is distributed in the hope that it will be useful,
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
;; GNU General Public License for more details.
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
;; commentary
|
|
|
|
;;; Code:
|
|
|
|
;; Ouroboros themes
|
|
(straight-use-package
|
|
'(ouroboros-emacs-themes :type git
|
|
:host nil
|
|
:repo "https://git.cyan.sh/BirDt/ouroboros-emacs-themes.git"
|
|
:files ("*.el")))
|
|
|
|
;; Nano for making emacs look more slim
|
|
(straight-use-package
|
|
'(nano :type git :host github :repo "rougier/nano-emacs"))
|
|
|
|
;; Add ouroboros-emacs-themes to the theme load path
|
|
(add-to-list 'custom-theme-load-path
|
|
(expand-file-name (concat "straight/" straight-build-dir "/ouroboros-emacs-themes/") user-emacs-directory))
|
|
|
|
;; We need this for other nano stuff
|
|
(require 'nano-faces)
|
|
|
|
(require 'nano-modeline)
|
|
|
|
;; Default frame values - NOTE this is buggy when not launching emacsclient, but everyone should be using that anyway :)
|
|
(setq default-frame-alist
|
|
(append (list
|
|
'(min-height . 1)
|
|
'(height . 45)
|
|
'(min-width . 1)
|
|
'(width . 81)
|
|
'(vertical-scroll-bars . nil)
|
|
'(internal-border-width . 24)
|
|
'(left-fringe . 1)
|
|
'(right-fringe . 1)
|
|
'(tool-bar-lines . 0)
|
|
'(menu-bar-lines . 1))))
|
|
|
|
;; Smart line wrapping
|
|
(global-visual-line-mode)
|
|
|
|
;; Minibuffer must shrink
|
|
(setq resize-mini-windows nil
|
|
max-mini-window-height 1)
|
|
|
|
;; Use y instead of yes, etc
|
|
(if (>= emacs-major-version 29)
|
|
(setopt use-short-answers t)
|
|
(defalias 'yes-or-no-p 'y-or-n-p))
|
|
|
|
;; Display line numbers in programming modes
|
|
(add-hook 'prog-mode-hook #'display-line-numbers-mode)
|
|
|
|
;; Hide toolbar
|
|
(tool-bar-mode -1)
|
|
|
|
;; Don't show scrollbars
|
|
(scroll-bar-mode -1)
|
|
|
|
;; Don't show menu bar
|
|
(menu-bar-mode -1)
|
|
|
|
;; No tooltips
|
|
(tooltip-mode -1)
|
|
|
|
;; No ugly button for checkboxes
|
|
(setq widget-image-enable nil)
|
|
|
|
;; Don't pop up UI dialogs
|
|
(setq use-dialog-box nil)
|
|
|
|
;; Tabs
|
|
(when (< 26 emacs-major-version)
|
|
(tab-bar-mode 1) ;; enable tab bar
|
|
(global-unset-key (kbd "C-t"))
|
|
(define-key global-map (kbd "C-t 2") 'tab-new)
|
|
(define-key global-map (kbd "C-t 0") 'tab-close)
|
|
(setq tab-bar-close-button-show nil) ;; hide tab close / X button
|
|
(setq tab-bar-new-tab-choice "*enlight*");; buffer to show in new tabs
|
|
(setq tab-bar-tab-hints t) ;; show tab numbers
|
|
(setq tab-bar-format '(tab-bar-format-tabs tab-bar-separator))) ;; elements to include in bar
|
|
|
|
;; Hideshow
|
|
(add-hook 'prog-mode-hook #'hs-minor-mode)
|
|
|
|
;; Custom text-scale function with default scale
|
|
(defun set-default-text-scale (&optional default-scale)
|
|
(interactive)
|
|
(let ((default-scale (or default-scale 0)))
|
|
(text-scale-set default-scale)))
|
|
|
|
;; Keybindings for text-scale
|
|
(global-set-key (kbd "C-=") 'text-scale-increase)
|
|
(global-set-key (kbd "C--") 'text-scale-decrease)
|
|
(global-set-key (kbd "C-0") '(lambda () (interactive) (set-default-text-scale)))
|
|
|
|
;; Beacon to show the cursor
|
|
(use-package beacon
|
|
:config
|
|
(beacon-mode 1)
|
|
(setq beacon-color "#D5D5D5"))
|
|
|
|
;; Burly for frame layout saving
|
|
(use-package burly)
|
|
|
|
;; Highlight to-do
|
|
(use-package hl-todo
|
|
:straight (hl-todo :type git :host github :repo "tarsius/hl-todo")
|
|
:config (global-hl-todo-mode 1))
|
|
|
|
;; Completion
|
|
(use-package corfu
|
|
:init
|
|
|
|
;; Enable Corfu globally.
|
|
(global-corfu-mode)
|
|
|
|
;; Popup info
|
|
(corfu-popupinfo-mode)
|
|
:custom
|
|
(corfu-min-width 80)
|
|
(corfu-max-width corfu-min-width)
|
|
:config
|
|
(setq corfu-auto t
|
|
corfu-quit-no-match t
|
|
corfu-auto-delay 0
|
|
corfu-auto-prefix 0
|
|
corfu-popupinfo-delay 0)
|
|
|
|
(add-hook 'corfu-mode-hook
|
|
(lambda ()
|
|
;; Settings only for Corfu
|
|
(setq-local completion-styles '(basic)
|
|
completion-category-overrides nil
|
|
completion-category-defaults nil)))
|
|
(keymap-set corfu-map "RET" `( menu-item "" nil :filter
|
|
,(lambda (&optional _)
|
|
(and (derived-mode-p 'eshell-mode 'comint-mode)
|
|
#'corfu-send))))
|
|
)
|
|
|
|
;; Icons in corfu
|
|
(use-package kind-icon
|
|
:after corfu
|
|
:custom
|
|
(kind-icon-use-icons t)
|
|
(kind-icon-default-face 'corfu-default) ; Have background color be the same as `corfu' face background
|
|
(kind-icon-blend-background nil) ; Use midpoint color between foreground and background colors ("blended")?
|
|
(kind-icon-blend-frac 0.08)
|
|
:config
|
|
(add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter) ; Enable `kind-icon'
|
|
)
|
|
|
|
;; Flycheck is here
|
|
(use-package flycheck
|
|
:hook ((after-init . global-flycheck-mode)))
|
|
|
|
(provide 'ui)
|
|
|
|
;;; ui.el ends here
|