From ca6900ab45dac8e1e397da522066c12fb7024432 Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Wed, 26 Feb 2020 15:21:16 -0500 Subject: [PATCH] Improve centaur-tabs tab cycling - Limit cycling to visible tabs - Advise the forward and backward tab functions to respect the prefix argument --- emacs/init.org | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/emacs/init.org b/emacs/init.org index 3407184..f31560e 100755 --- a/emacs/init.org +++ b/emacs/init.org @@ -2271,7 +2271,8 @@ UI-related keybindings: centaur-tabs-backward-tab-text " ◀ " centaur-tabs-forward-tab-text " ▶ " centaur-tabs-close-button "✕" - centaur-tabs-modified-marker "⬤") + centaur-tabs-modified-marker "⬤" + centaur-tabs-cycle-scope 'tabs) (leader-def-key "uT" #'centaur-tabs-mode) (centaur-tabs-mode) :config @@ -2282,6 +2283,18 @@ UI-related keybindings: (if (buffer-file-name) (apply oldfn args) (setq header-line-format nil)))) + (advice-add 'centaur-tabs-forward :around + (lambda (oldfn &rest args) + (if (numberp current-prefix-arg) + (dotimes (_ current-prefix-arg) + (apply oldfn args)) + (apply oldfn args)))) + (advice-add 'centaur-tabs-backward :around + (lambda (oldfn &rest args) + (if (numberp current-prefix-arg) + (dotimes (_ current-prefix-arg) + (apply oldfn args)) + (apply oldfn args)))) :general ((normal motion visual) "g t" #'centaur-tabs-forward) ((normal motion visual) "g T" #'centaur-tabs-backward)