diff --git a/core/core-helm.el b/core/core-helm.el index 36d6a3934..5fdda0e9b 100644 --- a/core/core-helm.el +++ b/core/core-helm.el @@ -51,10 +51,11 @@ "C-u" 'helm-delete-minibuffer-contents)) ;;; Helm hacks + (defvar narf-helm-header-fg (face-attribute 'helm-source-header :foreground) "docstring") (defun narf*helm-hide-source-header-maybe () (if (<= (length helm-sources) 1) - (set-face-attribute 'helm-source-header nil :height 0.1) - (set-face-attribute 'helm-source-header nil :height 1.0))) + (set-face-attribute 'helm-source-header nil :height 0.1 :foreground "#111111") + (set-face-attribute 'helm-source-header nil :height 1.0 :foreground narf-helm-header-fg))) (defun narf*helm-hide-modeline (source &optional force) (setq mode-line-format nil) @@ -67,7 +68,7 @@ plist) ;; Shrink source headers if there is only one source - (add-hook 'helm-before-initialize-hook 'narf*helm-hide-source-header-maybe) + (add-hook 'helm-after-initialize-hook 'narf*helm-hide-source-header-maybe) ;; A simpler prompt: see `helm-global-prompt' (advice-add 'helm :filter-args 'narf*helm-replace-prompt) ;; Hide mode-line in helm windows diff --git a/core/core-ui.el b/core/core-ui.el index b4cd9b8f7..ade6cc01e 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -22,7 +22,7 @@ hl-line-sticky-flag nil ; only highlight in one window jit-lock-defer-time nil - jit-lock-stealth-time 1 + jit-lock-stealth-time 0.5 idle-update-delay 1 split-width-threshold nil ; favor horizontal splits @@ -491,7 +491,41 @@ Supports both Emacs and Evil cursor conventions." (global :when active) ("%l/%c" *buffer-position) *hud - ))) + )) + + (spaceline-define-segment helm-id + "Number of helm candidates." + (buffer-name) + :when (bound-and-true-p helm-alive-p) + :tight t) + + (spaceline-define-segment helm-number + "Number of helm candidates." + (format "%d/%s (%s total)" + (helm-candidate-number-at-point) + (helm-get-candidate-number t) + (helm-get-candidate-number)) + :when (bound-and-true-p helm-alive-p)) + +(spaceline-define-segment helm-help + "Helm keybindings help." + (-interleave + (mapcar (lambda (s) + (propertize (substitute-command-keys s) 'face 'bold)) + '("\\\\[helm-help]" + "\\\\[helm-select-action]" + "\\\\[helm-maybe-exit-minibuffer]/F1/F2...")) + '("(help)" "(actions)" "(action)")) + :when (bound-and-true-p helm-alive-p)) + + (defun narf|helm-mode-line (source &optional force) + "Set up a custom helm modeline." + (setq spaceline--helm-current-source source + mode-line-format '("%e" (:eval (spaceline--prepare + '(helm-number helm-id) + '(helm-help))))) + (when force (force-mode-line-update))) + (advice-add 'helm-display-mode-line :after 'narf|helm-mode-line)) (provide 'core-ui) ;;; core-ui.el ends here