2015-06-06 06:40:33 -04:00
|
|
|
;;; core-ui.el --- interface settings
|
2015-06-15 09:05:52 +02:00
|
|
|
;; see lib/ui-defuns.el
|
|
|
|
|
2015-06-04 18:23:21 -04:00
|
|
|
(setq-default
|
2015-10-08 01:46:19 -04:00
|
|
|
blink-matching-paren nil
|
2015-11-09 15:52:42 -05:00
|
|
|
show-paren-delay 0.075
|
2015-10-26 01:29:38 -04:00
|
|
|
|
2015-07-28 13:13:20 +02:00
|
|
|
;; Multiple cursors across buffers cause a strange redraw delay for
|
|
|
|
;; some things, like auto-complete or evil-mode's cursor color
|
|
|
|
;; switching.
|
2015-06-04 18:23:21 -04:00
|
|
|
cursor-in-non-selected-windows nil
|
2015-11-09 15:52:42 -05:00
|
|
|
highlight-nonselected-windows nil
|
2015-07-28 13:13:20 +02:00
|
|
|
|
2015-10-12 04:31:55 -04:00
|
|
|
uniquify-buffer-name-style nil
|
2015-11-10 18:01:57 -05:00
|
|
|
visible-bell nil ; silence of the bells
|
|
|
|
use-dialog-box nil ; always avoid GUI
|
2015-11-09 15:52:42 -05:00
|
|
|
redisplay-dont-pause t
|
2015-06-04 18:23:21 -04:00
|
|
|
indicate-buffer-boundaries nil
|
2015-11-10 18:01:57 -05:00
|
|
|
indicate-empty-lines t
|
|
|
|
fringes-outside-margins t
|
2015-11-14 02:35:15 -05:00
|
|
|
hl-line-sticky-flag nil ; only highlight in one window
|
2015-10-26 01:29:38 -04:00
|
|
|
|
2015-11-23 15:19:43 -05:00
|
|
|
jit-lock-defer-time nil
|
2015-11-17 21:48:21 -05:00
|
|
|
jit-lock-stealth-time 1
|
2015-10-15 14:01:53 -04:00
|
|
|
|
2015-11-30 16:51:13 -05:00
|
|
|
split-width-threshold nil
|
|
|
|
split-height-threshold 30
|
|
|
|
|
|
|
|
resize-mini-windows 'grow-only
|
|
|
|
|
|
|
|
fringe-indicator-alist (delq (assoc 'continuation fringe-indicator-alist) fringe-indicator-alist))
|
2015-10-15 14:01:53 -04:00
|
|
|
|
2015-11-14 02:35:15 -05:00
|
|
|
(defvar narf-fringe-size 6)
|
|
|
|
(if window-system
|
|
|
|
(progn
|
|
|
|
(fringe-mode narf-fringe-size)
|
|
|
|
(setq frame-title-format '(buffer-file-name "%f" ("%b")))
|
|
|
|
|
|
|
|
(set-frame-font narf-default-font)
|
|
|
|
(set-face-attribute 'default t :font narf-default-font)
|
|
|
|
|
|
|
|
(define-fringe-bitmap 'tilde [64 168 16] nil nil 'center)
|
|
|
|
(setcdr (assq 'empty-line fringe-indicator-alist) 'tilde)
|
2015-11-30 16:51:13 -05:00
|
|
|
(set-fringe-bitmap-face 'tilde 'font-lock-comment-face)
|
|
|
|
|
|
|
|
(set-window-fringes (minibuffer-window) 0 0 nil)
|
|
|
|
(defun narf|minibuffer-setup ()
|
|
|
|
(make-local-variable 'face-remapping-alist)
|
|
|
|
(set-window-fringes (selected-window) 0 0 nil)
|
|
|
|
(add-to-list 'face-remapping-alist '(default mode-line-inactive)))
|
|
|
|
(add-hook! minibuffer-setup 'narf|minibuffer-setup))
|
2015-11-14 02:35:15 -05:00
|
|
|
(menu-bar-mode -1))
|
|
|
|
|
2015-11-17 02:05:34 -05:00
|
|
|
(mapc (lambda (x) (set-fontset-font "fontset-default" `(,x . ,x) "DejaVu Sans" nil 'prepend))
|
|
|
|
'(?☑ ?☐))
|
|
|
|
|
|
|
|
(blink-cursor-mode 1) ; do blink cursor
|
2015-11-10 18:01:57 -05:00
|
|
|
(tooltip-mode -1) ; show tooltips in echo area
|
2015-11-30 16:51:13 -05:00
|
|
|
(when (featurep 'eldoc)
|
|
|
|
(global-eldoc-mode -1)) ; on by default in Emacs 25?
|
2015-11-10 18:01:57 -05:00
|
|
|
|
|
|
|
;; Highlight line
|
|
|
|
(add-hook! (prog-mode puml-mode markdown-mode) 'hl-line-mode)
|
|
|
|
|
|
|
|
;; Disable line highlight in visual mode
|
|
|
|
(defvar narf--hl-line-mode nil)
|
|
|
|
(make-variable-buffer-local 'narf--hl-line-mode)
|
|
|
|
|
|
|
|
(defun narf|hl-line-on ()
|
|
|
|
(when narf--hl-line-mode (hl-line-mode +1)))
|
|
|
|
(defun narf|hl-line-off ()
|
|
|
|
(when narf--hl-line-mode (hl-line-mode -1)))
|
|
|
|
|
|
|
|
(add-hook! hl-line-mode (if hl-line-mode (setq narf--hl-line-mode t)))
|
|
|
|
(add-hook! evil-visual-state-entry 'narf|hl-line-off)
|
|
|
|
(add-hook! evil-visual-state-exit 'narf|hl-line-on)
|
|
|
|
|
|
|
|
;; Hide modeline in help windows ;;;;;;;
|
2015-10-15 14:01:53 -04:00
|
|
|
(add-hook! help-mode (setq-local mode-line-format nil))
|
|
|
|
|
2015-11-10 18:01:57 -05:00
|
|
|
;; Highlight TODO/FIXME/NOTE tags ;;;;;;
|
2015-11-07 20:16:31 -05:00
|
|
|
(defface narf-todo-face '((t (:inherit font-lock-warning-face))) "Face for TODOs")
|
|
|
|
(defface narf-fixme-face '((t (:inherit font-lock-warning-face))) "Face for FIXMEs")
|
|
|
|
(defface narf-note-face '((t (:inherit font-lock-warning-face))) "Face for NOTEs")
|
|
|
|
(add-hook! (prog-mode emacs-lisp-mode)
|
2015-11-18 15:22:00 -05:00
|
|
|
(font-lock-add-keywords nil '(("\\<\\(TODO\\((.+)\\)?:?\\)" 1 'narf-todo-face prepend)
|
|
|
|
("\\<\\(FIXME\\((.+)\\)?:?\\)" 1 'narf-fixme-face prepend)
|
|
|
|
("\\<\\(NOTE\\((.+)\\)?:?\\)" 1 'narf-note-face prepend))))
|
2015-06-04 18:23:21 -04:00
|
|
|
|
2015-11-10 18:02:09 -05:00
|
|
|
;; Fade out when unfocused ;;;;;;;;;;;;;
|
2015-11-18 15:22:00 -05:00
|
|
|
(add-hook! focus-in (set-frame-parameter nil 'alpha 100))
|
2015-11-30 16:51:13 -05:00
|
|
|
(add-hook! focus-out (set-frame-parameter nil 'alpha 90))
|
2015-11-10 18:02:09 -05:00
|
|
|
|
2015-11-17 02:11:25 -05:00
|
|
|
;; Plugins ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2015-11-30 16:51:13 -05:00
|
|
|
(use-package visual-fill-column :defer t)
|
|
|
|
|
2015-11-19 05:52:22 -05:00
|
|
|
(use-package yascroll
|
|
|
|
:commands (yascroll-bar-mode)
|
|
|
|
:config
|
|
|
|
(add-to-list 'yascroll:enabled-window-systems 'mac)
|
2015-11-20 04:00:38 -05:00
|
|
|
(setq yascroll:scroll-bar 'left-fringe
|
|
|
|
yascroll:delay-to-hide nil))
|
2015-11-19 05:52:22 -05:00
|
|
|
|
2015-10-15 14:01:53 -04:00
|
|
|
(use-package hideshow
|
|
|
|
:commands (hs-minor-mode hs-toggle-hiding hs-already-hidden-p)
|
2015-11-10 18:02:09 -05:00
|
|
|
:config (setq hs-isearch-open t)
|
2015-10-15 14:01:53 -04:00
|
|
|
:init
|
|
|
|
(after! evil
|
|
|
|
(defun narf-load-hs-minor-mode ()
|
2015-11-10 18:02:09 -05:00
|
|
|
(hs-minor-mode 1)
|
|
|
|
(advice-remove 'evil-toggle-fold 'narf-load-hs-minor-mode))
|
2015-11-20 04:00:38 -05:00
|
|
|
(advice-add 'evil-toggle-fold :before 'narf-load-hs-minor-mode))
|
|
|
|
|
|
|
|
;; Prettify code folding in emacs ;;;;;;
|
|
|
|
(define-fringe-bitmap 'hs-marker [16 48 112 240 112 48 16] nil nil 'center)
|
|
|
|
(defface hs-face '((t (:background "#ff8")))
|
|
|
|
"Face to hightlight the ... area of hidden regions"
|
|
|
|
:group 'hideshow)
|
|
|
|
(defface hs-fringe-face '((t (:foreground "#888")))
|
|
|
|
"Face used to highlight the fringe on folded regions"
|
|
|
|
:group 'hideshow)
|
|
|
|
|
|
|
|
(setq hs-set-up-overlay
|
|
|
|
(lambda (ov)
|
|
|
|
(when (eq 'code (overlay-get ov 'hs))
|
|
|
|
(let* ((marker-string "*fringe-dummy*")
|
|
|
|
(marker-length (length marker-string))
|
|
|
|
(display-string (format " ... " (count-lines (overlay-start ov)
|
|
|
|
(overlay-end ov)))))
|
|
|
|
(put-text-property 0 marker-length 'display
|
|
|
|
(list 'right-fringe 'hs-marker 'hs-fringe-face) marker-string)
|
|
|
|
(put-text-property 0 (length display-string) 'face 'hs-face display-string)
|
|
|
|
(overlay-put ov 'before-string marker-string)
|
|
|
|
(overlay-put ov 'display display-string))))))
|
2015-10-15 14:01:53 -04:00
|
|
|
|
|
|
|
(use-package rainbow-delimiters
|
|
|
|
:commands rainbow-delimiters-mode
|
2015-11-24 20:52:40 -05:00
|
|
|
:init (add-hook! (emacs-lisp-mode lisp-mode js2-mode scss-mode) 'rainbow-delimiters-mode)
|
2015-11-09 15:52:42 -05:00
|
|
|
:config (setq rainbow-delimiters-max-face-count 4))
|
2015-10-15 14:01:53 -04:00
|
|
|
|
2015-11-09 15:52:42 -05:00
|
|
|
(use-package rainbow-mode :defer t
|
2015-11-18 15:22:00 -05:00
|
|
|
:init
|
|
|
|
(add-hook! rainbow-mode
|
|
|
|
(when narf--hl-line-mode
|
|
|
|
(hl-line-mode (if rainbow-mode -1 1)))))
|
2015-10-15 14:01:53 -04:00
|
|
|
|
|
|
|
(use-package volatile-highlights
|
|
|
|
:config
|
|
|
|
(vhl/define-extension 'my-undo-tree-highlights
|
2015-10-26 01:29:38 -04:00
|
|
|
'undo-tree-undo 'undo-tree-redo)
|
2015-10-15 14:01:53 -04:00
|
|
|
(vhl/install-extension 'my-undo-tree-highlights)
|
2015-11-14 02:35:15 -05:00
|
|
|
(vhl/define-extension 'my-yank-highlights
|
|
|
|
'evil-yank 'evil-paste-after 'evil-paste-before 'evil-paste-pop)
|
|
|
|
(vhl/install-extension 'my-yank-highlights)
|
2015-10-15 14:01:53 -04:00
|
|
|
(volatile-highlights-mode t))
|
|
|
|
|
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
|
|
|
|
(defvar narf--hl-nlinum-overlay nil)
|
2015-11-09 15:52:42 -05:00
|
|
|
(defvar narf--hl-nlinum-line nil)
|
2015-11-30 16:51:13 -05:00
|
|
|
(defvar nlinum-format "%5d ")
|
2015-10-03 04:56:33 -04:00
|
|
|
(defface linum-highlight-face '((t (:inherit linum))) "Face for line highlights")
|
2015-11-19 05:50:04 -05:00
|
|
|
(setq linum-format "%3d ")
|
2015-11-09 15:52:42 -05:00
|
|
|
:init
|
2015-10-03 04:56:33 -04:00
|
|
|
(defun narf|nlinum-enable ()
|
|
|
|
(nlinum-mode +1)
|
2015-11-14 02:35:15 -05:00
|
|
|
(add-hook 'post-command-hook 'narf|nlinum-hl-line t))
|
2015-10-21 05:16:32 -04:00
|
|
|
|
2015-10-03 04:56:33 -04:00
|
|
|
(defun narf|nlinum-disable ()
|
|
|
|
(nlinum-mode -1)
|
|
|
|
(remove-hook 'post-command-hook 'narf|nlinum-hl-line)
|
|
|
|
(narf|nlinum-unhl-line))
|
|
|
|
|
2015-11-10 18:01:57 -05:00
|
|
|
(add-hook!
|
|
|
|
(markdown-mode prog-mode scss-mode web-mode)
|
|
|
|
'narf|nlinum-enable)
|
2015-10-03 04:56:33 -04:00
|
|
|
:config
|
2015-06-06 06:40:33 -04:00
|
|
|
(defun narf|nlinum-unhl-line ()
|
2015-11-14 02:35:15 -05:00
|
|
|
"Unhighlight line number"
|
2015-06-06 06:40:33 -04:00
|
|
|
(when narf--hl-nlinum-overlay
|
2015-12-09 01:59:50 -05:00
|
|
|
(let* ((disp (get-text-property
|
|
|
|
0 'display (overlay-get narf--hl-nlinum-overlay 'before-string)))
|
2015-06-06 06:40:33 -04:00
|
|
|
(str (nth 1 disp)))
|
|
|
|
(put-text-property 0 (length str) 'face 'linum str)
|
|
|
|
(setq narf--hl-nlinum-overlay nil
|
2015-12-09 01:59:50 -05:00
|
|
|
narf--hl-nlinum-line nil)
|
|
|
|
disp)))
|
2015-06-06 06:40:33 -04:00
|
|
|
|
|
|
|
(defun narf|nlinum-hl-line (&optional line)
|
2015-11-14 02:35:15 -05:00
|
|
|
"Highlight line number"
|
|
|
|
(let ((line-no (or line (string-to-number (format-mode-line "%l")))))
|
2015-06-06 06:40:33 -04:00
|
|
|
(when (and nlinum-mode (not (eq line-no narf--hl-nlinum-line)))
|
2015-12-09 01:59:50 -05:00
|
|
|
(let* ((pbol (if line
|
|
|
|
(save-excursion (goto-char (point-min))
|
|
|
|
(forward-line line-no)
|
|
|
|
(line-beginning-position))
|
2015-11-14 02:35:15 -05:00
|
|
|
(line-beginning-position)))
|
2015-06-06 06:40:33 -04:00
|
|
|
(peol (1+ pbol)))
|
|
|
|
;; Handle EOF case
|
2015-10-28 03:31:51 -04:00
|
|
|
(let ((max (point-max)))
|
|
|
|
(when (>= peol max)
|
|
|
|
(setq peol max)))
|
2015-06-06 06:40:33 -04:00
|
|
|
(jit-lock-fontify-now pbol peol)
|
2015-12-09 01:59:50 -05:00
|
|
|
(let ((ov (-first (lambda (item) (overlay-get item 'nlinum)) (overlays-in pbol peol))))
|
2015-06-06 06:40:33 -04:00
|
|
|
(when ov
|
|
|
|
(narf|nlinum-unhl-line)
|
2015-11-09 15:52:42 -05:00
|
|
|
(let ((str (nth 1 (get-text-property 0 'display (overlay-get ov 'before-string)))))
|
2015-06-06 06:40:33 -04:00
|
|
|
(put-text-property 0 (length str) 'face 'linum-highlight-face str)
|
|
|
|
(setq narf--hl-nlinum-overlay ov
|
|
|
|
narf--hl-nlinum-line line-no))))))))
|
|
|
|
|
2015-06-15 09:05:52 +02:00
|
|
|
(add-hook! nlinum-mode
|
2015-10-26 01:29:38 -04:00
|
|
|
(setq nlinum--width
|
2015-12-09 01:59:50 -05:00
|
|
|
(length (save-excursion (goto-char (point-max))
|
|
|
|
(format-mode-line "%l"))))))
|
2015-10-26 01:29:38 -04:00
|
|
|
|
2015-06-06 06:40:33 -04:00
|
|
|
|
2015-09-27 23:36:09 -04:00
|
|
|
;; Mode-line ;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2015-06-06 06:40:33 -04:00
|
|
|
|
2015-09-28 15:55:25 -04:00
|
|
|
(use-package spaceline-segments
|
2015-11-07 00:20:04 -05:00
|
|
|
:init
|
|
|
|
(defvar narf--env-version nil)
|
|
|
|
(defvar narf--env-command nil)
|
|
|
|
(make-variable-buffer-local 'narf--env-version)
|
|
|
|
(make-variable-buffer-local 'narf--env-command)
|
2015-09-30 13:47:57 -04:00
|
|
|
:config
|
2015-09-28 15:55:25 -04:00
|
|
|
(setq-default
|
2015-10-15 14:01:53 -04:00
|
|
|
powerline-default-separator nil
|
2015-11-19 05:52:22 -05:00
|
|
|
powerline-height 19
|
|
|
|
spaceline-highlight-face-func 'spaceline-highlight-face-evil-state)
|
2015-09-28 15:55:25 -04:00
|
|
|
|
2015-10-01 03:40:09 -04:00
|
|
|
(defface mode-line-is-modified nil "Face for mode-line modified symbol")
|
2015-10-13 00:46:17 -04:00
|
|
|
(defface mode-line-buffer-file nil "Face for mode-line buffer file path")
|
2015-09-30 13:47:57 -04:00
|
|
|
|
|
|
|
;; Custom modeline segments
|
2015-09-28 15:55:25 -04:00
|
|
|
(spaceline-define-segment narf-buffer-path
|
2015-10-26 01:29:50 -04:00
|
|
|
(if buffer-file-name
|
|
|
|
(let* ((project-path (let (projectile-require-project-root) (projectile-project-root)))
|
|
|
|
(buffer-path (file-relative-name buffer-file-name project-path))
|
|
|
|
(max-length (/ (window-width) 2))
|
|
|
|
(path-len (length buffer-path)))
|
|
|
|
(concat (file-name-nondirectory (directory-file-name project-path))
|
|
|
|
"/"
|
|
|
|
(if (> path-len max-length)
|
|
|
|
(concat "…" (replace-regexp-in-string
|
|
|
|
"^.*?/" "/"
|
|
|
|
(substring buffer-path (- path-len max-length) path-len)))
|
|
|
|
buffer-path)))
|
|
|
|
"%b")
|
|
|
|
:face (if active 'mode-line-buffer-file 'mode-line-inactive)
|
2015-11-14 02:37:10 -05:00
|
|
|
:skip-alternate t
|
|
|
|
:tight-right t)
|
2015-10-26 01:29:50 -04:00
|
|
|
|
|
|
|
(spaceline-define-segment narf-buffer-modified
|
|
|
|
(concat
|
2015-10-28 17:27:37 -04:00
|
|
|
(when buffer-file-name
|
|
|
|
(concat
|
|
|
|
(when (buffer-modified-p) "[+]")
|
|
|
|
(unless (file-exists-p buffer-file-name) "[!]")))
|
|
|
|
(if buffer-read-only "[RO]"))
|
2015-10-26 01:29:50 -04:00
|
|
|
:face mode-line-is-modified
|
2015-10-28 17:27:37 -04:00
|
|
|
:when (not (string-prefix-p "*" (buffer-name)))
|
2015-11-09 15:52:42 -05:00
|
|
|
:skip-alternate t
|
2015-10-26 01:29:50 -04:00
|
|
|
:tight t)
|
2015-10-13 00:46:17 -04:00
|
|
|
|
2015-09-28 15:55:25 -04:00
|
|
|
(spaceline-define-segment narf-buffer-encoding-abbrev
|
|
|
|
"The line ending convention used in the buffer."
|
2015-10-28 17:27:37 -04:00
|
|
|
(symbol-name buffer-file-coding-system)
|
2015-11-14 02:37:10 -05:00
|
|
|
:when (not (string-match-p "\\(utf-8\\|undecided\\)"
|
|
|
|
(symbol-name buffer-file-coding-system))))
|
2015-09-28 15:55:25 -04:00
|
|
|
|
|
|
|
(spaceline-define-segment narf-buffer-position
|
|
|
|
"A more vim-like buffer position."
|
2015-11-07 20:17:35 -05:00
|
|
|
(let ((start (window-start))
|
|
|
|
(end (window-end))
|
|
|
|
(pend (point-max)))
|
|
|
|
(if (and (eq start 1)
|
|
|
|
(eq end pend))
|
|
|
|
":All"
|
|
|
|
(let ((perc (/ end 0.01 pend)))
|
|
|
|
(cond ((eq start 1) ":Top")
|
|
|
|
((>= perc 100) ":Bot")
|
|
|
|
(t (format ":%d%%%%" perc))))))
|
2015-11-14 02:37:10 -05:00
|
|
|
:tight t)
|
2015-09-28 15:55:25 -04:00
|
|
|
|
|
|
|
(spaceline-define-segment narf-vc
|
|
|
|
"Version control info"
|
2015-11-14 02:37:10 -05:00
|
|
|
(concat (downcase vc-mode)
|
|
|
|
(case (vc-state buffer-file-name)
|
|
|
|
('edited "+")
|
|
|
|
('conflict "!!!")
|
|
|
|
(t "")))
|
|
|
|
:when (and active vc-mode)
|
2015-11-09 15:52:42 -05:00
|
|
|
:face other-face
|
2015-11-14 02:37:10 -05:00
|
|
|
:tight t)
|
2015-09-28 15:55:25 -04:00
|
|
|
|
2015-10-01 03:40:09 -04:00
|
|
|
(spaceline-define-segment narf-env-version
|
|
|
|
"A HUD that shows which part of the buffer is currently visible."
|
2015-10-06 05:47:24 -04:00
|
|
|
(when (and narf--env-command (not narf--env-version))
|
2015-10-01 03:40:09 -04:00
|
|
|
(narf|spaceline-env-update))
|
|
|
|
narf--env-version
|
|
|
|
:when (and narf--env-version (memq major-mode '(ruby-mode enh-ruby-mode python-mode))))
|
|
|
|
|
2015-10-06 05:47:24 -04:00
|
|
|
(spaceline-define-segment narf-hud
|
|
|
|
"A HUD that shows which part of the buffer is currently visible."
|
2015-11-14 02:37:10 -05:00
|
|
|
(powerline-hud highlight-face other-face 1)
|
|
|
|
:face other-face
|
2015-10-26 01:29:50 -04:00
|
|
|
:tight-right t)
|
2015-10-06 05:47:24 -04:00
|
|
|
|
2015-11-19 05:52:22 -05:00
|
|
|
(defface mode-line-count-face nil "")
|
|
|
|
(make-variable-buffer-local 'anzu--state)
|
2015-10-15 14:01:53 -04:00
|
|
|
(spaceline-define-segment narf-anzu
|
2015-11-14 02:37:10 -05:00
|
|
|
"Show the current match number and the total number of matches. Requires
|
|
|
|
anzu to be enabled."
|
2015-10-15 14:01:53 -04:00
|
|
|
(let ((here anzu--current-position)
|
|
|
|
(total anzu--total-matched))
|
2015-11-19 05:52:22 -05:00
|
|
|
(format " %s/%d%s "
|
|
|
|
(anzu--format-here-position here total)
|
|
|
|
total (if anzu--overflow-p "+" "")))
|
|
|
|
:face (if active 'mode-line-count-face 'mode-line-inactive)
|
2015-11-21 16:17:26 -05:00
|
|
|
:when (and (> anzu--total-matched 0) (evil-ex-hl-active-p 'evil-ex-search))
|
2015-11-14 02:37:10 -05:00
|
|
|
:skip-alternate t
|
2015-10-26 01:29:50 -04:00
|
|
|
:tight t)
|
2015-10-08 01:49:13 -04:00
|
|
|
|
2015-11-14 02:37:10 -05:00
|
|
|
;; TODO mode-line-iedit-face default face
|
|
|
|
(spaceline-define-segment narf-iedit
|
|
|
|
"Show the number of matches and what match you're on (or after). Requires
|
|
|
|
iedit."
|
|
|
|
(let ((this-oc (iedit-find-current-occurrence-overlay))
|
|
|
|
(length (or (ignore-errors (length iedit-occurrences-overlays)) 0)))
|
2015-11-19 05:52:22 -05:00
|
|
|
(format "%s/%s"
|
|
|
|
(save-excursion
|
|
|
|
(unless this-oc
|
|
|
|
(iedit-prev-occurrence)
|
|
|
|
(setq this-oc (iedit-find-current-occurrence-overlay)))
|
|
|
|
(if this-oc
|
|
|
|
;; NOTE: Not terribly reliable
|
|
|
|
(- length (-elem-index this-oc iedit-occurrences-overlays))
|
|
|
|
"-"))
|
|
|
|
length))
|
|
|
|
:face (if active 'mode-line-count-face 'mode-line-inactive)
|
2015-11-14 02:37:10 -05:00
|
|
|
:skip-alternate t
|
2015-11-19 05:52:22 -05:00
|
|
|
:when (bound-and-true-p iedit-mode))
|
2015-11-14 02:37:10 -05:00
|
|
|
|
|
|
|
;; TODO mode-line-substitute-face default face
|
2015-11-17 02:20:23 -05:00
|
|
|
(defface mode-line-substitute-face nil "")
|
2015-11-17 21:48:21 -05:00
|
|
|
;; TODO This is very hackish; refactor?
|
2015-11-14 02:37:10 -05:00
|
|
|
(spaceline-define-segment narf-evil-substitute
|
|
|
|
"Show number of :s matches in real time."
|
2015-11-19 05:52:22 -05:00
|
|
|
(let ((range (if evil-ex-range
|
|
|
|
(cons (car evil-ex-range) (cadr evil-ex-range))
|
|
|
|
(cons (line-beginning-position) (line-end-position))))
|
2015-11-21 16:17:26 -05:00
|
|
|
(pattern (car-safe (evil-delimited-arguments evil-ex-argument 2))))
|
|
|
|
(if pattern
|
|
|
|
(format "%s matches" (count-matches pattern (car range) (cdr range)) evil-ex-argument)
|
|
|
|
" ... "))
|
2015-11-19 05:52:22 -05:00
|
|
|
:face (if active 'mode-line-count-face 'mode-line-inactive)
|
2015-11-14 02:37:10 -05:00
|
|
|
:skip-alternate t
|
2015-11-19 05:52:22 -05:00
|
|
|
:when (and (evil-ex-p) (evil-ex-hl-active-p 'evil-ex-substitute)))
|
2015-11-14 02:37:10 -05:00
|
|
|
|
|
|
|
(spaceline-define-segment narf-major-mode
|
|
|
|
(concat "[" mode-name "]")
|
|
|
|
:skip-alternate t)
|
|
|
|
|
2015-09-30 13:47:57 -04:00
|
|
|
;; Initialize modeline
|
2015-09-28 15:55:25 -04:00
|
|
|
(spaceline-install
|
|
|
|
;; Left side
|
2015-11-30 16:51:13 -05:00
|
|
|
'(narf-anzu narf-iedit narf-evil-substitute
|
2015-10-15 14:01:53 -04:00
|
|
|
(narf-buffer-path remote-host)
|
2015-10-26 01:29:50 -04:00
|
|
|
narf-buffer-modified
|
2015-10-03 04:56:52 -04:00
|
|
|
narf-vc
|
|
|
|
((flycheck-error flycheck-warning flycheck-info) :when active))
|
2015-09-28 15:55:25 -04:00
|
|
|
;; Right side
|
2015-11-30 16:51:13 -05:00
|
|
|
'((selection-info :face highlight-face :skip-alternate t :when active)
|
2015-10-01 03:40:09 -04:00
|
|
|
narf-env-version
|
2015-11-18 15:22:00 -05:00
|
|
|
narf-buffer-encoding-abbrev
|
2015-11-14 02:37:10 -05:00
|
|
|
(narf-major-mode
|
2015-12-09 01:57:56 -05:00
|
|
|
;; (minor-modes :separator " " :tight t)
|
2015-10-03 04:56:52 -04:00
|
|
|
process :when active)
|
2015-09-28 15:55:25 -04:00
|
|
|
(global :when active)
|
2015-11-07 00:20:04 -05:00
|
|
|
("%l·%c" narf-buffer-position)
|
2015-11-09 15:52:42 -05:00
|
|
|
narf-hud
|
2015-10-06 05:47:24 -04:00
|
|
|
)))
|
2015-06-04 18:23:21 -04:00
|
|
|
|
|
|
|
(provide 'core-ui)
|
|
|
|
;;; core-ui.el ends here
|