   :config
   (winner-mode t))
 
+;; builtin midnight package
+(use-package midnight
+  :ensure nil
+  :defer 1
+  :custom
+  (clean-buffer-list-delay-general 2)
+  :config
+  (setq clean-buffer-list-kill-never-regexps
+        (nconc clean-buffer-list-kill-never-regexps
+               '("\\`\\*tramp/.*\\*\\`"
+                 "\\`\\magit.*\\`"
+                 "\\`\\*ftp .*\\*\\`")))
+  (setq clean-buffer-list-kill-never-buffer-names
+        (nconc clean-buffer-list-kill-never-buffer-names
+               '( "*git-credential-cache--daemon*" )))
+  (run-at-time "1 hour" 3600 #'clean-buffer-list)             ; clear out old buffers every hour (midnight)
+  (midnight-mode t))
+
 ;; built-in minibuffer package
 (use-package minibuffer
   :ensure nil

  (electric-indent-mode +1)                                   ; turn on electric mode globally (electric)
  (delete-selection-mode t)                                   ; pastes delete selection
  (blink-cursor-mode -1)                                      ; don't blink cursor
  (run-at-time "1 hour" 3600 #'clean-buffer-list)             ; clear out old buffers every hour (midnight)
  (unless (display-graphic-p)
    ;; use mouse in xterm mode
    (xterm-mouse-mode t)

  (recentf-exclude `(,@recentf-exclude
                     "COMMIT_EDITMSG\\'"
                     ".*-autoloads\\.el\\'"
                     ,tramp-file-name-regexp
                     "[/\\]\\.elpa/"
                     ))
  (recentf-max-saved-items 200)
