                length))
      'face (if (active) 'doom-modeline-panel))))
 
+(defun +doom-ml-octicon (icon &optional text face voffset padding)
+  "Displays an octicon ICON with FACE, followed by TEXT. Uses
+`all-the-icons-octicon' to fetch the icon."
+  (let ((padding-str (if padding (propertize (make-string padding ? ) 'face face))))
+    (concat padding-str
+            (when icon
+              (all-the-icons-octicon icon :face face :height 1.1 :v-adjust (or voffset -0.2)))
+            (if text (propertize (concat " " text) 'face face))
+            padding-str)))
+
+(defsubst +modeline--multiple-cursors ()
+  "Show the number of multiple cursors."
+  (cond ((bound-and-true-p multiple-cursors-mode)
+         (propertize
+          (concat " mc " (eval (cadadr mc/mode-line)) " ")
+          'face (if (active) 'doom-modeline-panel)))
+        ((bound-and-true-p evil-mc-cursor-list)
+         (+doom-ml-octicon (if evil-mc-frozen "pin" "pencil")
+                           (number-to-string (length evil-mc-cursor-list))
+                           (if (active) 'doom-modeline-panel)
+                           0
+                           1))))
+
 (def-modeline-segment! +modeline-matches
   "Displays: 1. the currently recording macro, 2. A current/total for the
 current search term (with anzu), 3. The number of substitutions being conducted

                      (+modeline--anzu)
                      (+modeline--evil-substitute)
                      (+modeline--iedit)
                      " ")))
     (or (and (not (equal meta " ")) meta)
         (if buffer-file-name " %I "))))

(setq-default mode-line-format '("" +modeline-bar-start +modeline-format-left +modeline--rest +modeline-bar-end))


;; Set the default modeline as late as possible, giving users a chance to change
;; the above formats.
(add-hook! 'after-init-hook (set-modeline! :main t))

;; Set special modelines for special buffers
(add-hook! '+doom-dashboard-mode-hook (set-modeline! :project))
(add-hook! 'doom-scratch-buffer-hook  (set-modeline! :special))
