core-ui: clean up

This commit is contained in:
Henrik Lissner 2016-05-23 17:13:59 -04:00
parent c1b69f80b4
commit 56ac24887f

View file

@ -1,58 +1,47 @@
;;; core-ui.el --- interface & mode-line config ;;; core-ui.el --- interface & mode-line config
(defconst doom-fringe-size 3 "Default fringe width")
;; y/n instead of yes/no ;; y/n instead of yes/no
(fset 'yes-or-no-p 'y-or-n-p) (fset 'yes-or-no-p 'y-or-n-p)
(defvar doom-fringe-size 3 "Default fringe width")
(setq-default (setq-default
blink-matching-paren nil ; don't blink--too distracting indicate-buffer-boundaries nil ; don't show where buffer starts/ends
show-paren-delay 0.075 indicate-empty-lines nil ; show empty lines
fringes-outside-margins t ; switches order of fringe and margin
;; Keep cursors and highlights in current window only ;; Keep cursors and highlights in current window only
cursor-in-non-selected-windows nil cursor-in-non-selected-windows nil
highlight-nonselected-windows nil highlight-nonselected-windows nil
;; Disable bidirectional text support for slight performance bonus
bidi-display-reordering nil
;; Remove continuation arrow on right fringe
fringe-indicator-alist (delq (assq 'continuation fringe-indicator-alist)
fringe-indicator-alist)
uniquify-buffer-name-style nil ; my mode-line does this for me blink-matching-paren nil ; don't blink--too distracting
show-paren-delay 0.075
uniquify-buffer-name-style nil
visible-bell nil visible-bell nil
visible-cursor nil visible-cursor nil
x-stretch-cursor t x-stretch-cursor t
use-dialog-box nil ; always avoid GUI use-dialog-box nil ; always avoid GUI
redisplay-dont-pause t ; don't pause display on input redisplay-dont-pause t ; don't pause display on input
indicate-buffer-boundaries nil ; don't show where buffer starts/ends
indicate-empty-lines t ; show empty lines
fringes-outside-margins t ; switches order of fringe and margin
split-width-threshold nil ; favor horizontal splits split-width-threshold nil ; favor horizontal splits
show-help-function nil ; hide :help-echo text show-help-function nil ; hide :help-echo text
jit-lock-defer-time nil jit-lock-defer-time nil
jit-lock-stealth-nice 0.1 jit-lock-stealth-nice 0.1
jit-lock-stealth-time 0.2 jit-lock-stealth-time 0.2
jit-lock-stealth-verbose nil jit-lock-stealth-verbose nil
;; Disable bidirectional text support for slight performance bonus
bidi-display-reordering nil
;; Minibuffer resizing ;; Minibuffer resizing
resize-mini-windows 'grow-only resize-mini-windows 'grow-only
max-mini-window-height 0.3 max-mini-window-height 0.3
;; Ask for confirmation on exit only if there are real buffers left
confirm-kill-emacs
(lambda (_) (if window-system (if (doom/get-real-buffers) (y-or-n-p " Quit?") t) t)))
;; Remove arrow on the right fringe when wrapped ;; Initialize UI
fringe-indicator-alist (delq (assoc 'continuation fringe-indicator-alist)
fringe-indicator-alist))
;; Ask for confirmation on exit only if there are real buffers left
(when window-system
(setq confirm-kill-emacs
(lambda (_)
(if (doom/get-real-buffers)
(y-or-n-p ">> Gee, I dunno Brain... Are you sure?")
t))))
(load-theme doom-current-theme t) (load-theme doom-current-theme t)
(tooltip-mode -1) ; show tooltips in echo area (tooltip-mode -1) ; show tooltips in echo area
;; set up minibuffer and fringe
(if (not window-system) (if (not window-system)
(menu-bar-mode -1) (menu-bar-mode -1)
(scroll-bar-mode -1) ; no scrollbar (scroll-bar-mode -1) ; no scrollbar
@ -69,16 +58,17 @@
(push '(width . 120) default-frame-alist) (push '(width . 120) default-frame-alist)
(push '(height . 32) default-frame-alist) (push '(height . 32) default-frame-alist)
;; no fringe in the minibuffer ;; no fringe in the minibuffer
(add-hook! after-init (set-window-fringes (minibuffer-window) 0 0 nil)) (add-hook! (emacs-startup minibuffer-setup)
(set-window-fringes (minibuffer-window) 0 0 nil))
;; Show tilde in margin on empty lines ;; Show tilde in margin on empty lines
(define-fringe-bitmap 'tilde [64 168 16] nil nil 'center) (define-fringe-bitmap 'tilde [64 168 16] nil nil 'center)
(set-fringe-bitmap-face 'tilde 'fringe) (set-fringe-bitmap-face 'tilde 'fringe)
(setcdr (assq 'empty-line fringe-indicator-alist) 'tilde)) (setcdr (assq 'empty-line fringe-indicator-alist) 'tilde))
;; Try to display unicode characters without upsetting line-hieght (as much as possible) ;; Fix certain unicode characters without upsetting line-height
(doom-fix-unicode "DejaVu Sans" '(?⚠ ?★ ?➊ ?➋ ?➌ ?➍ ?➎ ?❻ ?➐ ?➑ ?➒ ?➓)) (doom-fix-unicode "DejaVu Sans" '(?⚠ ?★ ?➊ ?➋ ?➌ ?➍ ?➎ ?❻ ?➐ ?➑ ?➒ ?➓))
;; on by default in Emacs 25; I prefer to enable on a mode-by-mode basis, so disable it ;; On by default in Emacs 25. I'll enable it manually, so disable it globally
(when (and (> emacs-major-version 24) (featurep 'eldoc)) (when (and (> emacs-major-version 24) (featurep 'eldoc))
(global-eldoc-mode -1)) (global-eldoc-mode -1))
@ -105,8 +95,7 @@
;; ;;
(use-package hl-line (use-package hl-line
:init :init (add-hook! (prog-mode markdown-mode) 'hl-line-mode)
(add-hook! (prog-mode markdown-mode) 'hl-line-mode)
:config :config
(defvar-local doom--hl-line-mode nil) (defvar-local doom--hl-line-mode nil)
(setq hl-line-sticky-flag nil (setq hl-line-sticky-flag nil
@ -114,7 +103,6 @@
(defun doom|hl-line-on () (if doom--hl-line-mode (hl-line-mode +1))) (defun doom|hl-line-on () (if doom--hl-line-mode (hl-line-mode +1)))
(defun doom|hl-line-off () (if doom--hl-line-mode (hl-line-mode -1))) (defun doom|hl-line-off () (if doom--hl-line-mode (hl-line-mode -1)))
(add-hook! hl-line-mode (if hl-line-mode (setq doom--hl-line-mode t))) (add-hook! hl-line-mode (if hl-line-mode (setq doom--hl-line-mode t)))
;; Disable line highlight in visual mode ;; Disable line highlight in visual mode
(add-hook 'evil-visual-state-entry-hook 'doom|hl-line-off) (add-hook 'evil-visual-state-entry-hook 'doom|hl-line-off)
@ -132,11 +120,9 @@
(add-hook! (nxml-mode yaml-mode json-mode scss-mode (add-hook! (nxml-mode yaml-mode json-mode scss-mode
c-mode-common ruby-mode python-mode lua-mode) c-mode-common ruby-mode python-mode lua-mode)
'highlight-indentation-mode) 'highlight-indentation-mode)
(after! editorconfig (after! editorconfig
(advice-add 'highlight-indentation-guess-offset (advice-add 'highlight-indentation-guess-offset
:override 'doom*hl-indent-guess-offset)) :override 'doom*hl-indent-guess-offset))
;; A long-winded method for ensuring whitespace is maintained (so that ;; A long-winded method for ensuring whitespace is maintained (so that
;; highlight-indentation-mode can display them consistently) ;; highlight-indentation-mode can display them consistently)
(add-hook! highlight-indentation-mode (add-hook! highlight-indentation-mode
@ -152,17 +138,15 @@
(use-package rainbow-delimiters (use-package rainbow-delimiters
:commands rainbow-delimiters-mode :commands rainbow-delimiters-mode
:config (setq rainbow-delimiters-max-face-count 3)
:init :init
(add-hook! (emacs-lisp-mode lisp-mode js2-mode css-mode c-mode-common) (add-hook! (emacs-lisp-mode lisp-mode js-mode css-mode c-mode-common)
'rainbow-delimiters-mode) 'rainbow-delimiters-mode))
:config
(setq rainbow-delimiters-max-face-count 3))
;; NOTE hl-line-mode and rainbow-mode don't play well together
(use-package rainbow-mode (use-package rainbow-mode
:commands (rainbow-mode) :commands (rainbow-mode)
:init :init (add-hook 'rainbow-mode-hook 'doom|hl-line-off))
;; hl-line-mode and rainbow-mode don't play well together
(add-hook 'rainbow-mode-hook 'doom|hl-line-off))
(use-package nlinum (use-package nlinum
:commands nlinum-mode :commands nlinum-mode
@ -183,8 +167,7 @@
(add-hook 'post-command-hook 'doom|nlinum-hl-line nil t)) (add-hook 'post-command-hook 'doom|nlinum-hl-line nil t))
:config :config
(add-hook! nlinum-mode (add-hook! nlinum-mode
(setq nlinum--width (setq nlinum--width (length (save-excursion (goto-char (point-max))
(length (save-excursion (goto-char (point-max))
(format-mode-line "%l")))))) (format-mode-line "%l"))))))
@ -233,7 +216,7 @@
(powerline-raw (powerline-raw
(concat (when buffer-file-name (concat (when buffer-file-name
(concat (concat
(if (buffer-modified-p) "") (if (buffer-modified-p) " ")
(if (not (file-exists-p buffer-file-name)) "[!]"))) (if (not (file-exists-p buffer-file-name)) "[!]")))
(if buffer-read-only "[RO]")) (if buffer-read-only "[RO]"))
'mode-line-is-modified))) 'mode-line-is-modified)))