From f561373103be38ecb6dc5103ded7737437acb0ed Mon Sep 17 00:00:00 2001 From: bd Date: Thu, 14 Mar 2024 01:20:44 -0600 Subject: Bind switch-tab to meta-# --- .config/emacs/modules/bd--tabs.el | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .config/emacs/modules/bd--tabs.el (limited to '.config/emacs/modules/bd--tabs.el') diff --git a/.config/emacs/modules/bd--tabs.el b/.config/emacs/modules/bd--tabs.el new file mode 100644 index 0000000..e9c9ac3 --- /dev/null +++ b/.config/emacs/modules/bd--tabs.el @@ -0,0 +1,31 @@ +;; -*- lexical-binding: t; -*- + + +;; turn tabs on, undo/redo mode +(setq tab-bar-show 1) +(tab-bar-history-mode) + + +;; bind tabs to 'Meta' like a browser +(mapcar (lambda (i) + (keymap-global-set (format "M-%d" i) + (lambda () + (interactive) + (tab-bar-select-tab i)))) + (number-sequence 0 9)) + + +;; use project name if it exists +(defun bd/tab-bar-name-function () + (let ((project (project-current))) + (if project + (car (last + (file-name-split + (directory-file-name + (project-root project))))) + (tab-bar-tab-name-current)))) + +(setq tab-bar-tab-name-function #'bd/tab-bar-name-function) + + +(provide 'bd--tabs) -- cgit v1.2.3