             (propertize (concat " " (abbreviate-file-name (doom-project-root)))
                         'face face))))
 
+;;
 (def-modeline-segment! buffer-info
   "Combined information about the current buffer, including the current working
 directory, the file name, and its state (modified, read-only or non-existent)."

  :config
  (setq anzu-cons-mode-line-p nil
        anzu-minimum-input-length 1
        anzu-search-threshold 250))


;;; Flash the mode-line on error

                                     :v-adjust -0.05)
              sep))))

(defvar iedit-mode nil)
(defvar anzu--state nil)
(defsubst +doom-modeline--anzu ()
  "Show the match index and total number thereof. Requires `anzu', also
`evil-anzu' if using `evil-mode' for compatibility with `evil-search'."
  (when (and anzu--state (not iedit-mode))
    (propertize
     (let ((here anzu--current-position)
           (total anzu--total-matched))
       (pcase anzu--state
         ('replace-query (format " %d replace " total))
         ('replace (format " %d/%d " here total))
         (_ (format " %s/%d%s " here total (if anzu--overflow-p "+" "")))))
     'face (if (active) 'doom-modeline-panel))))
;; Ensure anzu state is cleared when searches are aborted
(advice-add 'evil-ex-search-abort :after 'anzu--reset-mode-line)

(defvar evil-mode nil)
(defsubst +doom-modeline--evil-substitute ()
  "Show number of :s matches in real time."
  (when (and evil-mode
             (or (assq 'evil-ex-substitute evil-ex-active-highlights-alist)
                 (assq 'evil-ex-global-match evil-ex-active-highlights-alist)
                 (assq 'evil-ex-buffer-match evil-ex-active-highlights-alist)))
    (propertize
     (let ((range (if evil-ex-range
                      (cons (car evil-ex-range) (cadr evil-ex-range))
                    (cons (line-beginning-position) (line-end-position))))
           (pattern (car-safe (evil-delimited-arguments evil-ex-argument 2))))
       (if pattern
           (format " %s matches " (how-many pattern (car range) (cdr range)))
         " ... "))
     'face (if (active) 'doom-modeline-panel))))

