Use Org-mode titles for centaur tabs when possible
This commit is contained in:
parent
21743e72a2
commit
3bef1afe18
@ -2284,6 +2284,7 @@ UI-related keybindings:
|
|||||||
(if (buffer-file-name)
|
(if (buffer-file-name)
|
||||||
(apply oldfn args)
|
(apply oldfn args)
|
||||||
(setq header-line-format nil))))
|
(setq header-line-format nil))))
|
||||||
|
;; Enable prefix argument for tab switching keybindings
|
||||||
(advice-add 'centaur-tabs-forward :around
|
(advice-add 'centaur-tabs-forward :around
|
||||||
(lambda (oldfn &rest args)
|
(lambda (oldfn &rest args)
|
||||||
(if (numberp current-prefix-arg)
|
(if (numberp current-prefix-arg)
|
||||||
@ -2296,6 +2297,18 @@ UI-related keybindings:
|
|||||||
(dotimes (_ current-prefix-arg)
|
(dotimes (_ current-prefix-arg)
|
||||||
(apply oldfn args))
|
(apply oldfn args))
|
||||||
(apply oldfn args))))
|
(apply oldfn args))))
|
||||||
|
;; Use Org-mode titles for tab names when possible
|
||||||
|
(advice-add 'centaur-tabs-buffer-tab-label :around
|
||||||
|
(lambda (oldfn tab &rest args)
|
||||||
|
(if-let ((title (org-get-title
|
||||||
|
(with-current-buffer (car tab)
|
||||||
|
(buffer-substring (point-min)
|
||||||
|
(min (point-max) 200))))))
|
||||||
|
(if (> centaur-tabs-label-fixed-length 0)
|
||||||
|
(centaur-tabs-truncate-string centaur-tabs-label-fixed-length
|
||||||
|
(format " %s" title))
|
||||||
|
(format " %s" title))
|
||||||
|
(apply oldfn tab args))))
|
||||||
:general
|
:general
|
||||||
((normal motion visual) "g t" #'centaur-tabs-forward)
|
((normal motion visual) "g t" #'centaur-tabs-forward)
|
||||||
((normal motion visual) "g T" #'centaur-tabs-backward)
|
((normal motion visual) "g T" #'centaur-tabs-backward)
|
||||||
|
Loading…
Reference in New Issue
Block a user