2019-08-10 14:14:51 -04:00
|
|
|
;;; ui/tabs/config.el -*- lexical-binding: t; -*-
|
|
|
|
|
2024-04-06 00:11:30 -04:00
|
|
|
(defcustom +tabs-buffer-update-groups-delay 0.1
|
|
|
|
"Minimum wait time (in seconds) before tab groups are recalculated."
|
|
|
|
:type 'float
|
|
|
|
:group 'doom)
|
|
|
|
|
|
|
|
|
|
|
|
;;
|
|
|
|
;;; Packages
|
|
|
|
|
2019-08-10 14:14:51 -04:00
|
|
|
(use-package! centaur-tabs
|
2020-05-18 02:50:22 -04:00
|
|
|
:hook (doom-first-file . centaur-tabs-mode)
|
2019-08-10 14:14:51 -04:00
|
|
|
:init
|
2019-12-30 00:49:32 -05:00
|
|
|
(setq centaur-tabs-set-icons t
|
|
|
|
centaur-tabs-gray-out-icons 'buffer
|
2019-08-10 14:14:51 -04:00
|
|
|
centaur-tabs-set-bar 'left
|
2019-12-30 00:49:32 -05:00
|
|
|
centaur-tabs-set-modified-marker t
|
|
|
|
centaur-tabs-close-button "✕"
|
2020-08-02 15:33:48 +08:00
|
|
|
centaur-tabs-modified-marker "•"
|
2023-09-14 09:37:46 +08:00
|
|
|
centaur-tabs-icon-type 'nerd-icons
|
2020-05-03 14:55:36 -04:00
|
|
|
;; Scrolling (with the mouse wheel) past the end of the tab list
|
|
|
|
;; replaces the tab list with that of another Doom workspace. This
|
|
|
|
;; prevents that.
|
|
|
|
centaur-tabs-cycle-scope 'tabs)
|
2019-08-10 14:14:51 -04:00
|
|
|
|
|
|
|
:config
|
2021-09-26 12:07:35 +02:00
|
|
|
(add-hook! '(+doom-dashboard-mode-hook +popup-buffer-mode-hook)
|
|
|
|
(defun +tabs-disable-centaur-tabs-mode-maybe-h ()
|
|
|
|
"Disable `centaur-tabs-mode' in current buffer."
|
|
|
|
(when (centaur-tabs-mode-on-p)
|
2024-04-06 00:11:30 -04:00
|
|
|
(centaur-tabs-local-mode))))
|
|
|
|
|
|
|
|
;; HACK: `centaur-tabs-buffer-update-groups' is both expensive and called too
|
|
|
|
;; frequently. There really is no reason to call it more than 10 times per
|
|
|
|
;; second, as buffers rarely change groups more frequently than that.
|
|
|
|
(let ((time (float-time)))
|
|
|
|
(defadvice! +tabs--rate-limit-buffer-update-groups-a (fn)
|
|
|
|
:around #'centaur-tabs-buffer-update-groups
|
|
|
|
(let ((now (float-time)))
|
|
|
|
(if-let ((buf (and (< now (+ time +tabs-buffer-update-groups-delay))
|
|
|
|
(assq (current-buffer) centaur-tabs--buffers))))
|
|
|
|
(car (nth 2 buf))
|
|
|
|
(setq time now)
|
2024-06-20 17:26:06 -04:00
|
|
|
(funcall fn)))))
|
|
|
|
|
|
|
|
;; This is deferred twice to ensure these settings apply *after* any user
|
|
|
|
;; configuration!
|
|
|
|
(after! centaur-tabs
|
|
|
|
;; HACK: `centaur-tabs-line-tab' reads `centaur-tabs-ace-jump-keys' without
|
|
|
|
;; length guards. If there are fewer entries than you have tabs, you'll
|
|
|
|
;; see an error (ema2159/centaur-tabs#231).
|
|
|
|
;; REVIEW: Remove when ema2159/centaur-tabs#231 is dealt with.
|
|
|
|
(when (< (length centaur-tabs-ace-jump-keys) 100)
|
|
|
|
(setq centaur-tabs-ace-jump-keys
|
|
|
|
(append centaur-tabs-ace-jump-keys (make-list 100 ?\ ))))))
|
2019-12-30 00:49:32 -05:00
|
|
|
|
|
|
|
;; TODO tab-bar-mode (emacs 27)
|
|
|
|
;; TODO tab-line-mode (emacs 27)
|