Improve centaur-tabs tab cycling

- Limit cycling to visible tabs
- Advise the forward and backward tab functions to respect the prefix
  argument
This commit is contained in:
Jeremy Dormitzer 2020-02-26 15:21:16 -05:00
parent 8429ff5e98
commit ca6900ab45

View File

@ -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)