Skip to main content
  1. Posts/

Customize Tabline in Emacs

··244 words·2 mins·
Table of Contents

A short note on how to set up a more beautiful tabline for Emacs.

In Emacs, to show the tabline in the top of the frame, add the following config:

(global-tab-line-mode t)

The default tabline is ugly, it also shows the button to create or delete a tab. To disable those button, add the following config:

(setq tab-line-new-button-show nil)  ;; do not show add-new button
(setq tab-line-close-button-show nil)  ;; do not show close button

To change the separator between tabs, set the variable tab-line-separator:

(setq tab-line-separator "")  ;; set it to empty

To further customize the look of tabs, we can employ the powerline package:

(defvar my/tab-height 22)
(defvar my/tab-left (powerline-wave-right 'tab-line nil my/tab-height))
(defvar my/tab-right (powerline-wave-left nil 'tab-line my/tab-height))

(defun my/tab-line-tab-name-buffer (buffer &optional _buffers)
  (powerline-render (list my/tab-left
                          (format "%s" (buffer-name buffer))
(setq tab-line-tab-name-function #'my/tab-line-tab-name-buffer)

;; tab color settings
(set-face-attribute 'tab-line nil ;; background behind tabs
      :background "gray40"
      :foreground "gray60" :distant-foreground "gray50"
      :height 1.0 :box nil)
(set-face-attribute 'tab-line-tab nil ;; active tab in another window
      :inherit 'tab-line
      :foreground "gray70" :background "gray90" :box nil)
(set-face-attribute 'tab-line-tab-current nil ;; active tab in current window
      :background "#b34cb3" :foreground "white" :box nil)
(set-face-attribute 'tab-line-tab-inactive nil ;; inactive tab
      :background "gray60" :foreground "black" :box nil)
(set-face-attribute 'tab-line-highlight nil ;; mouseover
      :background "white" :foreground 'unspecified)

The produced tab is shown in the title image. If you want to change the style of tab from wave to vertical bar, you can use powerline-bar-right and powerline-bar-left instead.



Setting up Yasnippet for Emacs
·458 words·3 mins
Emacs Snippet
Straight.el Bootstrap and Package Install Issue
··130 words·1 min
Learning Emacs as A Nvimmer in One Day
··1413 words·7 mins