diff options
author | bd <bdunahu@colostate.edu> | 2024-03-14 01:20:44 -0600 |
---|---|---|
committer | bd <bdunahu@colostate.edu> | 2024-03-14 01:20:44 -0600 |
commit | f561373103be38ecb6dc5103ded7737437acb0ed (patch) | |
tree | 9827d4027ea4c135b081a54ea3910927f36450a8 /.config/emacs/modules/bd--tabs.el | |
parent | 396d0e461555de52214f5224e4ff5716766283ca (diff) |
Bind switch-tab to meta-#
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) |