2016-10-04 22:54:13 +02:00
|
|
|
|
;;; core-ui.el
|
2015-06-15 09:05:52 +02:00
|
|
|
|
|
2016-10-04 22:52:43 +02:00
|
|
|
|
(defvar doom-ui-fringe-size '3
|
|
|
|
|
"Default fringe width")
|
|
|
|
|
|
2016-10-04 23:16:38 +02:00
|
|
|
|
(defvar doom-ui-theme 'doom-one
|
2016-10-04 22:52:43 +02:00
|
|
|
|
"The color theme currently in use.")
|
|
|
|
|
|
|
|
|
|
(defvar doom-ui-font
|
|
|
|
|
(font-spec :family "Fira Mono" :size 12)
|
|
|
|
|
"The font currently in use.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
;; Configuration
|
|
|
|
|
;;
|
2016-05-23 17:13:59 -04:00
|
|
|
|
|
2015-06-04 18:23:21 -04:00
|
|
|
|
(setq-default
|
2016-09-22 13:38:54 +02:00
|
|
|
|
mode-line-default-help-echo nil ; don't say anything on mode-line mouseover
|
|
|
|
|
indicate-buffer-boundaries nil ; don't show where buffer starts/ends
|
|
|
|
|
indicate-empty-lines nil ; don't show empty lines
|
|
|
|
|
fringes-outside-margins t ; switches order of fringe and margin
|
2016-05-07 21:57:43 -04:00
|
|
|
|
;; Keep cursors and highlights in current window only
|
|
|
|
|
cursor-in-non-selected-windows nil
|
2016-04-08 16:15:37 -04:00
|
|
|
|
highlight-nonselected-windows nil
|
2016-05-23 17:13:59 -04:00
|
|
|
|
;; 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)
|
2016-04-08 16:15:37 -04:00
|
|
|
|
|
2016-05-23 17:13:59 -04:00
|
|
|
|
blink-matching-paren nil ; don't blink--too distracting
|
|
|
|
|
show-paren-delay 0.075
|
|
|
|
|
uniquify-buffer-name-style nil
|
2016-04-08 16:15:37 -04:00
|
|
|
|
visible-bell nil
|
|
|
|
|
visible-cursor nil
|
|
|
|
|
x-stretch-cursor t
|
2016-05-12 03:06:39 -04:00
|
|
|
|
use-dialog-box nil ; always avoid GUI
|
|
|
|
|
redisplay-dont-pause t ; don't pause display on input
|
|
|
|
|
split-width-threshold nil ; favor horizontal splits
|
|
|
|
|
show-help-function nil ; hide :help-echo text
|
2016-04-26 02:00:19 -04:00
|
|
|
|
jit-lock-defer-time nil
|
2016-04-08 16:15:37 -04:00
|
|
|
|
jit-lock-stealth-nice 0.1
|
|
|
|
|
jit-lock-stealth-time 0.2
|
|
|
|
|
jit-lock-stealth-verbose nil
|
2015-12-11 16:51:04 -05:00
|
|
|
|
;; Minibuffer resizing
|
2016-05-01 01:05:25 -04:00
|
|
|
|
resize-mini-windows 'grow-only
|
|
|
|
|
max-mini-window-height 0.3
|
2016-10-05 21:53:27 +02:00
|
|
|
|
image-animate-loop t
|
2016-05-23 17:13:59 -04:00
|
|
|
|
;; Ask for confirmation on exit only if there are real buffers left
|
|
|
|
|
confirm-kill-emacs
|
2016-09-23 12:34:59 +02:00
|
|
|
|
(lambda (_)
|
2016-10-03 12:07:04 +02:00
|
|
|
|
(if (ignore-errors (doom/get-real-buffers))
|
2016-09-23 12:34:59 +02:00
|
|
|
|
(y-or-n-p "››› Quit?")
|
|
|
|
|
t)))
|
2015-11-30 16:51:13 -05:00
|
|
|
|
|
2016-09-26 16:26:11 +02:00
|
|
|
|
;; y/n instead of yes/no
|
|
|
|
|
(fset 'yes-or-no-p 'y-or-n-p)
|
|
|
|
|
|
2016-09-22 21:18:48 +02:00
|
|
|
|
;; mode-line is unimportant in help/compile windows
|
2016-06-05 23:08:46 -04:00
|
|
|
|
(add-hook 'help-mode-hook 'doom-hide-mode-line-mode)
|
|
|
|
|
(add-hook 'compilation-mode-hook 'doom-hide-mode-line-mode)
|
2016-09-23 16:09:32 +02:00
|
|
|
|
(add-hook 'messages-buffer-mode-hook 'doom-hide-mode-line-mode)
|
|
|
|
|
(with-current-buffer "*Messages*" (doom-hide-mode-line-mode +1))
|
2016-03-03 15:04:14 -05:00
|
|
|
|
|
2016-09-22 21:18:48 +02:00
|
|
|
|
;; Eldoc is enabled globally on Emacs 25. No thank you, I'll do it myself.
|
2016-10-02 23:26:29 +02:00
|
|
|
|
(when (bound-and-true-p global-eldoc-mode)
|
2016-01-30 21:16:10 -05:00
|
|
|
|
(global-eldoc-mode -1))
|
2015-11-10 18:01:57 -05:00
|
|
|
|
|
2016-09-22 21:18:48 +02:00
|
|
|
|
;; TODO/FIXME/NOTE highlighting in comments
|
2016-05-16 00:41:25 -04:00
|
|
|
|
(add-hook! (prog-mode emacs-lisp-mode css-mode)
|
2016-04-26 02:00:19 -04:00
|
|
|
|
(font-lock-add-keywords
|
2016-05-23 17:14:37 -04:00
|
|
|
|
nil '(("\\<\\(TODO\\(?:(.*)\\)?:?\\)\\>" 1 'warning prepend)
|
|
|
|
|
("\\<\\(FIXME\\(?:(.*)\\)?:?\\)\\>" 1 'error prepend)
|
|
|
|
|
("\\<\\(NOTE\\(?:(.*)\\)?:?\\)\\>" 1 'success prepend))))
|
2015-06-04 18:23:21 -04:00
|
|
|
|
|
2016-09-22 13:38:09 +02:00
|
|
|
|
;; `window-divider-mode' gives us finer control over the border between windows.
|
|
|
|
|
;; The native border "consumes" a pixel of the fringe on righter-most splits (in
|
|
|
|
|
;; Yamamoto's emacs-mac at least), window-divider does not.
|
|
|
|
|
;; NOTE Only available on Emacs 25.1+
|
|
|
|
|
(when (boundp 'window-divider-mode)
|
|
|
|
|
(setq window-divider-default-places t
|
|
|
|
|
window-divider-default-bottom-width 1
|
|
|
|
|
window-divider-default-right-width 1)
|
|
|
|
|
(window-divider-mode +1))
|
|
|
|
|
|
2016-03-03 15:04:14 -05:00
|
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
;; Plugins
|
|
|
|
|
;;
|
|
|
|
|
|
2016-10-04 22:54:13 +02:00
|
|
|
|
(use-package all-the-icons
|
|
|
|
|
:commands (all-the-icons-icon-for-buffer
|
|
|
|
|
all-the-icons-icon-for-file
|
|
|
|
|
all-the-icons-icon-for-mode
|
|
|
|
|
all-the-icons-alltheicon
|
|
|
|
|
all-the-icons-faicon
|
|
|
|
|
all-the-icons-fileicon
|
|
|
|
|
all-the-icons-oction
|
|
|
|
|
all-the-icons-wicon))
|
|
|
|
|
|
2016-09-15 01:50:49 +02:00
|
|
|
|
(use-package doom-themes
|
2016-09-07 17:16:13 +02:00
|
|
|
|
:config
|
2016-09-19 17:39:02 +02:00
|
|
|
|
(setq doom-neotree-enable-variable-pitch t
|
|
|
|
|
doom-neotree-line-spacing 3)
|
2016-10-04 22:52:43 +02:00
|
|
|
|
(load-theme doom-ui-theme t)
|
2016-09-19 17:39:02 +02:00
|
|
|
|
;; brighter source buffers
|
|
|
|
|
(add-hook 'find-file-hook 'doom-buffer-mode)
|
|
|
|
|
;; brighter minibuffer when active
|
2016-09-15 01:50:49 +02:00
|
|
|
|
(add-hook 'minibuffer-setup-hook 'doom-brighten-minibuffer)
|
2016-09-19 17:39:02 +02:00
|
|
|
|
;; Custom neotree theme
|
|
|
|
|
(require 'doom-neotree))
|
2016-09-07 17:16:13 +02:00
|
|
|
|
|
2016-08-28 22:08:48 +02:00
|
|
|
|
(use-package beacon
|
|
|
|
|
:config
|
|
|
|
|
(beacon-mode +1)
|
|
|
|
|
(setq beacon-color (face-attribute 'highlight :background nil t)
|
|
|
|
|
beacon-blink-when-buffer-changes t
|
|
|
|
|
beacon-blink-when-point-moves-vertically 10))
|
|
|
|
|
|
2016-05-01 01:05:25 -04:00
|
|
|
|
(use-package hl-line
|
2016-08-28 22:54:48 +02:00
|
|
|
|
:init (add-hook 'prog-mode-hook 'hl-line-mode)
|
2016-05-01 01:05:25 -04:00
|
|
|
|
:config
|
2016-09-22 21:18:48 +02:00
|
|
|
|
;; Doesn't play nice with emacs 25+
|
2016-06-08 14:43:40 -04:00
|
|
|
|
(setq hl-line-sticky-flag nil
|
|
|
|
|
global-hl-line-sticky-flag nil)
|
2016-05-01 01:05:25 -04:00
|
|
|
|
|
2016-06-05 00:56:28 -04:00
|
|
|
|
(defvar-local doom--hl-line-mode nil)
|
2016-05-20 22:37:30 -04:00
|
|
|
|
(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)))
|
|
|
|
|
(add-hook! hl-line-mode (if hl-line-mode (setq doom--hl-line-mode t)))
|
2016-05-01 01:05:25 -04:00
|
|
|
|
;; Disable line highlight in visual mode
|
2016-05-20 22:37:30 -04:00
|
|
|
|
(add-hook 'evil-visual-state-entry-hook 'doom|hl-line-off)
|
|
|
|
|
(add-hook 'evil-visual-state-exit-hook 'doom|hl-line-on))
|
2016-05-01 01:05:25 -04:00
|
|
|
|
|
2016-04-12 02:59:36 -04:00
|
|
|
|
(use-package highlight-indentation
|
2016-05-12 22:11:43 -04:00
|
|
|
|
:commands (highlight-indentation-mode
|
|
|
|
|
highlight-indentation-current-column-mode)
|
2016-04-12 02:59:36 -04:00
|
|
|
|
:init
|
2016-04-23 22:08:46 -04:00
|
|
|
|
(after! editorconfig
|
2016-05-12 22:11:43 -04:00
|
|
|
|
(advice-add 'highlight-indentation-guess-offset
|
2016-05-20 22:37:30 -04:00
|
|
|
|
:override 'doom*hl-indent-guess-offset))
|
2016-09-26 16:26:11 +02:00
|
|
|
|
;; Since empty lines are stripped on save, the indentation highlights will
|
|
|
|
|
;; have unseemly breaks in them. These hooks will indent empty lines so that
|
|
|
|
|
;; the highlights are consistent, without affecting the saved output.
|
2016-04-12 02:59:36 -04:00
|
|
|
|
(add-hook! highlight-indentation-mode
|
|
|
|
|
(if highlight-indentation-mode
|
|
|
|
|
(progn
|
2016-05-20 22:37:30 -04:00
|
|
|
|
(doom/add-whitespace)
|
2016-06-09 00:22:39 -04:00
|
|
|
|
(add-hook 'after-save-hook 'doom/add-whitespace nil t))
|
2016-05-20 22:37:30 -04:00
|
|
|
|
(remove-hook 'after-save-hook 'doom/add-whitespace t)
|
2016-06-09 00:22:39 -04:00
|
|
|
|
(delete-trailing-whitespace))))
|
2016-04-12 02:59:36 -04:00
|
|
|
|
|
2016-04-16 00:44:18 -04:00
|
|
|
|
(use-package highlight-numbers :commands (highlight-numbers-mode))
|
|
|
|
|
|
2015-10-26 01:29:38 -04:00
|
|
|
|
(use-package nlinum
|
2015-10-28 03:31:51 -04:00
|
|
|
|
:commands nlinum-mode
|
2015-06-06 06:40:33 -04:00
|
|
|
|
:preface
|
2016-05-12 22:11:43 -04:00
|
|
|
|
(setq linum-format "%3d ")
|
2016-05-28 21:51:21 -04:00
|
|
|
|
(defvar nlinum-format "%4d ")
|
2016-05-20 22:37:30 -04:00
|
|
|
|
(defvar doom--hl-nlinum-overlay nil)
|
|
|
|
|
(defvar doom--hl-nlinum-line nil)
|
2015-11-09 15:52:42 -05:00
|
|
|
|
:init
|
2015-11-10 18:01:57 -05:00
|
|
|
|
(add-hook!
|
2016-09-05 12:24:47 +02:00
|
|
|
|
(markdown-mode prog-mode scss-mode web-mode conf-mode groovy-mode
|
|
|
|
|
nxml-mode snippet-mode php-mode)
|
2016-04-30 23:13:39 -04:00
|
|
|
|
'nlinum-mode)
|
2016-08-28 22:54:48 +02:00
|
|
|
|
;; FIXME This only works if hl-line is active!
|
|
|
|
|
(add-hook! nlinum-mode
|
2016-05-26 18:51:39 -04:00
|
|
|
|
(if nlinum-mode-hook
|
|
|
|
|
(add-hook 'post-command-hook 'doom|nlinum-hl-line nil t)
|
|
|
|
|
(remove-hook 'post-command-hook 'doom|nlinum-hl-line t)))
|
2015-10-03 04:56:33 -04:00
|
|
|
|
:config
|
2016-09-26 16:26:11 +02:00
|
|
|
|
;; Calculate line number column width beforehand
|
2015-06-15 09:05:52 +02:00
|
|
|
|
(add-hook! nlinum-mode
|
2016-05-23 17:13:59 -04:00
|
|
|
|
(setq nlinum--width (length (save-excursion (goto-char (point-max))
|
2016-05-24 22:50:39 -04:00
|
|
|
|
(format-mode-line "%l")))))
|
2016-08-28 22:54:48 +02:00
|
|
|
|
|
2016-05-24 22:50:39 -04:00
|
|
|
|
;; Disable nlinum when making frames, otherwise we get linum face error
|
|
|
|
|
;; messages that prevent frame creation.
|
|
|
|
|
(add-hook 'before-make-frame-hook 'doom|nlinum-disable)
|
|
|
|
|
(add-hook 'after-make-frame-functions 'doom|nlinum-enable))
|
2015-10-26 01:29:38 -04:00
|
|
|
|
|
2016-08-28 22:54:48 +02:00
|
|
|
|
(use-package rainbow-delimiters
|
|
|
|
|
:commands rainbow-delimiters-mode
|
|
|
|
|
:config (setq rainbow-delimiters-max-face-count 3)
|
|
|
|
|
:init
|
|
|
|
|
(add-hook! (emacs-lisp-mode lisp-mode js-mode css-mode c-mode-common)
|
|
|
|
|
'rainbow-delimiters-mode))
|
|
|
|
|
|
|
|
|
|
;; NOTE hl-line-mode and rainbow-mode don't play well together
|
|
|
|
|
(use-package rainbow-mode
|
|
|
|
|
:commands rainbow-mode
|
|
|
|
|
:init (after! hl-line (add-hook 'rainbow-mode-hook 'doom|hl-line-off)))
|
|
|
|
|
|
|
|
|
|
(use-package stripe-buffer
|
|
|
|
|
:commands stripe-buffer-mode
|
|
|
|
|
:init (add-hook 'dired-mode-hook 'stripe-buffer-mode))
|
|
|
|
|
|
|
|
|
|
(use-package visual-fill-column :defer t
|
|
|
|
|
:config
|
|
|
|
|
(setq-default visual-fill-column-center-text nil
|
|
|
|
|
visual-fill-column-width fill-column
|
|
|
|
|
split-window-preferred-function 'visual-line-mode-split-window-sensibly))
|
|
|
|
|
|
2016-10-04 22:52:43 +02:00
|
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
;; Bootstrap
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
(tooltip-mode -1) ; relegate tooltips to echo area only
|
|
|
|
|
(menu-bar-mode -1)
|
|
|
|
|
(when window-system
|
|
|
|
|
(scroll-bar-mode -1)
|
|
|
|
|
(tool-bar-mode -1)
|
|
|
|
|
;; full filename in frame title
|
|
|
|
|
(setq frame-title-format '(buffer-file-name "%f" ("%b")))
|
|
|
|
|
;; Set theme and font
|
|
|
|
|
(with-demoted-errors "FONT ERROR: %s"
|
|
|
|
|
(set-frame-font doom-ui-font t)
|
|
|
|
|
;; Fallback to `doom-unicode-font' for Unicode characters
|
|
|
|
|
(set-fontset-font t 'unicode doom-ui-font))
|
|
|
|
|
;; standardize fringe width
|
|
|
|
|
(fringe-mode doom-ui-fringe-size)
|
|
|
|
|
(push `(left-fringe . ,doom-ui-fringe-size) default-frame-alist)
|
|
|
|
|
(push `(right-fringe . ,doom-ui-fringe-size) default-frame-alist)
|
|
|
|
|
;; slightly larger default frame size on startup
|
|
|
|
|
(push '(width . 120) default-frame-alist)
|
|
|
|
|
(push '(height . 40) default-frame-alist)
|
|
|
|
|
;; Slightly transparent frame
|
|
|
|
|
(push '(alpha . 98) default-frame-alist)
|
|
|
|
|
;; no fringe in the minibuffer
|
|
|
|
|
(add-hook! (emacs-startup minibuffer-setup)
|
|
|
|
|
(set-window-fringes (minibuffer-window) 0 0 nil))
|
|
|
|
|
;; Show tilde in margin on empty lines
|
|
|
|
|
(define-fringe-bitmap 'tilde [64 168 16] nil nil 'center)
|
|
|
|
|
(set-fringe-bitmap-face 'tilde 'fringe)
|
|
|
|
|
(setcdr (assq 'empty-line fringe-indicator-alist) 'tilde))
|
|
|
|
|
|
2015-06-04 18:23:21 -04:00
|
|
|
|
(provide 'core-ui)
|
|
|
|
|
;;; core-ui.el ends here
|