 
 (defun *major-mode ()
   "The major mode, including process, environment and text-scale info."
-  (concat (format-mode-line mode-name)
+  (concat " "
+          (format-mode-line mode-name)
           (if (stringp mode-line-process) mode-line-process)
           (if doom-ml--env-version (concat " " doom-ml--env-version))
           (and (featurep 'face-remap)
                (/= text-scale-mode-amount 0)
-               (format " (%+d)" text-scale-mode-amount))))
+               (format " (%+d)" text-scale-mode-amount))
+          " "))
 
 (defun *vc ()
   "Displays the current branch, colored based on its state."
   (when vc-mode
-    (let ((backend (concat " " (substring vc-mode (+ 2 (length (symbol-name (vc-backend buffer-file-name)))))))
+    (let ((backend (substring vc-mode (+ 2 (length (symbol-name (vc-backend buffer-file-name))))))
           (face (let ((state (vc-state buffer-file-name)))
                   (cond ((memq state '(edited added))
-                         'mode-line-vcs-info)
-                        ((memq state '(removed needs-merge needs-update conflict removed unregistered))
-                         'mode-line-vcs-warning)))))
-      (if active
-          (propertize backend 'face face)
-        backend))))
+                         'doom-modeline-info)
+                        ((memq state '(removed needs-merge needs-update conflict unregistered))
+                         'doom-modeline-urgent)
+                        (t 'doom-modeline-warning)))))
+      (concat
+       " "
+       (propertize (all-the-icons-octicon "git-branch")
+                   'face `(:inherit ,(if active face 'mode-line-inactive)
+                           :family ,(all-the-icons-octicon-family)
+                           :height 1.25)
+                   'display '(raise -0.1))
+       " "
+       (propertize backend 'face (if active face))
+       ;; (if active
+       ;;     (propertize backend 'face `(:inherit (variable-pitch ,face)))
+       ;;   backend)
+       " "))))
 
 (defvar-local doom--flycheck-err-cache nil "")
 (defvar-local doom--flycheck-cache nil "")
 (defun *flycheck ()
   "Persistent and cached flycheck indicators in the mode-line."
-  (when (and (featurep 'flycheck)
-             flycheck-mode
-             (or flycheck-current-errors
-                 (eq 'running flycheck-last-status-change)))
-    (or (and (or (eq doom--flycheck-err-cache doom--flycheck-cache)
-                 (memq flycheck-last-status-change '(running not-checked)))
-             doom--flycheck-cache)
-        (and (setq doom--flycheck-err-cache flycheck-current-errors)
-             (setq doom--flycheck-cache
-                   (let ((fe (doom-ml-flycheck-count 'error))
-                         (fw (doom-ml-flycheck-count 'warning)))
-                     (concat
-                      (if fe (propertize (format " •%d " fe)
-                                         'face (if active
-                                                   'doom-flycheck-error
-                                                 'mode-line)))
-                      (if fw (propertize (format " •%d " fw)
-                                         'face (if active
-                                                   'doom-flycheck-warning
-                                                 'mode-line))))))))))
+  (when (and (featurep 'flycheck) flycheck-mode)
+    (if (or flycheck-current-errors
+            (eq 'running flycheck-last-status-change))
+        (or (and (or (eq doom--flycheck-err-cache doom--flycheck-cache)
+                     (memq flycheck-last-status-change '(running not-checked)))
+                 doom--flycheck-cache)
+            (and (setq doom--flycheck-err-cache flycheck-current-errors)
+                 (setq doom--flycheck-cache
+                       (let ((issues (doom-ml-flycheck-count 'error)))
+                         (concat (if issues
+                                     (concat
+                                      (doom-ml-icon "x" 'doom-modeline-urgent 1.2)
+                                      (propertize (format " %d issues" issues)
+                                                  'face 'doom-modeline-urgent))
+                                   (setq issues (doom-ml-flycheck-count 'warning))
+                                   (if issues
+                                       (concat
+                                        (doom-ml-icon "x" 'doom-modeline-warning 1.2)
+                                        (propertize (format " %d issues" issues)
+                                                    'face 'doom-modeline-warning))
+                                     (when active
+                                       (doom-ml-icon "check" 'doom-modeline-info 1.2))))
+                                 " ")))))
+      (when active
+        (concat
+         (doom-ml-icon "check" 'doom-modeline-info 1.2) " ")))))
 
 (defun *selection-info ()
   "Information about the current selection, such as how many characters and

  (when buffer-file-name
    (propertize
     (f-dirname
      (let ((buffer-path (file-relative-name buffer-file-name (doom/project-root)))
            (max-length (truncate (/ (window-body-width) 1.75))))
        (concat (projectile-project-name) "/"
                (if (> (length buffer-path) max-length)

        "?"
      (cdr-safe (assq state (flycheck-count-errors flycheck-current-errors))))))

(defun doom-ml-icon (icon-name face height)
  (propertize (all-the-icons-octicon icon-name)
              'face `(:inherit ,face
                      :family ,(all-the-icons-octicon-family)
                      :height ,height)
              'display '(raise -0.06)))

;; pyenv/rbenv version segment
(defvar doom-ml-env-version-hook '()
  "Hook that runs whenever the environment version changes (e.g. rbenv/pyenv)")

(defun doom-ml|env-update ()
  (when doom-ml--env-command
    (let ((default-directory (projectile-project-root)))
      (let ((s (shell-command-to-string doom-ml--env-command)))
        (setq doom-ml--env-version (if (string-match "[ \t\n\r]+\\'" s)
                                    (replace-match "" t t s)
                                  s))
        (run-hook-with-args 'doom-ml-env-version-hook doom-ml--env-version)))))

(defmacro def-version-cmd! (mode command)
  "Define a COMMAND for MODE that will set `doom-ml--env-command' when that mode
is activated, which should return the version number of the current environment.
It is used by `doom-ml|env-update' to display a version number in the modeline.
For instance:

  (def-version-cmd! ruby-mode \"ruby --version | cut -d' ' -f2\")

This will display the ruby version in the modeline in ruby-mode buffers. It is
cached the first time."
  (add-hook 'focus-in-hook 'doom-ml|env-update)
  (add-hook 'find-file-hook 'doom-ml|env-update)
  `(add-hook ',mode (lambda () (setq doom-ml--env-command ,command))))


;;
