   ;; enable this if you want `swiper' to use it
   (setq search-default-mode #'char-fold-to-regexp)
   (setq ivy-re-builders-alist
-    '((swiper . ivy--regex-plus)
-       (counsel-rg . ivy--regex-plus)
-       (t      . ivy--regex-fuzzy)))
+        '((swiper . ivy--regex-plus)
+          (counsel-rg . ivy--regex-plus)
+          (t      . ivy--regex-fuzzy)))
 
   (setq ivy-bibtex-default-action 'ivy-bibtex-insert-key)
 
   (defun eh-ivy-return-recentf-index (dir)
     (when (and (boundp 'recentf-list)
-            recentf-list)
+               recentf-list)
       (let ((files-list
-              (cl-subseq recentf-list
-                0 (min (- (length recentf-list) 1) 20)))
-             (index 0))
+             (cl-subseq recentf-list
+                        0 (min (- (length recentf-list) 1) 20)))
+            (index 0))
         (while files-list
           (if (string-match-p dir (car files-list))
-            (setq files-list nil)
+              (setq files-list nil)
             (setq index (+ index 1))
             (setq files-list (cdr files-list))))
         index)))
 
   (defun eh-ivy-sort-file-function (x y)
     (let* ((x (concat ivy--directory x))
-            (y (concat ivy--directory y))
-            (x-mtime (nth 5 (file-attributes x)))
-            (y-mtime (nth 5 (file-attributes y))))
+           (y (concat ivy--directory y))
+           (x-mtime (nth 5 (file-attributes x)))
+           (y-mtime (nth 5 (file-attributes y))))
       (if (file-directory-p x)
+          (if (file-directory-p y)
+              (let ((x-recentf-index (eh-ivy-return-recentf-index x))
+                    (y-recentf-index (eh-ivy-return-recentf-index y)))
+                (if (and x-recentf-index y-recentf-index)
+                    ;; Directories is sorted by `recentf-list' index
+                    (< x-recentf-index y-recentf-index)
+                  (string< x y)))
+            t)
         (if (file-directory-p y)
-          (let ((x-recentf-index (eh-ivy-return-recentf-index x))
-                 (y-recentf-index (eh-ivy-return-recentf-index y)))
-            (if (and x-recentf-index y-recentf-index)
-              ;; Directories is sorted by `recentf-list' index
-              (< x-recentf-index y-recentf-index)
-              (string< x y)))
-          t)
-        (if (file-directory-p y)
-          nil
+            nil
           ;; Files is sorted by mtime
           (time-less-p y-mtime x-mtime)))))
 
   (add-to-list 'ivy-sort-functions-alist
-    '(read-file-name-internal . eh-ivy-sort-file-function)))
+               '(read-file-name-internal . eh-ivy-sort-file-function)))
 
 
 (after! org

  (defun benmezger/conditional-hugo-enable ()
    (save-excursion
      (if (cdr (assoc "SETUPFILE" (org-roam--extract-global-props '("SETUPFILE"))))
        (org-hugo-auto-export-mode +1)
        (org-hugo-auto-export-mode -1))))
  (add-hook 'org-mode-hook #'benmezger/conditional-hugo-enable))


(after! doom-modeline
  :config
  (setq doom-modeline-continuous-word-count-modes
        '(markdown-mode gfm-mod)))

(use-package! wakatime-mode
  :init
  (cond ((string-equal system-type "gnu/linux")
         (setq wakatime-cli-path "/usr/bin/wakatime"))
        ((string-equal system-type "darwin")
         (setq wakatime-cli-path "/usr/local/bin/wakatime")))
  :config
  (global-wakatime-mode))

