diff options
Diffstat (limited to '.config/emacs/modules/bd--tabs.el')
-rw-r--r-- | .config/emacs/modules/bd--tabs.el | 31 |
1 files changed, 31 insertions, 0 deletions
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) |